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.1.2 to 0.1.3

2

dist/instant-meilisearch.cjs.js

@@ -46,3 +46,3 @@ 'use strict';

return Object.keys(formattedHit).reduce((result, key) => {
let newHighlightString = formattedHit[key];
let newHighlightString = formattedHit[key] || '';
// If the value of the attribute is a string,

@@ -49,0 +49,0 @@ // the highlight is applied by MeiliSearch (<em> tags)

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

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

@@ -42,3 +42,3 @@ import MeiliSearch from 'meilisearch';

return Object.keys(formattedHit).reduce((result, key) => {
let newHighlightString = formattedHit[key];
let newHighlightString = formattedHit[key] || '';
// If the value of the attribute is a string,

@@ -45,0 +45,0 @@ // the highlight is applied by MeiliSearch (<em> tags)

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

import e from"meilisearch";function t(e){return Object.keys(e).reduce((t,i)=>(void 0!==e[i]&&(t[i]=e[i]),t),{})}export default function(i,s,r={}){return{client:new e({host:i,apiKey:s}),hitsPerPage:r.hitsPerPage||10,limitPerRequest:r.limitPerRequest||50,attributesToHighlight:["*"],transformToMeiliSearchParams:function(e){return t({q:e.query,facetsDistribution:e.facets.length?e.facets:void 0,facetFilters:e.facetFilters,attributesToHighlight:this.attributesToHighlight,limit:this.limitPerRequest})},replaceHighlightTags:function(e,t,i){return Object.keys(e).reduce((s,r)=>{let a=e[r];var h;return("string"==typeof(h=e[r])||h instanceof String)&&(a=e[r].replace(/<em>/g,t).replace(/<\/em>/g,i)),s[r]={value:a.toString()},s},{})},parseHits:function(e,t){if(void 0!==t.page){const i=this.hitsPerPage,s=t.page*i;e=e.splice(s,this.hitsPerPage)}return e.map(e=>{const i=e._formatted;return delete e._formatted,{...e,_highlightResult:this.replaceHighlightTags(i,t.highlightPreTag,t.highlightPostTag)}})},paginationParams:function(e,t){if(void 0!==t.page){const i=e%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(e/this.hitsPerPage)+i,page:t.page}}},parseMeiliSearchResponse:function(e,i,s){this.hitsPerPage=s.hitsPerPage||this.hitsPerPage;const{exhaustiveFacetsCount:r,exhaustiveNbHits:a,facetsDistribution:h,nbHits:n,processingTimeMs:g,query:o,hits:c}=i;return{results:[t({index:e,hitsPerPage:this.hitsPerPage,facets:h,exhaustiveFacetsCount:r,exhaustiveNbHits:a,nbHits:n,processingTimeMs:g,query:o,...this.paginationParams(c.length,s),hits:this.parseHits(c,s)})]}},search:async function(e){const t=this.transformToMeiliSearchParams(e[0].params),i=e[0].indexName,s=await this.client.getIndex(i).search(t.q,t);return this.parseMeiliSearchResponse(i,s,e[0].params)}}}
import e from"meilisearch";function t(e){return Object.keys(e).reduce((t,i)=>(void 0!==e[i]&&(t[i]=e[i]),t),{})}export default function(i,s,r={}){return{client:new e({host:i,apiKey:s}),hitsPerPage:r.hitsPerPage||10,limitPerRequest:r.limitPerRequest||50,attributesToHighlight:["*"],transformToMeiliSearchParams:function(e){return t({q:e.query,facetsDistribution:e.facets.length?e.facets:void 0,facetFilters:e.facetFilters,attributesToHighlight:this.attributesToHighlight,limit:this.limitPerRequest})},replaceHighlightTags:function(e,t,i){return Object.keys(e).reduce((s,r)=>{let a=e[r]||"";var h;return("string"==typeof(h=e[r])||h instanceof String)&&(a=e[r].replace(/<em>/g,t).replace(/<\/em>/g,i)),s[r]={value:a.toString()},s},{})},parseHits:function(e,t){if(void 0!==t.page){const i=this.hitsPerPage,s=t.page*i;e=e.splice(s,this.hitsPerPage)}return e.map(e=>{const i=e._formatted;return delete e._formatted,{...e,_highlightResult:this.replaceHighlightTags(i,t.highlightPreTag,t.highlightPostTag)}})},paginationParams:function(e,t){if(void 0!==t.page){const i=e%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(e/this.hitsPerPage)+i,page:t.page}}},parseMeiliSearchResponse:function(e,i,s){this.hitsPerPage=s.hitsPerPage||this.hitsPerPage;const{exhaustiveFacetsCount:r,exhaustiveNbHits:a,facetsDistribution:h,nbHits:n,processingTimeMs:g,query:o,hits:c}=i;return{results:[t({index:e,hitsPerPage:this.hitsPerPage,facets:h,exhaustiveFacetsCount:r,exhaustiveNbHits:a,nbHits:n,processingTimeMs:g,query:o,...this.paginationParams(c.length,s),hits:this.parseHits(c,s)})]}},search:async function(e){const t=this.transformToMeiliSearchParams(e[0].params),i=e[0].indexName,s=await this.client.getIndex(i).search(t.q,t);return this.parseMeiliSearchResponse(i,s,e[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)e.hasOwnProperty(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){return new(n||(n=Promise))((function(i,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){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).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(s){return function(u){return function(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}}([s,u])}}}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&&"object"==typeof t}function d(t){return"[object Function]"===a.call(t)}function l(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)}var p={isArray:c,isArrayBuffer:function(t){return"[object ArrayBuffer]"===a.call(t)},isBuffer:function(t){return null!==t&&!h(t)&&null!==t.constructor&&!h(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:f,isUndefined:h,isDate:function(t){return"[object Date]"===a.call(t)},isFile:function(t){return"[object File]"===a.call(t)},isBlob:function(t){return"[object Blob]"===a.call(t)},isFunction:d,isStream:function(t){return f(t)&&d(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,i=arguments.length;r<i;r++)l(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,i=arguments.length;r<i;r++)l(arguments[r],n);return e},extend:function(t,e,n){return l(e,(function(e,r){t[r]=n&&"function"==typeof e?u(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}};function v(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 g=function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(p.isURLSearchParams(e))r=e.toString();else{var i=[];p.forEach(e,(function(t,e){null!=t&&(p.isArray(t)?e+="[]":t=[t],p.forEach(t,(function(t){p.isDate(t)?t=t.toISOString():p.isObject(t)&&(t=JSON.stringify(t)),i.push(v(e)+"="+v(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 y(){this.handlers=[]}y.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},y.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},y.prototype.forEach=function(t){p.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var m=y,b=function(t,e,n){return p.forEach(n,(function(n){t=n(t,e)})),t},w=function(t){return!(!t||!t.__CANCEL__)},x=function(t,e){p.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))},S=function(t,e,n,r,i){return 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}(new Error(t),e,n,r,i)},T=["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"],E=p.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=p.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},P=p.isStandardBrowserEnv()?{write:function(t,e,n,r,i,s){var o=[];o.push(t+"="+encodeURIComponent(e)),p.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),p.isString(r)&&o.push("path="+r),p.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(){}},R=function(t){return new Promise((function(e,n){var r=t.data,i=t.headers;p.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,c,h=(a=t.baseURL,c=t.url,a&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(c)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(a,c):c);if(s.open(t.method.toUpperCase(),g(h,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,i,o,u,a,c="getAllResponseHeaders"in s?(r=s.getAllResponseHeaders(),a={},r?(p.forEach(r.split("\n"),(function(t){if(u=t.indexOf(":"),i=p.trim(t.substr(0,u)).toLowerCase(),o=p.trim(t.substr(u+1)),i){if(a[i]&&T.indexOf(i)>=0)return;a[i]="set-cookie"===i?(a[i]?a[i]:[]).concat([o]):a[i]?a[i]+", "+o:o}})),a):a):null,h={data:t.responseType&&"text"!==t.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:c,config:t,request:s};!function(t,e,n){var r=n.config.validateStatus;!r||r(n.status)?t(n):e(S("Request failed with status code "+n.status,n.config,null,n.request,n))}(e,n,h),s=null}},s.onabort=function(){s&&(n(S("Request aborted",t,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(S("Network Error",t,null,s)),s=null},s.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(S(e,t,"ECONNABORTED",s)),s=null},p.isStandardBrowserEnv()){var f=P,d=(t.withCredentials||E(h))&&t.xsrfCookieName?f.read(t.xsrfCookieName):void 0;d&&(i[t.xsrfHeaderName]=d)}if("setRequestHeader"in s&&p.forEach(i,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete i[e]:s.setRequestHeader(e,t)})),p.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)}))},A={"Content-Type":"application/x-www-form-urlencoded"};function C(t,e){!p.isUndefined(t)&&p.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var k,j={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(k=R),k),transformRequest:[function(t,e){return x(e,"Accept"),x(e,"Content-Type"),p.isFormData(t)||p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)?t:p.isArrayBufferView(t)?t.buffer:p.isURLSearchParams(t)?(C(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):p.isObject(t)?(C(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, */*"}}};p.forEach(["delete","get","head"],(function(t){j.headers[t]={}})),p.forEach(["post","put","patch"],(function(t){j.headers[t]=p.merge(A)}));var O=j;function D(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var N=function(t){return D(t),t.headers=t.headers||{},t.data=b(t.data,t.headers,t.transformRequest),t.headers=p.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),p.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||O.adapter)(t).then((function(e){return D(t),e.data=b(e.data,e.headers,t.transformResponse),e}),(function(e){return w(e)||(D(t),e&&e.response&&(e.response.data=b(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},q=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"];p.forEach(r,(function(t){void 0!==e[t]&&(n[t]=e[t])})),p.forEach(i,(function(r){p.isObject(e[r])?n[r]=p.deepMerge(t[r],e[r]):void 0!==e[r]?n[r]=e[r]:p.isObject(t[r])?n[r]=p.deepMerge(t[r]):void 0!==t[r]&&(n[r]=t[r])})),p.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 p.forEach(u,(function(r){void 0!==e[r]?n[r]=e[r]:void 0!==t[r]&&(n[r]=t[r])})),n};function U(t){this.defaults=t,this.interceptors={request:new m,response:new m}}U.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=q(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[N,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},U.prototype.getUri=function(t){return t=q(this.defaults,t),g(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},p.forEach(["delete","get","head","options"],(function(t){U.prototype[t]=function(e,n){return this.request(p.merge(n||{},{method:t,url:e}))}})),p.forEach(["post","put","patch"],(function(t){U.prototype[t]=function(e,n,r){return this.request(p.merge(r||{},{method:t,url:e,data:n}))}}));var F=U;function H(t){this.message=t}H.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},H.prototype.__CANCEL__=!0;var L=H;function M(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 L(t),e(n.reason))}))}M.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},M.source=function(){var t;return{token:new M((function(e){t=e})),cancel:t}};var B=M;function _(t){var e=new F(t),n=u(F.prototype.request,e);return p.extend(n,F.prototype,e),p.extend(n,e),n}var I=_(O);I.Axios=F,I.create=function(t){return _(q(I.defaults,t))},I.Cancel=L,I.CancelToken=B,I.isCancel=w,I.all=function(t){return Promise.all(t)},I.spread=function(t){return function(e){return t.apply(null,e)}};var z=I,J=I;z.default=J;var K=z,X=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),G=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 V(t,e){throw void 0!==t.response?new X(t,e):!0===t.isAxiosError?new G(t.message):t}var $=function(){function t(t){void 0!==t.apiKey?this.instance=K.create({baseURL:t.host,headers:{"X-Meili-API-Key":t.apiKey}}):this.instance=K.create({baseURL:t.host}),this.cancelTokenSource=K.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 V(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 V(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 V(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 V(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 V(r.sent(),n);case 4:return[2]}}))}))},t}();function W(t){var e=Object.entries(t).filter((function(t){return void 0!==t[1]}));return Object.fromEntries(e)}function Q(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 Y=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,Q(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,W(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:W(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}($);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 Y(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(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/indexes")];case 1:return[2,t.sent()]}}))}))},s.prototype.createIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:return[4,this.post("/indexes",n(n({},e),{uid:t}))];case 1:return r=i.sent(),[2,new Y(this.config,r.uid)]}}))}))},s.prototype.getKeys=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/keys")];case 1:return[2,t.sent()]}}))}))},s.prototype.isHealthy=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/health").then((function(){return!0}))];case 1:return[2,t.sent()]}}))}))},s.prototype.setHealthy=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.put("/health",{health:!0})];case 1:return[2,t.sent()]}}))}))},s.prototype.setUnhealthy=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.put("/health",{health:!1})];case 1:return[2,t.sent()]}}))}))},s.prototype.changeHealthTo=function(t){return r(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.put("/health",{health:t})];case 1:return[2,e.sent()]}}))}))},s.prototype.stats=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/stats")];case 1:return[2,t.sent()]}}))}))},s.prototype.version=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/version")];case 1:return[2,t.sent()]}}))}))},s}($)}()}));function e(t){return Object.keys(t).reduce((e,n)=>(void 0!==t[n]&&(e[n]=t[n]),e),{})}return function(n,r,i={}){return{client:new t({host:n,apiKey:r}),hitsPerPage:i.hitsPerPage||10,limitPerRequest:i.limitPerRequest||50,attributesToHighlight:["*"],transformToMeiliSearchParams:function(t){return e({q:t.query,facetsDistribution:t.facets.length?t.facets:void 0,facetFilters:t.facetFilters,attributesToHighlight:this.attributesToHighlight,limit:this.limitPerRequest})},replaceHighlightTags:function(t,e,n){return Object.keys(t).reduce((r,i)=>{let s=t[i];var o;return("string"==typeof(o=t[i])||o instanceof String)&&(s=t[i].replace(/<em>/g,e).replace(/<\/em>/g,n)),r[i]={value:s.toString()},r},{})},parseHits:function(t,e){if(void 0!==e.page){const n=this.hitsPerPage,r=e.page*n;t=t.splice(r,this.hitsPerPage)}return t.map(t=>{const n=t._formatted;return delete t._formatted,{...t,_highlightResult:this.replaceHighlightTags(n,e.highlightPreTag,e.highlightPostTag)}})},paginationParams:function(t,e){if(void 0!==e.page){const n=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+n,page:e.page}}},parseMeiliSearchResponse:function(t,n,r){this.hitsPerPage=r.hitsPerPage||this.hitsPerPage;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=this.transformToMeiliSearchParams(t[0].params),n=t[0].indexName,r=await this.client.getIndex(n).search(e.q,e);return this.parseMeiliSearchResponse(n,r,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)e.hasOwnProperty(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){return new(n||(n=Promise))((function(i,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){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).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(s){return function(u){return function(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}}([s,u])}}}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&&"object"==typeof t}function d(t){return"[object Function]"===a.call(t)}function l(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)}var p={isArray:c,isArrayBuffer:function(t){return"[object ArrayBuffer]"===a.call(t)},isBuffer:function(t){return null!==t&&!h(t)&&null!==t.constructor&&!h(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:f,isUndefined:h,isDate:function(t){return"[object Date]"===a.call(t)},isFile:function(t){return"[object File]"===a.call(t)},isBlob:function(t){return"[object Blob]"===a.call(t)},isFunction:d,isStream:function(t){return f(t)&&d(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,i=arguments.length;r<i;r++)l(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,i=arguments.length;r<i;r++)l(arguments[r],n);return e},extend:function(t,e,n){return l(e,(function(e,r){t[r]=n&&"function"==typeof e?u(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}};function v(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 g=function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(p.isURLSearchParams(e))r=e.toString();else{var i=[];p.forEach(e,(function(t,e){null!=t&&(p.isArray(t)?e+="[]":t=[t],p.forEach(t,(function(t){p.isDate(t)?t=t.toISOString():p.isObject(t)&&(t=JSON.stringify(t)),i.push(v(e)+"="+v(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 y(){this.handlers=[]}y.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},y.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},y.prototype.forEach=function(t){p.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var m=y,b=function(t,e,n){return p.forEach(n,(function(n){t=n(t,e)})),t},w=function(t){return!(!t||!t.__CANCEL__)},x=function(t,e){p.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))},S=function(t,e,n,r,i){return 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}(new Error(t),e,n,r,i)},T=["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"],E=p.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=p.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},P=p.isStandardBrowserEnv()?{write:function(t,e,n,r,i,s){var o=[];o.push(t+"="+encodeURIComponent(e)),p.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),p.isString(r)&&o.push("path="+r),p.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(){}},R=function(t){return new Promise((function(e,n){var r=t.data,i=t.headers;p.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,c,h=(a=t.baseURL,c=t.url,a&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(c)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(a,c):c);if(s.open(t.method.toUpperCase(),g(h,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,i,o,u,a,c="getAllResponseHeaders"in s?(r=s.getAllResponseHeaders(),a={},r?(p.forEach(r.split("\n"),(function(t){if(u=t.indexOf(":"),i=p.trim(t.substr(0,u)).toLowerCase(),o=p.trim(t.substr(u+1)),i){if(a[i]&&T.indexOf(i)>=0)return;a[i]="set-cookie"===i?(a[i]?a[i]:[]).concat([o]):a[i]?a[i]+", "+o:o}})),a):a):null,h={data:t.responseType&&"text"!==t.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:c,config:t,request:s};!function(t,e,n){var r=n.config.validateStatus;!r||r(n.status)?t(n):e(S("Request failed with status code "+n.status,n.config,null,n.request,n))}(e,n,h),s=null}},s.onabort=function(){s&&(n(S("Request aborted",t,"ECONNABORTED",s)),s=null)},s.onerror=function(){n(S("Network Error",t,null,s)),s=null},s.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(S(e,t,"ECONNABORTED",s)),s=null},p.isStandardBrowserEnv()){var f=P,d=(t.withCredentials||E(h))&&t.xsrfCookieName?f.read(t.xsrfCookieName):void 0;d&&(i[t.xsrfHeaderName]=d)}if("setRequestHeader"in s&&p.forEach(i,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete i[e]:s.setRequestHeader(e,t)})),p.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)}))},A={"Content-Type":"application/x-www-form-urlencoded"};function C(t,e){!p.isUndefined(t)&&p.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var k,j={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(k=R),k),transformRequest:[function(t,e){return x(e,"Accept"),x(e,"Content-Type"),p.isFormData(t)||p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t)?t:p.isArrayBufferView(t)?t.buffer:p.isURLSearchParams(t)?(C(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):p.isObject(t)?(C(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, */*"}}};p.forEach(["delete","get","head"],(function(t){j.headers[t]={}})),p.forEach(["post","put","patch"],(function(t){j.headers[t]=p.merge(A)}));var O=j;function D(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var N=function(t){return D(t),t.headers=t.headers||{},t.data=b(t.data,t.headers,t.transformRequest),t.headers=p.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),p.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||O.adapter)(t).then((function(e){return D(t),e.data=b(e.data,e.headers,t.transformResponse),e}),(function(e){return w(e)||(D(t),e&&e.response&&(e.response.data=b(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},q=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"];p.forEach(r,(function(t){void 0!==e[t]&&(n[t]=e[t])})),p.forEach(i,(function(r){p.isObject(e[r])?n[r]=p.deepMerge(t[r],e[r]):void 0!==e[r]?n[r]=e[r]:p.isObject(t[r])?n[r]=p.deepMerge(t[r]):void 0!==t[r]&&(n[r]=t[r])})),p.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 p.forEach(u,(function(r){void 0!==e[r]?n[r]=e[r]:void 0!==t[r]&&(n[r]=t[r])})),n};function U(t){this.defaults=t,this.interceptors={request:new m,response:new m}}U.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=q(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[N,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},U.prototype.getUri=function(t){return t=q(this.defaults,t),g(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},p.forEach(["delete","get","head","options"],(function(t){U.prototype[t]=function(e,n){return this.request(p.merge(n||{},{method:t,url:e}))}})),p.forEach(["post","put","patch"],(function(t){U.prototype[t]=function(e,n,r){return this.request(p.merge(r||{},{method:t,url:e,data:n}))}}));var F=U;function H(t){this.message=t}H.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},H.prototype.__CANCEL__=!0;var L=H;function M(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 L(t),e(n.reason))}))}M.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},M.source=function(){var t;return{token:new M((function(e){t=e})),cancel:t}};var B=M;function _(t){var e=new F(t),n=u(F.prototype.request,e);return p.extend(n,F.prototype,e),p.extend(n,e),n}var I=_(O);I.Axios=F,I.create=function(t){return _(q(I.defaults,t))},I.Cancel=L,I.CancelToken=B,I.isCancel=w,I.all=function(t){return Promise.all(t)},I.spread=function(t){return function(e){return t.apply(null,e)}};var z=I,J=I;z.default=J;var K=z,X=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),G=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 V(t,e){throw void 0!==t.response?new X(t,e):!0===t.isAxiosError?new G(t.message):t}var $=function(){function t(t){void 0!==t.apiKey?this.instance=K.create({baseURL:t.host,headers:{"X-Meili-API-Key":t.apiKey}}):this.instance=K.create({baseURL:t.host}),this.cancelTokenSource=K.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 V(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 V(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 V(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 V(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 V(r.sent(),n);case 4:return[2]}}))}))},t}();function W(t){var e=Object.entries(t).filter((function(t){return void 0!==t[1]}));return Object.fromEntries(e)}function Q(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 Y=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,Q(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,W(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:W(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}($);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 Y(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(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/indexes")];case 1:return[2,t.sent()]}}))}))},s.prototype.createIndex=function(t,e){return void 0===e&&(e={}),r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:return[4,this.post("/indexes",n(n({},e),{uid:t}))];case 1:return r=i.sent(),[2,new Y(this.config,r.uid)]}}))}))},s.prototype.getKeys=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/keys")];case 1:return[2,t.sent()]}}))}))},s.prototype.isHealthy=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/health").then((function(){return!0}))];case 1:return[2,t.sent()]}}))}))},s.prototype.setHealthy=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.put("/health",{health:!0})];case 1:return[2,t.sent()]}}))}))},s.prototype.setUnhealthy=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.put("/health",{health:!1})];case 1:return[2,t.sent()]}}))}))},s.prototype.changeHealthTo=function(t){return r(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.put("/health",{health:t})];case 1:return[2,e.sent()]}}))}))},s.prototype.stats=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/stats")];case 1:return[2,t.sent()]}}))}))},s.prototype.version=function(){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.get("/version")];case 1:return[2,t.sent()]}}))}))},s}($)}()}));function e(t){return Object.keys(t).reduce((e,n)=>(void 0!==t[n]&&(e[n]=t[n]),e),{})}return function(n,r,i={}){return{client:new t({host:n,apiKey:r}),hitsPerPage:i.hitsPerPage||10,limitPerRequest:i.limitPerRequest||50,attributesToHighlight:["*"],transformToMeiliSearchParams:function(t){return e({q:t.query,facetsDistribution:t.facets.length?t.facets:void 0,facetFilters:t.facetFilters,attributesToHighlight:this.attributesToHighlight,limit:this.limitPerRequest})},replaceHighlightTags:function(t,e,n){return Object.keys(t).reduce((r,i)=>{let s=t[i]||"";var o;return("string"==typeof(o=t[i])||o instanceof String)&&(s=t[i].replace(/<em>/g,e).replace(/<\/em>/g,n)),r[i]={value:s.toString()},r},{})},parseHits:function(t,e){if(void 0!==e.page){const n=this.hitsPerPage,r=e.page*n;t=t.splice(r,this.hitsPerPage)}return t.map(t=>{const n=t._formatted;return delete t._formatted,{...t,_highlightResult:this.replaceHighlightTags(n,e.highlightPreTag,e.highlightPostTag)}})},paginationParams:function(t,e){if(void 0!==e.page){const n=t%this.hitsPerPage==0?0:1;return{nbPages:Math.floor(t/this.hitsPerPage)+n,page:e.page}}},parseMeiliSearchResponse:function(t,n,r){this.hitsPerPage=r.hitsPerPage||this.hitsPerPage;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=this.transformToMeiliSearchParams(t[0].params),n=t[0].indexName,r=await this.client.getIndex(n).search(e.q,e);return this.parseMeiliSearchResponse(n,r,t[0].params)}}}}));
//# sourceMappingURL=instant-meilisearch.umd.min.js.map
{
"name": "@meilisearch/instant-meilisearch",
"version": "0.1.2",
"version": "0.1.3",
"private": false,

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

@@ -30,3 +30,3 @@ import MeiliSearch from 'meilisearch'

return Object.keys(formattedHit).reduce((result, key) => {
let newHighlightString = formattedHit[key]
let newHighlightString = formattedHit[key] || ''
// If the value of the attribute is a string,

@@ -33,0 +33,0 @@ // the highlight is applied by MeiliSearch (<em> tags)

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