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.3 to 0.2.4

2

dist/instant-meilisearch.cjs.js

@@ -126,2 +126,3 @@ 'use strict';

attributesToSnippet,
attributesToRetrieve,
filters,

@@ -135,2 +136,3 @@ } = params;

attributesToCrop: attributesToSnippet,
attributesToRetrieve,
filters,

@@ -137,0 +139,0 @@ limit: this.placeholderSearch === false && query === '' ? 0 : limit,

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 e=e||"__ais-highlight__",i=i||"__/ais-highlight__",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 h({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,h)=>(e.includes(h)&&(r[h]={value:n(t[h],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:h}=t;return i({q:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,filters:h,limit:!1===this.placeholderSearch&&""===s?0: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:h({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:h,processingTimeMs:o,query:c,hits:u}=e;return{results:[i({index:t,hitsPerPage:this.hitsPerPage,facets:n,exhaustiveFacetsCount:a,exhaustiveNbHits:r,nbHits:h,processingTimeMs:o,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)}}};
"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 e=e||"__ais-highlight__",i=i||"__/ais-highlight__",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,attributesToRetrieve:o,filters:h}=t;return i({q:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,attributesToRetrieve:o,filters:h,limit:!1===this.placeholderSearch&&""===s?0: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

@@ -120,2 +120,3 @@ import MeiliSearch from 'meilisearch';

attributesToSnippet,
attributesToRetrieve,
filters,

@@ -129,2 +130,3 @@ } = params;

attributesToCrop: attributesToSnippet,
attributesToRetrieve,
filters,

@@ -131,0 +133,0 @@ limit: this.placeholderSearch === false && query === '' ? 0 : limit,

@@ -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 e=e||"__ais-highlight__",s=s||"__/ais-highlight__",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,h)=>(e.includes(h)&&(n[h]={value:r(t[h],i,s,a)}),n)),{}))}function h(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:h}=t;return e({q:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,filters:h,limit:!1===this.placeholderSearch&&""===s?0: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:h,processingTimeMs:o,query:c,hits:g}=i;return{results:[e({index:t,hitsPerPage:this.hitsPerPage,facets:n,exhaustiveFacetsCount:a,exhaustiveNbHits:r,nbHits:h,processingTimeMs:o,query:c,...this.paginationParams(g.length,s),hits:this.parseHits(g,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)}}}export default h;
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 e=e||"__ais-highlight__",s=s||"__/ais-highlight__",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,h)=>(e.includes(h)&&(n[h]={value:r(t[h],i,s,a)}),n)),{}))}function h(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,attributesToRetrieve:h,filters:o}=t;return e({q:s,facetsDistribution:a.length?a:void 0,facetFilters:r,attributesToHighlight:this.attributesToHighlight,attributesToCrop:n,attributesToRetrieve:h,filters:o,limit:!1===this.placeholderSearch&&""===s?0: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:h,processingTimeMs:o,query:c,hits:g}=i;return{results:[e({index:t,hitsPerPage:this.hitsPerPage,facets:n,exhaustiveFacetsCount:a,exhaustiveNbHits:r,nbHits:h,processingTimeMs:o,query:c,...this.paginationParams(g.length,s),hits:this.parseHits(g,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)}}}export default h;
//# 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";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=f(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=c(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},p.prototype.delete=function(t){delete this.map[c(t)]},p.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},p.prototype.set=function(t,e){this.map[c(t)]=h(e)},p.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},n&&(p.prototype[Symbol.iterator]=p.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var r,n,i=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function x(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},b.call(w.prototype),b.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},x.error=function(){var t=new x(null,{status:0,statusText:""});return t.type="error",t};var T=[301,302,303,307,308];x.redirect=function(t,e){if(-1===T.indexOf(e))throw new RangeError("Invalid status code");return new x(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function R(t,r){return new Promise((function(n,s){var o=new w(t,r);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;n(new x(i,r))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&i&&(u.responseType="blob"),o.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",a)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}R.polyfill=!0,t.fetch||(t.fetch=R,t.Headers=p,t.Request=w,t.Response=x),e.Headers=p,e.Request=w,e.Response=x,e.fetch=R}({})}("undefined"!=typeof self?self:t);var e=function(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}((function(t,e){t.exports=function(){

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

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

"@rollup/plugin-node-resolve": "^10.0.0",
"babel-jest": "^26.1.0",
"@typescript-eslint/eslint-plugin": "^4.0.0",
"@typescript-eslint/parser": "^4.0.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.1.0",
"eslint": "^7.13.0",

@@ -55,0 +55,0 @@ "eslint-config-prettier": "^6.11.0",

@@ -21,2 +21,3 @@ import MeiliSearch from 'meilisearch'

attributesToSnippet,
attributesToRetrieve,
filters,

@@ -30,2 +31,3 @@ } = params

attributesToCrop: attributesToSnippet,
attributesToRetrieve,
filters,

@@ -32,0 +34,0 @@ limit: this.placeholderSearch === false && query === '' ? 0 : limit,

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