Socket
Socket
Sign inDemoInstall

@meilisearch/instant-meilisearch

Package Overview
Dependencies
Maintainers
2
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.2.0 to 0.2.1

9

dist/instant-meilisearch.cjs.js

@@ -119,3 +119,9 @@ 'use strict';

: this.hitsPerPage;
const { query, facets, facetFilters, attributesToSnippet } = params;
const {
query,
facets,
facetFilters,
attributesToSnippet,
filters,
} = params;
const searchInput = {

@@ -127,2 +133,3 @@ q: this.placeholderSearch && query === '' ? null : query,

attributesToCrop: attributesToSnippet,
filters,
limit,

@@ -129,0 +136,0 @@ };

2

dist/instant-meilisearch.cjs.min.js

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

"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=t(require("meilisearch"));function i(t){return Object.keys(t).reduce((e,i)=>(void 0!==t[i]&&(e[i]=t[i]),e),{})}function s(t){return"string"==typeof t||t instanceof String}function a(t,e,i){let a=t||"";return s(t)&&(a=t.replace(/<em>/g,e).replace(/<\/em>/g,i)),a.toString()}function r({formattedHit:t,highlightPreTag:e,highlightPostTag:i}){return Object.keys(t).reduce((s,r)=>(s[r]={value:a(t[r],e,i)},s),{})}function n(t,e,i,r){let n=t;return void 0!==e&&s(n)&&(n[0]===n[0].toLowerCase()&&!1===n.startsWith("<em>")&&(n=`${e}${n}`),!1==!!n.match(/[.!?]$/)&&(n=`${n}${e}`)),a(n,i,r)}function o({formattedHit:t,attributesToSnippet:e,snippetEllipsisText:i,highlightPreTag:s,highlightPostTag:a}){return void 0===e?null:(e=e.map(t=>t.split(":")[0]),Object.keys(t).reduce((r,o)=>(e.includes(o)&&(r[o]={value:n(t[o],i,s,a)}),r),{}))}module.exports=function(t,s,a={}){return{client:new e.default({host:t,apiKey:s}),attributesToHighlight:["*"],paginationTotalHits:a.paginationTotalHits||200,placeholderSearch:!1!==a.placeholderSearch,transformToMeiliSearchParams:function(t){const e=this.pagination?this.paginationTotalHits:this.hitsPerPage,{query:s,facets:a,facetFilters:r,attributesToSnippet:n}=t;return i({q:this.placeholderSearch&&""===s?null:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,limit:e})},parseHits:function(t,e){if(this.pagination){const i=e.page*this.hitsPerPage;t=t.splice(i,this.hitsPerPage)}return t.map(t=>{const i=t._formatted;return delete t._formatted,{...t,_highlightResult:r({formattedHit:i,...e}),_snippetResult:o({formattedHit:i,...e})}})},paginationParams:function(t,e){if(this.pagination){const i=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+i,page:e.page}}},parseMeiliSearchResponse:function(t,e,s){const{exhaustiveFacetsCount:a,exhaustiveNbHits:r,facetsDistribution:n,nbHits:o,processingTimeMs:h,query:u,hits:c}=e;return{results:[i({index:t,hitsPerPage:this.hitsPerPage,facets:n,exhaustiveFacetsCount:a,exhaustiveNbHits:r,nbHits:o,processingTimeMs:h,query:u,...this.paginationParams(c.length,s),hits:this.parseHits(c,s)})]}},search:async function(t){const e=t[0].params;this.pagination=void 0!==e.page,this.hitsPerPage=e.hitsPerPage||20;const i=this.transformToMeiliSearchParams(e),s=t[0].indexName,a=await this.client.getIndex(s).search(i.q,i);return this.parseMeiliSearchResponse(s,a,t[0].params)}}};
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=t(require("meilisearch"));function i(t){return Object.keys(t).reduce((e,i)=>(void 0!==t[i]&&(e[i]=t[i]),e),{})}function s(t){return"string"==typeof t||t instanceof String}function a(t,e,i){let a=t||"";return s(t)&&(a=t.replace(/<em>/g,e).replace(/<\/em>/g,i)),a.toString()}function r({formattedHit:t,highlightPreTag:e,highlightPostTag:i}){return Object.keys(t).reduce((s,r)=>(s[r]={value:a(t[r],e,i)},s),{})}function n(t,e,i,r){let n=t;return void 0!==e&&s(n)&&(n[0]===n[0].toLowerCase()&&!1===n.startsWith("<em>")&&(n=`${e}${n}`),!1==!!n.match(/[.!?]$/)&&(n=`${n}${e}`)),a(n,i,r)}function o({formattedHit:t,attributesToSnippet:e,snippetEllipsisText:i,highlightPreTag:s,highlightPostTag:a}){return void 0===e?null:(e=e.map(t=>t.split(":")[0]),Object.keys(t).reduce((r,o)=>(e.includes(o)&&(r[o]={value:n(t[o],i,s,a)}),r),{}))}module.exports=function(t,s,a={}){return{client:new e.default({host:t,apiKey:s}),attributesToHighlight:["*"],paginationTotalHits:a.paginationTotalHits||200,placeholderSearch:!1!==a.placeholderSearch,transformToMeiliSearchParams:function(t){const e=this.pagination?this.paginationTotalHits:this.hitsPerPage,{query:s,facets:a,facetFilters:r,attributesToSnippet:n,filters:o}=t;return i({q:this.placeholderSearch&&""===s?null:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,filters:o,limit:e})},parseHits:function(t,e){if(this.pagination){const i=e.page*this.hitsPerPage;t=t.splice(i,this.hitsPerPage)}return t.map(t=>{const i=t._formatted;return delete t._formatted,{...t,_highlightResult:r({formattedHit:i,...e}),_snippetResult:o({formattedHit:i,...e})}})},paginationParams:function(t,e){if(this.pagination){const i=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+i,page:e.page}}},parseMeiliSearchResponse:function(t,e,s){const{exhaustiveFacetsCount:a,exhaustiveNbHits:r,facetsDistribution:n,nbHits:o,processingTimeMs:h,query:u,hits:c}=e;return{results:[i({index:t,hitsPerPage:this.hitsPerPage,facets:n,exhaustiveFacetsCount:a,exhaustiveNbHits:r,nbHits:o,processingTimeMs:h,query:u,...this.paginationParams(c.length,s),hits:this.parseHits(c,s)})]}},search:async function(t){const e=t[0].params;this.pagination=void 0!==e.page,this.hitsPerPage=e.hitsPerPage||20;const i=this.transformToMeiliSearchParams(e),s=t[0].indexName,a=await this.client.getIndex(s).search(i.q,i);return this.parseMeiliSearchResponse(s,a,t[0].params)}}};
//# sourceMappingURL=instant-meilisearch.cjs.min.js.map

@@ -113,3 +113,9 @@ import MeiliSearch from 'meilisearch';

: this.hitsPerPage;
const { query, facets, facetFilters, attributesToSnippet } = params;
const {
query,
facets,
facetFilters,
attributesToSnippet,
filters,
} = params;
const searchInput = {

@@ -121,2 +127,3 @@ q: this.placeholderSearch && query === '' ? null : query,

attributesToCrop: attributesToSnippet,
filters,
limit,

@@ -123,0 +130,0 @@ };

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

import t from"meilisearch";function e(t){return Object.keys(t).reduce((e,i)=>(void 0!==t[i]&&(e[i]=t[i]),e),{})}function i(t){return"string"==typeof t||t instanceof String}function s(t,e,s){let a=t||"";return i(t)&&(a=t.replace(/<em>/g,e).replace(/<\/em>/g,s)),a.toString()}function a({formattedHit:t,highlightPreTag:e,highlightPostTag:i}){return Object.keys(t).reduce((a,r)=>(a[r]={value:s(t[r],e,i)},a),{})}function r(t,e,a,r){let n=t;return void 0!==e&&i(n)&&(n[0]===n[0].toLowerCase()&&!1===n.startsWith("<em>")&&(n=`${e}${n}`),!1==!!n.match(/[.!?]$/)&&(n=`${n}${e}`)),s(n,a,r)}function n({formattedHit:t,attributesToSnippet:e,snippetEllipsisText:i,highlightPreTag:s,highlightPostTag:a}){return void 0===e?null:(e=e.map(t=>t.split(":")[0]),Object.keys(t).reduce((n,o)=>(e.includes(o)&&(n[o]={value:r(t[o],i,s,a)}),n),{}))}export default function(i,s,r={}){return{client:new t({host:i,apiKey:s}),attributesToHighlight:["*"],paginationTotalHits:r.paginationTotalHits||200,placeholderSearch:!1!==r.placeholderSearch,transformToMeiliSearchParams:function(t){const i=this.pagination?this.paginationTotalHits:this.hitsPerPage,{query:s,facets:a,facetFilters:r,attributesToSnippet:n}=t;return e({q:this.placeholderSearch&&""===s?null:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,limit:i})},parseHits:function(t,e){if(this.pagination){const i=e.page*this.hitsPerPage;t=t.splice(i,this.hitsPerPage)}return t.map(t=>{const i=t._formatted;return delete t._formatted,{...t,_highlightResult:a({formattedHit:i,...e}),_snippetResult:n({formattedHit:i,...e})}})},paginationParams:function(t,e){if(this.pagination){const i=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+i,page:e.page}}},parseMeiliSearchResponse:function(t,i,s){const{exhaustiveFacetsCount:a,exhaustiveNbHits:r,facetsDistribution:n,nbHits:o,processingTimeMs:h,query:c,hits:u}=i;return{results:[e({index:t,hitsPerPage:this.hitsPerPage,facets:n,exhaustiveFacetsCount:a,exhaustiveNbHits:r,nbHits:o,processingTimeMs:h,query:c,...this.paginationParams(u.length,s),hits:this.parseHits(u,s)})]}},search:async function(t){const e=t[0].params;this.pagination=void 0!==e.page,this.hitsPerPage=e.hitsPerPage||20;const i=this.transformToMeiliSearchParams(e),s=t[0].indexName,a=await this.client.getIndex(s).search(i.q,i);return this.parseMeiliSearchResponse(s,a,t[0].params)}}}
import t from"meilisearch";function e(t){return Object.keys(t).reduce((e,i)=>(void 0!==t[i]&&(e[i]=t[i]),e),{})}function i(t){return"string"==typeof t||t instanceof String}function s(t,e,s){let a=t||"";return i(t)&&(a=t.replace(/<em>/g,e).replace(/<\/em>/g,s)),a.toString()}function a({formattedHit:t,highlightPreTag:e,highlightPostTag:i}){return Object.keys(t).reduce((a,r)=>(a[r]={value:s(t[r],e,i)},a),{})}function r(t,e,a,r){let n=t;return void 0!==e&&i(n)&&(n[0]===n[0].toLowerCase()&&!1===n.startsWith("<em>")&&(n=`${e}${n}`),!1==!!n.match(/[.!?]$/)&&(n=`${n}${e}`)),s(n,a,r)}function n({formattedHit:t,attributesToSnippet:e,snippetEllipsisText:i,highlightPreTag:s,highlightPostTag:a}){return void 0===e?null:(e=e.map(t=>t.split(":")[0]),Object.keys(t).reduce((n,o)=>(e.includes(o)&&(n[o]={value:r(t[o],i,s,a)}),n),{}))}export default function(i,s,r={}){return{client:new t({host:i,apiKey:s}),attributesToHighlight:["*"],paginationTotalHits:r.paginationTotalHits||200,placeholderSearch:!1!==r.placeholderSearch,transformToMeiliSearchParams:function(t){const i=this.pagination?this.paginationTotalHits:this.hitsPerPage,{query:s,facets:a,facetFilters:r,attributesToSnippet:n,filters:o}=t;return e({q:this.placeholderSearch&&""===s?null:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,filters:o,limit:i})},parseHits:function(t,e){if(this.pagination){const i=e.page*this.hitsPerPage;t=t.splice(i,this.hitsPerPage)}return t.map(t=>{const i=t._formatted;return delete t._formatted,{...t,_highlightResult:a({formattedHit:i,...e}),_snippetResult:n({formattedHit:i,...e})}})},paginationParams:function(t,e){if(this.pagination){const i=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+i,page:e.page}}},parseMeiliSearchResponse:function(t,i,s){const{exhaustiveFacetsCount:a,exhaustiveNbHits:r,facetsDistribution:n,nbHits:o,processingTimeMs:h,query:c,hits:u}=i;return{results:[e({index:t,hitsPerPage:this.hitsPerPage,facets:n,exhaustiveFacetsCount:a,exhaustiveNbHits:r,nbHits:o,processingTimeMs:h,query:c,...this.paginationParams(u.length,s),hits:this.parseHits(u,s)})]}},search:async function(t){const e=t[0].params;this.pagination=void 0!==e.page,this.hitsPerPage=e.hitsPerPage||20;const i=this.transformToMeiliSearchParams(e),s=t[0].indexName,a=await this.client.getIndex(s).search(i.q,i);return this.parseMeiliSearchResponse(s,a,t[0].params)}}}
//# sourceMappingURL=instant-meilisearch.esm.min.js.map

@@ -14,3 +14,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).instantMeiliSearch=e()}(this,(function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t=function(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}((function(t,e){t.exports=function(){

***************************************************************************** */
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){t.done?n(t.value):i(t.value).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function i(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(e){return a([t,e])}}function a(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var s=function(t){function n(e){var r=t.call(this,e)||this;return r.name="MeiliSearchError",r.type="MeiliSearchError",Error.captureStackTrace(r,n),r}return e(n,t),n}(Error),o=function(t){function n(e){var r=t.call(this,e)||this;return r.name="MeiliSearchTimeOutError",r.type=r.constructor.name,Error.captureStackTrace(r,n),r}return e(n,t),n}(Error),u=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}},a=Object.prototype.toString;function c(t){return"[object Array]"===a.call(t)}function h(t){return void 0===t}function f(t){return null!==t&&!h(t)&&null!==t.constructor&&!h(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function d(t){return"[object ArrayBuffer]"===a.call(t)}function l(t){return"undefined"!=typeof FormData&&t instanceof FormData}function p(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function v(t){return"string"==typeof t}function g(t){return"number"==typeof t}function y(t){return null!==t&&"object"==typeof t}function m(t){return"[object Date]"===a.call(t)}function b(t){return"[object File]"===a.call(t)}function w(t){return"[object Blob]"===a.call(t)}function x(t){return"[object Function]"===a.call(t)}function T(t){return y(t)&&x(t.pipe)}function S(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function E(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function C(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document}function P(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),c(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function R(){var t={};function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=R(t[n],e):t[n]=e}for(var n=0,r=arguments.length;n<r;n++)P(arguments[n],e);return t}function A(){var t={};function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=A(t[n],e):t[n]="object"==typeof e?A({},e):e}for(var n=0,r=arguments.length;n<r;n++)P(arguments[n],e);return t}function k(t,e,n){return P(e,(function(e,r){t[r]=n&&"function"==typeof e?u(e,n):e})),t}var j={isArray:c,isArrayBuffer:d,isBuffer:f,isFormData:l,isArrayBufferView:p,isString:v,isNumber:g,isObject:y,isUndefined:h,isDate:m,isFile:b,isBlob:w,isFunction:x,isStream:T,isURLSearchParams:S,isStandardBrowserEnv:C,forEach:P,merge:R,deepMerge:A,extend:k,trim:E};function O(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var D=function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(j.isURLSearchParams(e))r=e.toString();else{var i=[];j.forEach(e,(function(t,e){null!=t&&(j.isArray(t)?e+="[]":t=[t],j.forEach(t,(function(t){j.isDate(t)?t=t.toISOString():j.isObject(t)&&(t=JSON.stringify(t)),i.push(O(e)+"="+O(t))})))})),r=i.join("&")}if(r){var s=t.indexOf("#");-1!==s&&(t=t.slice(0,s)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t};function N(){this.handlers=[]}N.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},N.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},N.prototype.forEach=function(t){j.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var H=N,U=function(t,e,n){return j.forEach(n,(function(n){t=n(t,e)})),t},q=function(t){return!(!t||!t.__CANCEL__)},F=function(t,e){j.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))},L=function(t,e,n,r,i){return t.config=e,n&&(t.code=n),t.request=r,t.response=i,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t},M=function(t,e,n,r,i){var s=new Error(t);return L(s,e,n,r,i)},B=function(t,e,n){var r=n.config.validateStatus;!r||r(n.status)?t(n):e(M("Request failed with status code "+n.status,n.config,null,n.request,n))},_=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},I=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},$=function(t,e){return t&&!_(e)?I(t,e):e},z=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],J=function(t){var e,n,r,i={};return t?(j.forEach(t.split("\n"),(function(t){if(r=t.indexOf(":"),e=j.trim(t.substr(0,r)).toLowerCase(),n=j.trim(t.substr(r+1)),e){if(i[e]&&z.indexOf(e)>=0)return;i[e]="set-cookie"===e?(i[e]?i[e]:[]).concat([n]):i[e]?i[e]+", "+n:n}})),i):i},K=j.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=r(window.location.href),function(e){var n=j.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},X=j.isStandardBrowserEnv()?{write:function(t,e,n,r,i,s){var o=[];o.push(t+"="+encodeURIComponent(e)),j.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),j.isString(r)&&o.push("path="+r),j.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},G=function(t){return new Promise((function(e,n){var r=t.data,i=t.headers;j.isFormData(r)&&delete i["Content-Type"];var s=new XMLHttpRequest;if(t.auth){var o=t.auth.username||"",u=t.auth.password||"";i.Authorization="Basic "+btoa(o+":"+u)}var a=$(t.baseURL,t.url);if(s.open(t.method.toUpperCase(),D(a,t.params,t.paramsSerializer),!0),s.timeout=t.timeout,s.onreadystatechange=function(){if(s&&4===s.readyState&&(0!==s.status||s.responseURL&&0===s.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in s?J(s.getAllResponseHeaders()):null,i={data:t.responseType&&"text"!==t.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:r,config:t,request:s};B(e,n,i),s=null}},s.onabort=function(){s&&(n(M("Request aborted",t,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(M("Network Error",t,null,s)),s=null},s.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(M(e,t,"ECONNABORTED",s)),s=null},j.isStandardBrowserEnv()){var c=X,h=(t.withCredentials||K(a))&&t.xsrfCookieName?c.read(t.xsrfCookieName):void 0;h&&(i[t.xsrfHeaderName]=h)}if("setRequestHeader"in s&&j.forEach(i,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete i[e]:s.setRequestHeader(e,t)})),j.isUndefined(t.withCredentials)||(s.withCredentials=!!t.withCredentials),t.responseType)try{s.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&s.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&s.upload&&s.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){s&&(s.abort(),n(t),s=null)})),void 0===r&&(r=null),s.send(r)}))},V={"Content-Type":"application/x-www-form-urlencoded"};function W(t,e){!j.isUndefined(t)&&j.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Q(){var t;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(t=G),t}var Y={adapter:Q(),transformRequest:[function(t,e){return F(e,"Accept"),F(e,"Content-Type"),j.isFormData(t)||j.isArrayBuffer(t)||j.isBuffer(t)||j.isStream(t)||j.isFile(t)||j.isBlob(t)?t:j.isArrayBufferView(t)?t.buffer:j.isURLSearchParams(t)?(W(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):j.isObject(t)?(W(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};j.forEach(["delete","get","head"],(function(t){Y.headers[t]={}})),j.forEach(["post","put","patch"],(function(t){Y.headers[t]=j.merge(V)}));var Z=Y;function tt(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var et=function(t){return tt(t),t.headers=t.headers||{},t.data=U(t.data,t.headers,t.transformRequest),t.headers=j.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),j.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Z.adapter)(t).then((function(e){return tt(t),e.data=U(e.data,e.headers,t.transformResponse),e}),(function(e){return q(e)||(tt(t),e&&e.response&&(e.response.data=U(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},nt=function(t,e){e=e||{};var n={},r=["url","method","params","data"],i=["headers","auth","proxy"],s=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];j.forEach(r,(function(t){void 0!==e[t]&&(n[t]=e[t])})),j.forEach(i,(function(r){j.isObject(e[r])?n[r]=j.deepMerge(t[r],e[r]):void 0!==e[r]?n[r]=e[r]:j.isObject(t[r])?n[r]=j.deepMerge(t[r]):void 0!==t[r]&&(n[r]=t[r])})),j.forEach(s,(function(r){void 0!==e[r]?n[r]=e[r]:void 0!==t[r]&&(n[r]=t[r])}));var o=r.concat(i).concat(s),u=Object.keys(e).filter((function(t){return-1===o.indexOf(t)}));return j.forEach(u,(function(r){void 0!==e[r]?n[r]=e[r]:void 0!==t[r]&&(n[r]=t[r])})),n};function rt(t){this.defaults=t,this.interceptors={request:new H,response:new H}}rt.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=nt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[et,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)n=n.then(e.shift(),e.shift());return n},rt.prototype.getUri=function(t){return t=nt(this.defaults,t),D(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},j.forEach(["delete","get","head","options"],(function(t){rt.prototype[t]=function(e,n){return this.request(j.merge(n||{},{method:t,url:e}))}})),j.forEach(["post","put","patch"],(function(t){rt.prototype[t]=function(e,n,r){return this.request(j.merge(r||{},{method:t,url:e,data:n}))}}));var it=rt;function st(t){this.message=t}st.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},st.prototype.__CANCEL__=!0;var ot=st;function ut(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;t((function(t){n.reason||(n.reason=new ot(t),e(n.reason))}))}ut.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},ut.source=function(){var t;return{token:new ut((function(e){t=e})),cancel:t}};var at=ut,ct=function(t){return function(e){return t.apply(null,e)}};function ht(t){var e=new it(t),n=u(it.prototype.request,e);return j.extend(n,it.prototype,e),j.extend(n,e),n}var ft=ht(Z);ft.Axios=it,ft.create=function(t){return ht(nt(ft.defaults,t))},ft.Cancel=ot,ft.CancelToken=at,ft.isCancel=q,ft.all=function(t){return Promise.all(t)},ft.spread=ct;var dt=ft,lt=ft;dt.default=lt;var pt=dt,vt=function(t){function n(e,n){var r,i=t.call(this,e.message)||this;return i.type="MeiliSearchApiError",i.name="MeiliSearchApiError",void 0!==e.response&&(i.response={status:e.response.status,statusText:e.response.statusText,path:e.response.config.url,method:e.response.config.method},void 0!==(null===(r=e.response.data)||void 0===r?void 0:r.message)&&(i.errorCode=e.response.data.errorCode,i.errorType=e.response.data.errorType,i.errorLink=e.response.data.errorLink,i.message=e.response.data.message)),void 0!==n&&void 0!==e.stack&&(i.stack=i.name+": "+i.message+"\n"+n.split("\n").slice(1).join("\n")),i}return e(n,t),n}(Error),gt=function(t){function n(e){var r=t.call(this,e)||this;return r.name="MeiliSearchCommunicationError",r.type="MeiliSearchCommunicationError",Error.captureStackTrace(r,n),r}return e(n,t),n}(Error);function yt(t,e){throw void 0!==t.response?new vt(t,e):!0===t.isAxiosError?new gt(t.message):t}var mt=function(){function t(t){var e=n(n({},t.headers||{}),{"Content-Type":"application/json"});void 0!==t.apiKey&&(e["X-Meili-API-Key"]=t.apiKey),this.instance=pt.create({baseURL:t.host,headers:e}),this.cancelTokenSource=pt.CancelToken.source(),this.instance.interceptors.response.use((function(t){return t.data})),this.instance.interceptors.request.use((function(t){return void 0!==t.data?n(n({},t),{data:JSON.stringify(t.data)}):t}))}return t.prototype.get=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:n=(new Error).stack,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.instance.get(t,e)];case 2:return[2,r.sent()];case 3:throw yt(r.sent(),n);case 4:return[2]}}))}))},t.prototype.post=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:r=(new Error).stack,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.instance.post(t,e,n)];case 2:return[2,i.sent()];case 3:throw yt(i.sent(),r);case 4:return[2]}}))}))},t.prototype.put=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:r=(new Error).stack,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.instance.put(t,e,n)];case 2:return[2,i.sent()];case 3:throw yt(i.sent(),r);case 4:return[2]}}))}))},t.prototype.patch=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:r=(new Error).stack,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.instance.patch(t,e,n)];case 2:return[2,i.sent()];case 3:throw yt(i.sent(),r);case 4:return[2]}}))}))},t.prototype.delete=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:n=(new Error).stack,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.instance.delete(t,e)];case 2:return[2,r.sent()];case 3:throw yt(r.sent(),n);case 4:return[2]}}))}))},t}();function bt(t){var e=Object.entries(t).filter((function(t){return void 0!==t[1]}));return Object.fromEntries(e)}function wt(t){return r(this,void 0,void 0,(function(){return i(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 xt=function(t){function u(e,n){var r=t.call(this,e)||this;return r.uid=n,r}return e(u,t),u.prototype.getUpdateStatus=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/updates/"+t,[4,this.get(e)];case 1:return[2,n.sent()]}}))}))},u.prototype.waitForPendingUpdate=function(t,e){var n=void 0===e?{}:e,s=n.timeOutMs,u=void 0===s?5e3:s,a=n.intervalMs,c=void 0===a?50:a;return r(this,void 0,void 0,(function(){var e,n;return i(this,(function(r){switch(r.label){case 0:e=Date.now(),r.label=1;case 1:return Date.now()-e<u?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(n=r.sent()).status?[2,n]:[4,wt(c)];case 3:return r.sent(),[3,1];case 4:throw new o("timeout of "+u+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},u.prototype.getAllUpdateStatus=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/updates",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.search=function(t,e,o){return void 0===o&&(o="POST"),r(this,void 0,void 0,(function(){var r,u,a;return i(this,(function(i){switch(i.label){case 0:return r="/indexes/"+this.uid+"/search",u={q:t,offset:null==e?void 0:e.offset,limit:null==e?void 0:e.limit,cropLength:null==e?void 0:e.cropLength,filters:null==e?void 0:e.filters,matches:null==e?void 0:e.matches,facetFilters:null==e?void 0:e.facetFilters,facetsDistribution:null==e?void 0:e.facetsDistribution,attributesToRetrieve:null==e?void 0:e.attributesToRetrieve,attributesToCrop:null==e?void 0:e.attributesToCrop,attributesToHighlight:null==e?void 0:e.attributesToHighlight},"POST"!==o.toUpperCase()?[3,2]:[4,this.post(r,bt(u),{cancelToken:this.cancelTokenSource.token})];case 1:return[2,i.sent()];case 2:return"GET"!==o.toUpperCase()?[3,4]:(a=n(n({},u),{facetFilters:Array.isArray(null==e?void 0:e.facetFilters)&&(null==e?void 0:e.facetFilters)?JSON.stringify(e.facetFilters):void 0,facetsDistribution:(null==e?void 0:e.facetsDistribution)?JSON.stringify(e.facetsDistribution):void 0,attributesToRetrieve:(null==e?void 0:e.attributesToRetrieve)?e.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==e?void 0:e.attributesToCrop)?e.attributesToCrop.join(","):void 0,attributesToHighlight:(null==e?void 0:e.attributesToHighlight)?e.attributesToHighlight.join(","):void 0}),[4,this.get(r,{params:bt(a),cancelToken:this.cancelTokenSource.token})]);case 3:return[2,i.sent()];case 4:throw new s("method parameter should be either POST or GET")}}))}))},u.prototype.show=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid,[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateIndex=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid,[4,this.put(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.deleteIndex=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid,[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getStats=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getDocuments=function(t){return r(this,void 0,void 0,(function(){var e,r;return i(this,(function(i){switch(i.label){case 0:return e="/indexes/"+this.uid+"/documents",void 0!==t&&Array.isArray(t.attributesToRetrieve)&&(r=t.attributesToRetrieve.join(",")),[4,this.get(e,{params:n(n({},t),void 0!==r?{attributesToRetrieve:r}:{})})];case 1:return[2,i.sent()]}}))}))},u.prototype.getDocument=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/documents/"+t,[4,this.get(e)];case 1:return[2,n.sent()]}}))}))},u.prototype.addDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return n="/indexes/"+this.uid+"/documents",[4,this.post(n,t,{params:e})];case 1:return[2,r.sent()]}}))}))},u.prototype.updateDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return n="/indexes/"+this.uid+"/documents",[4,this.put(n,t,{params:e})];case 1:return[2,r.sent()]}}))}))},u.prototype.deleteDocument=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/documents/"+t,[4,this.delete(e)];case 1:return[2,n.sent()]}}))}))},u.prototype.deleteDocuments=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/documents/delete-batch",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.deleteAllDocuments=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/documents",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getSettings=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateSettings=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetSettings=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getSynonyms=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/synonyms",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateSynonyms=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/synonyms",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetSynonyms=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/synonyms",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getStopWords=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/stop-words",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateStopWords=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/stop-words",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetStopWords=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/stop-words",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getRankingRules=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/ranking-rules",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateRankingRules=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/ranking-rules",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetRankingRules=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/ranking-rules",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/distinct-attribute",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateDistinctAttribute=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/distinct-attribute",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/distinct-attribute",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getAttributesForFaceting=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/attributes-for-faceting",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateAttributesForFaceting=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/attributes-for-faceting",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetAttributesForFaceting=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/attributes-for-faceting",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/searchable-attributes",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateSearchableAttributes=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/searchable-attributes",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/searchable-attributes",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/displayed-attributes",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateDisplayedAttributes=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/displayed-attributes",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/displayed-attributes",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u}(mt);return function(t){function s(e){var n=t.call(this,e)||this;return n.config=e,n}return e(s,t),s.prototype.getIndex=function(t){return new xt(this.config,t)},s.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.createIndex(t,e)];case 1:return[2,r.sent()];case 2:if("index_already_exists"===(n=r.sent()).errorCode)return[2,this.getIndex(t)];throw n;case 3:return[2]}}))}))},s.prototype.listIndexes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s.prototype.createIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var r,s;return i(this,(function(i){switch(i.label){case 0:return r="/indexes",[4,this.post(r,n(n({},e),{uid:t}))];case 1:return s=i.sent(),[2,new xt(this.config,s.uid)]}}))}))},s.prototype.getKeys=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/keys",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s.prototype.isHealthy=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/health",[4,this.get(t).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},s.prototype.setHealthy=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/health",[4,this.put(t,{health:!0})];case 1:return[2,e.sent()]}}))}))},s.prototype.setUnhealthy=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/health",[4,this.put(t,{health:!1})];case 1:return[2,e.sent()]}}))}))},s.prototype.changeHealthTo=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/health",[4,this.put(e,{health:t})];case 1:return[2,n.sent()]}}))}))},s.prototype.stats=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/stats",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s.prototype.version=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/version",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s}(mt)}()}));function e(t){return Object.keys(t).reduce((e,n)=>(void 0!==t[n]&&(e[n]=t[n]),e),{})}function n(t){return"string"==typeof t||t instanceof String}function r(t,e,r){let i=t||"";return n(t)&&(i=t.replace(/<em>/g,e).replace(/<\/em>/g,r)),i.toString()}function i({formattedHit:t,highlightPreTag:e,highlightPostTag:n}){return Object.keys(t).reduce((i,s)=>(i[s]={value:r(t[s],e,n)},i),{})}function s(t,e,i,s){let 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}`)),r(o,i,s)}function o({formattedHit:t,attributesToSnippet:e,snippetEllipsisText:n,highlightPreTag:r,highlightPostTag:i}){return void 0===e?null:(e=e.map(t=>t.split(":")[0]),Object.keys(t).reduce((o,u)=>(e.includes(u)&&(o[u]={value:s(t[u],n,r,i)}),o),{}))}return function(n,r,s={}){return{client:new t({host:n,apiKey:r}),attributesToHighlight:["*"],paginationTotalHits:s.paginationTotalHits||200,placeholderSearch:!1!==s.placeholderSearch,transformToMeiliSearchParams:function(t){const n=this.pagination?this.paginationTotalHits:this.hitsPerPage,{query:r,facets:i,facetFilters:s,attributesToSnippet:o}=t;return e({q:this.placeholderSearch&&""===r?null:r,facetsDistribution:i.length?i:void 0,facetFilters:s,attributesToHighlight:this.attributesToHighlight,attributesToCrop:o,limit:n})},parseHits:function(t,e){if(this.pagination){const n=e.page*this.hitsPerPage;t=t.splice(n,this.hitsPerPage)}return t.map(t=>{const n=t._formatted;return delete t._formatted,{...t,_highlightResult:i({formattedHit:n,...e}),_snippetResult:o({formattedHit:n,...e})}})},paginationParams:function(t,e){if(this.pagination){const n=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+n,page:e.page}}},parseMeiliSearchResponse:function(t,n,r){const{exhaustiveFacetsCount:i,exhaustiveNbHits:s,facetsDistribution:o,nbHits:u,processingTimeMs:a,query:c,hits:h}=n;return{results:[e({index:t,hitsPerPage:this.hitsPerPage,facets:o,exhaustiveFacetsCount:i,exhaustiveNbHits:s,nbHits:u,processingTimeMs:a,query:c,...this.paginationParams(h.length,r),hits:this.parseHits(h,r)})]}},search:async function(t){const e=t[0].params;this.pagination=void 0!==e.page,this.hitsPerPage=e.hitsPerPage||20;const n=this.transformToMeiliSearchParams(e),r=t[0].indexName,i=await this.client.getIndex(r).search(n.q,n);return this.parseMeiliSearchResponse(r,i,t[0].params)}}}}));
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{a(r.next(t))}catch(t){s(t)}}function u(t){try{a(r.throw(t))}catch(t){s(t)}}function a(t){t.done?n(t.value):i(t.value).then(o,u)}a((r=r.apply(t,e||[])).next())}))}function i(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(e){return a([t,e])}}function a(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var s=function(t){function n(e){var r=t.call(this,e)||this;return r.name="MeiliSearchError",r.type="MeiliSearchError",Error.captureStackTrace(r,n),r}return e(n,t),n}(Error),o=function(t){function n(e){var r=t.call(this,e)||this;return r.name="MeiliSearchTimeOutError",r.type=r.constructor.name,Error.captureStackTrace(r,n),r}return e(n,t),n}(Error),u=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}},a=Object.prototype.toString;function c(t){return"[object Array]"===a.call(t)}function h(t){return void 0===t}function f(t){return null!==t&&!h(t)&&null!==t.constructor&&!h(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function d(t){return"[object ArrayBuffer]"===a.call(t)}function l(t){return"undefined"!=typeof FormData&&t instanceof FormData}function p(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer}function v(t){return"string"==typeof t}function g(t){return"number"==typeof t}function y(t){return null!==t&&"object"==typeof t}function m(t){if("[object Object]"!==a.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function b(t){return"[object Date]"===a.call(t)}function w(t){return"[object File]"===a.call(t)}function x(t){return"[object Blob]"===a.call(t)}function T(t){return"[object Function]"===a.call(t)}function S(t){return y(t)&&T(t.pipe)}function E(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function P(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}function C(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document}function O(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),c(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}function A(){var t={};function e(e,n){m(t[n])&&m(e)?t[n]=A(t[n],e):m(e)?t[n]=A({},e):c(e)?t[n]=e.slice():t[n]=e}for(var n=0,r=arguments.length;n<r;n++)O(arguments[n],e);return t}function R(t,e,n){return O(e,(function(e,r){t[r]=n&&"function"==typeof e?u(e,n):e})),t}function k(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}var j={isArray:c,isArrayBuffer:d,isBuffer:f,isFormData:l,isArrayBufferView:p,isString:v,isNumber:g,isObject:y,isPlainObject:m,isUndefined:h,isDate:b,isFile:w,isBlob:x,isFunction:T,isStream:S,isURLSearchParams:E,isStandardBrowserEnv:C,forEach:O,merge:A,extend:R,trim:P,stripBOM:k};function D(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var N=function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(j.isURLSearchParams(e))r=e.toString();else{var i=[];j.forEach(e,(function(t,e){null!=t&&(j.isArray(t)?e+="[]":t=[t],j.forEach(t,(function(t){j.isDate(t)?t=t.toISOString():j.isObject(t)&&(t=JSON.stringify(t)),i.push(D(e)+"="+D(t))})))})),r=i.join("&")}if(r){var s=t.indexOf("#");-1!==s&&(t=t.slice(0,s)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t};function U(){this.handlers=[]}U.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},U.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},U.prototype.forEach=function(t){j.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var H=U,q=function(t,e,n){return j.forEach(n,(function(n){t=n(t,e)})),t},F=function(t){return!(!t||!t.__CANCEL__)},L=function(t,e){j.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))},B=function(t,e,n,r,i){return t.config=e,n&&(t.code=n),t.request=r,t.response=i,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t},M=function(t,e,n,r,i){var s=new Error(t);return B(s,e,n,r,i)},_=function(t,e,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(M("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)},I=j.isStandardBrowserEnv()?{write:function(t,e,n,r,i,s){var o=[];o.push(t+"="+encodeURIComponent(e)),j.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),j.isString(r)&&o.push("path="+r),j.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},$=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)},z=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t},J=function(t,e){return t&&!$(e)?z(t,e):e},K=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],X=function(t){var e,n,r,i={};return t?(j.forEach(t.split("\n"),(function(t){if(r=t.indexOf(":"),e=j.trim(t.substr(0,r)).toLowerCase(),n=j.trim(t.substr(r+1)),e){if(i[e]&&K.indexOf(e)>=0)return;i[e]="set-cookie"===e?(i[e]?i[e]:[]).concat([n]):i[e]?i[e]+", "+n:n}})),i):i},G=j.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=r(window.location.href),function(e){var n=j.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},V=function(t){return new Promise((function(e,n){var r=t.data,i=t.headers;j.isFormData(r)&&delete i["Content-Type"],(j.isBlob(r)||j.isFile(r))&&r.type&&delete i["Content-Type"];var s=new XMLHttpRequest;if(t.auth){var o=t.auth.username||"",u=unescape(encodeURIComponent(t.auth.password))||"";i.Authorization="Basic "+btoa(o+":"+u)}var a=J(t.baseURL,t.url);if(s.open(t.method.toUpperCase(),N(a,t.params,t.paramsSerializer),!0),s.timeout=t.timeout,s.onreadystatechange=function(){if(s&&4===s.readyState&&(0!==s.status||s.responseURL&&0===s.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in s?X(s.getAllResponseHeaders()):null,i={data:t.responseType&&"text"!==t.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:r,config:t,request:s};_(e,n,i),s=null}},s.onabort=function(){s&&(n(M("Request aborted",t,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(M("Network Error",t,null,s)),s=null},s.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(M(e,t,"ECONNABORTED",s)),s=null},j.isStandardBrowserEnv()){var c=(t.withCredentials||G(a))&&t.xsrfCookieName?I.read(t.xsrfCookieName):void 0;c&&(i[t.xsrfHeaderName]=c)}if("setRequestHeader"in s&&j.forEach(i,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete i[e]:s.setRequestHeader(e,t)})),j.isUndefined(t.withCredentials)||(s.withCredentials=!!t.withCredentials),t.responseType)try{s.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&s.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&s.upload&&s.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){s&&(s.abort(),n(t),s=null)})),r||(r=null),s.send(r)}))},W={"Content-Type":"application/x-www-form-urlencoded"};function Q(t,e){!j.isUndefined(t)&&j.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Y(){var t;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(t=V),t}var Z={adapter:Y(),transformRequest:[function(t,e){return L(e,"Accept"),L(e,"Content-Type"),j.isFormData(t)||j.isArrayBuffer(t)||j.isBuffer(t)||j.isStream(t)||j.isFile(t)||j.isBlob(t)?t:j.isArrayBufferView(t)?t.buffer:j.isURLSearchParams(t)?(Q(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):j.isObject(t)?(Q(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};j.forEach(["delete","get","head"],(function(t){Z.headers[t]={}})),j.forEach(["post","put","patch"],(function(t){Z.headers[t]=j.merge(W)}));var tt=Z;function et(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var nt=function(t){return et(t),t.headers=t.headers||{},t.data=q(t.data,t.headers,t.transformRequest),t.headers=j.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),j.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||tt.adapter)(t).then((function(e){return et(t),e.data=q(e.data,e.headers,t.transformResponse),e}),(function(e){return F(e)||(et(t),e&&e.response&&(e.response.data=q(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},rt=function(t,e){e=e||{};var n={},r=["url","method","data"],i=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function u(t,e){return j.isPlainObject(t)&&j.isPlainObject(e)?j.merge(t,e):j.isPlainObject(e)?j.merge({},e):j.isArray(e)?e.slice():e}function a(r){j.isUndefined(e[r])?j.isUndefined(t[r])||(n[r]=u(void 0,t[r])):n[r]=u(t[r],e[r])}j.forEach(r,(function(t){j.isUndefined(e[t])||(n[t]=u(void 0,e[t]))})),j.forEach(i,a),j.forEach(s,(function(r){j.isUndefined(e[r])?j.isUndefined(t[r])||(n[r]=u(void 0,t[r])):n[r]=u(void 0,e[r])})),j.forEach(o,(function(r){r in e?n[r]=u(t[r],e[r]):r in t&&(n[r]=u(void 0,t[r]))}));var c=r.concat(i).concat(s).concat(o),h=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===c.indexOf(t)}));return j.forEach(h,a),n};function it(t){this.defaults=t,this.interceptors={request:new H,response:new H}}it.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=rt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[nt,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)n=n.then(e.shift(),e.shift());return n},it.prototype.getUri=function(t){return t=rt(this.defaults,t),N(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},j.forEach(["delete","get","head","options"],(function(t){it.prototype[t]=function(e,n){return this.request(rt(n||{},{method:t,url:e}))}})),j.forEach(["post","put","patch"],(function(t){it.prototype[t]=function(e,n,r){return this.request(rt(r||{},{method:t,url:e,data:n}))}}));var st=it;function ot(t){this.message=t}ot.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ot.prototype.__CANCEL__=!0;var ut=ot;function at(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;t((function(t){n.reason||(n.reason=new ut(t),e(n.reason))}))}at.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},at.source=function(){var t;return{token:new at((function(e){t=e})),cancel:t}};var ct=at,ht=function(t){return function(e){return t.apply(null,e)}};function ft(t){var e=new st(t),n=u(st.prototype.request,e);return j.extend(n,st.prototype,e),j.extend(n,e),n}var dt=ft(tt);dt.Axios=st,dt.create=function(t){return ft(rt(dt.defaults,t))},dt.Cancel=ut,dt.CancelToken=ct,dt.isCancel=F,dt.all=function(t){return Promise.all(t)},dt.spread=ht;var lt=dt,pt=dt;lt.default=pt;var vt=lt,gt=function(t){function n(e,n){var r,i=t.call(this,e.message)||this;return i.type="MeiliSearchApiError",i.name="MeiliSearchApiError",void 0!==e.response&&(i.response={status:e.response.status,statusText:e.response.statusText,path:e.response.config.url,method:e.response.config.method},void 0!==(null===(r=e.response.data)||void 0===r?void 0:r.message)&&(i.errorCode=e.response.data.errorCode,i.errorType=e.response.data.errorType,i.errorLink=e.response.data.errorLink,i.message=e.response.data.message)),void 0!==n&&void 0!==e.stack&&(i.stack=i.name+": "+i.message+"\n"+n.split("\n").slice(1).join("\n")),i}return e(n,t),n}(Error),yt=function(t){function n(e){var r=t.call(this,e)||this;return r.name="MeiliSearchCommunicationError",r.type="MeiliSearchCommunicationError",Error.captureStackTrace(r,n),r}return e(n,t),n}(Error);function mt(t,e){throw void 0!==t.response?new gt(t,e):!0===t.isAxiosError?new yt(t.message):t}var bt=function(){function t(t){var e=n(n({},t.headers||{}),{"Content-Type":"application/json"});void 0!==t.apiKey&&(e["X-Meili-API-Key"]=t.apiKey),this.instance=vt.create({baseURL:t.host,headers:e}),this.cancelTokenSource=vt.CancelToken.source(),this.instance.interceptors.response.use((function(t){return t.data})),this.instance.interceptors.request.use((function(t){return void 0!==t.data?n(n({},t),{data:JSON.stringify(t.data)}):t}))}return t.prototype.get=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:n=(new Error).stack,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.instance.get(t,e)];case 2:return[2,r.sent()];case 3:throw mt(r.sent(),n);case 4:return[2]}}))}))},t.prototype.post=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:r=(new Error).stack,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.instance.post(t,e,n)];case 2:return[2,i.sent()];case 3:throw mt(i.sent(),r);case 4:return[2]}}))}))},t.prototype.put=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:r=(new Error).stack,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.instance.put(t,e,n)];case 2:return[2,i.sent()];case 3:throw mt(i.sent(),r);case 4:return[2]}}))}))},t.prototype.patch=function(t,e,n){return r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:r=(new Error).stack,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.instance.patch(t,e,n)];case 2:return[2,i.sent()];case 3:throw mt(i.sent(),r);case 4:return[2]}}))}))},t.prototype.delete=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:n=(new Error).stack,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.instance.delete(t,e)];case 2:return[2,r.sent()];case 3:throw mt(r.sent(),n);case 4:return[2]}}))}))},t}();function wt(t){var e=Object.entries(t).filter((function(t){return void 0!==t[1]}));return Object.fromEntries(e)}function xt(t){return r(this,void 0,void 0,(function(){return i(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 Tt=function(t){function u(e,n){var r=t.call(this,e)||this;return r.uid=n,r}return e(u,t),u.prototype.getUpdateStatus=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/updates/"+t,[4,this.get(e)];case 1:return[2,n.sent()]}}))}))},u.prototype.waitForPendingUpdate=function(t,e){var n=void 0===e?{}:e,s=n.timeOutMs,u=void 0===s?5e3:s,a=n.intervalMs,c=void 0===a?50:a;return r(this,void 0,void 0,(function(){var e,n;return i(this,(function(r){switch(r.label){case 0:e=Date.now(),r.label=1;case 1:return Date.now()-e<u?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(n=r.sent()).status?[2,n]:[4,xt(c)];case 3:return r.sent(),[3,1];case 4:throw new o("timeout of "+u+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},u.prototype.getAllUpdateStatus=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/updates",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.search=function(t,e,o){return void 0===o&&(o="POST"),r(this,void 0,void 0,(function(){var r,u,a;return i(this,(function(i){switch(i.label){case 0:return r="/indexes/"+this.uid+"/search",u={q:t,offset:null==e?void 0:e.offset,limit:null==e?void 0:e.limit,cropLength:null==e?void 0:e.cropLength,filters:null==e?void 0:e.filters,matches:null==e?void 0:e.matches,facetFilters:null==e?void 0:e.facetFilters,facetsDistribution:null==e?void 0:e.facetsDistribution,attributesToRetrieve:null==e?void 0:e.attributesToRetrieve,attributesToCrop:null==e?void 0:e.attributesToCrop,attributesToHighlight:null==e?void 0:e.attributesToHighlight},"POST"!==o.toUpperCase()?[3,2]:[4,this.post(r,wt(u),{cancelToken:this.cancelTokenSource.token})];case 1:return[2,i.sent()];case 2:return"GET"!==o.toUpperCase()?[3,4]:(a=n(n({},u),{facetFilters:Array.isArray(null==e?void 0:e.facetFilters)&&(null==e?void 0:e.facetFilters)?JSON.stringify(e.facetFilters):void 0,facetsDistribution:(null==e?void 0:e.facetsDistribution)?JSON.stringify(e.facetsDistribution):void 0,attributesToRetrieve:(null==e?void 0:e.attributesToRetrieve)?e.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==e?void 0:e.attributesToCrop)?e.attributesToCrop.join(","):void 0,attributesToHighlight:(null==e?void 0:e.attributesToHighlight)?e.attributesToHighlight.join(","):void 0}),[4,this.get(r,{params:wt(a),cancelToken:this.cancelTokenSource.token})]);case 3:return[2,i.sent()];case 4:throw new s("method parameter should be either POST or GET")}}))}))},u.prototype.show=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid,[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateIndex=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid,[4,this.put(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.deleteIndex=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid,[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getStats=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getDocuments=function(t){return r(this,void 0,void 0,(function(){var e,r;return i(this,(function(i){switch(i.label){case 0:return e="/indexes/"+this.uid+"/documents",void 0!==t&&Array.isArray(t.attributesToRetrieve)&&(r=t.attributesToRetrieve.join(",")),[4,this.get(e,{params:n(n({},t),void 0!==r?{attributesToRetrieve:r}:{})})];case 1:return[2,i.sent()]}}))}))},u.prototype.getDocument=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/documents/"+t,[4,this.get(e)];case 1:return[2,n.sent()]}}))}))},u.prototype.addDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return n="/indexes/"+this.uid+"/documents",[4,this.post(n,t,{params:e})];case 1:return[2,r.sent()]}}))}))},u.prototype.updateDocuments=function(t,e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return n="/indexes/"+this.uid+"/documents",[4,this.put(n,t,{params:e})];case 1:return[2,r.sent()]}}))}))},u.prototype.deleteDocument=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/documents/"+t,[4,this.delete(e)];case 1:return[2,n.sent()]}}))}))},u.prototype.deleteDocuments=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/documents/delete-batch",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.deleteAllDocuments=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/documents",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getSettings=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateSettings=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetSettings=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getSynonyms=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/synonyms",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateSynonyms=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/synonyms",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetSynonyms=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/synonyms",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getStopWords=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/stop-words",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateStopWords=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/stop-words",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetStopWords=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/stop-words",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getRankingRules=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/ranking-rules",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateRankingRules=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/ranking-rules",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetRankingRules=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/ranking-rules",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/distinct-attribute",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateDistinctAttribute=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/distinct-attribute",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetDistinctAttribute=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/distinct-attribute",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getAttributesForFaceting=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/attributes-for-faceting",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateAttributesForFaceting=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/attributes-for-faceting",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetAttributesForFaceting=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/attributes-for-faceting",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/searchable-attributes",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateSearchableAttributes=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/searchable-attributes",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetSearchableAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/searchable-attributes",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.getDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/displayed-attributes",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},u.prototype.updateDisplayedAttributes=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/indexes/"+this.uid+"/settings/displayed-attributes",[4,this.post(e,t)];case 1:return[2,n.sent()]}}))}))},u.prototype.resetDisplayedAttributes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/settings/displayed-attributes",[4,this.delete(t)];case 1:return[2,e.sent()]}}))}))},u}(bt);return function(t){function s(e){var n=t.call(this,e)||this;return n.config=e,n}return e(s,t),s.prototype.getIndex=function(t){return new Tt(this.config,t)},s.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.createIndex(t,e)];case 1:return[2,r.sent()];case 2:if("index_already_exists"===(n=r.sent()).errorCode)return[2,this.getIndex(t)];throw n;case 3:return[2]}}))}))},s.prototype.listIndexes=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/indexes",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s.prototype.createIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var r,s;return i(this,(function(i){switch(i.label){case 0:return r="/indexes",[4,this.post(r,n(n({},e),{uid:t}))];case 1:return s=i.sent(),[2,new Tt(this.config,s.uid)]}}))}))},s.prototype.getKeys=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/keys",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s.prototype.isHealthy=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/health",[4,this.get(t).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},s.prototype.setHealthy=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/health",[4,this.put(t,{health:!0})];case 1:return[2,e.sent()]}}))}))},s.prototype.setUnhealthy=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/health",[4,this.put(t,{health:!1})];case 1:return[2,e.sent()]}}))}))},s.prototype.changeHealthTo=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return e="/health",[4,this.put(e,{health:t})];case 1:return[2,n.sent()]}}))}))},s.prototype.stats=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/stats",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s.prototype.version=function(){return r(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return t="/version",[4,this.get(t)];case 1:return[2,e.sent()]}}))}))},s}(bt)}()}));function e(t){return Object.keys(t).reduce((e,n)=>(void 0!==t[n]&&(e[n]=t[n]),e),{})}function n(t){return"string"==typeof t||t instanceof String}function r(t,e,r){let i=t||"";return n(t)&&(i=t.replace(/<em>/g,e).replace(/<\/em>/g,r)),i.toString()}function i({formattedHit:t,highlightPreTag:e,highlightPostTag:n}){return Object.keys(t).reduce((i,s)=>(i[s]={value:r(t[s],e,n)},i),{})}function s(t,e,i,s){let 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}`)),r(o,i,s)}function o({formattedHit:t,attributesToSnippet:e,snippetEllipsisText:n,highlightPreTag:r,highlightPostTag:i}){return void 0===e?null:(e=e.map(t=>t.split(":")[0]),Object.keys(t).reduce((o,u)=>(e.includes(u)&&(o[u]={value:s(t[u],n,r,i)}),o),{}))}return function(n,r,s={}){return{client:new t({host:n,apiKey:r}),attributesToHighlight:["*"],paginationTotalHits:s.paginationTotalHits||200,placeholderSearch:!1!==s.placeholderSearch,transformToMeiliSearchParams:function(t){const n=this.pagination?this.paginationTotalHits:this.hitsPerPage,{query:r,facets:i,facetFilters:s,attributesToSnippet:o,filters:u}=t;return e({q:this.placeholderSearch&&""===r?null:r,facetsDistribution:i.length?i:void 0,facetFilters:s,attributesToHighlight:this.attributesToHighlight,attributesToCrop:o,filters:u,limit:n})},parseHits:function(t,e){if(this.pagination){const n=e.page*this.hitsPerPage;t=t.splice(n,this.hitsPerPage)}return t.map(t=>{const n=t._formatted;return delete t._formatted,{...t,_highlightResult:i({formattedHit:n,...e}),_snippetResult:o({formattedHit:n,...e})}})},paginationParams:function(t,e){if(this.pagination){const n=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+n,page:e.page}}},parseMeiliSearchResponse:function(t,n,r){const{exhaustiveFacetsCount:i,exhaustiveNbHits:s,facetsDistribution:o,nbHits:u,processingTimeMs:a,query:c,hits:h}=n;return{results:[e({index:t,hitsPerPage:this.hitsPerPage,facets:o,exhaustiveFacetsCount:i,exhaustiveNbHits:s,nbHits:u,processingTimeMs:a,query:c,...this.paginationParams(h.length,r),hits:this.parseHits(h,r)})]}},search:async function(t){const e=t[0].params;this.pagination=void 0!==e.page,this.hitsPerPage=e.hitsPerPage||20;const n=this.transformToMeiliSearchParams(e),r=t[0].indexName,i=await this.client.getIndex(r).search(n.q,n);return this.parseMeiliSearchResponse(r,i,t[0].params)}}}}));
//# sourceMappingURL=instant-meilisearch.umd.min.js.map
{
"name": "@meilisearch/instant-meilisearch",
"version": "0.2.0",
"version": "0.2.1",
"private": false,

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

"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.19.0",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-node": "^11.1.0",

@@ -55,3 +55,3 @@ "eslint-plugin-prettier": "^3.1.4",

"jest-watch-typeahead": "^0.6.0",
"prettier": "2.0.5",
"prettier": "2.1.1",
"regenerator-runtime": "^0.13.7",

@@ -58,0 +58,0 @@ "rollup": "^2.23.0",

@@ -16,3 +16,9 @@ import MeiliSearch from 'meilisearch'

: this.hitsPerPage
const { query, facets, facetFilters, attributesToSnippet } = params
const {
query,
facets,
facetFilters,
attributesToSnippet,
filters,
} = params
const searchInput = {

@@ -24,2 +30,3 @@ q: this.placeholderSearch && query === '' ? null : query,

attributesToCrop: attributesToSnippet,
filters,
limit,

@@ -26,0 +33,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is 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