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