Socket
Socket
Sign inDemoInstall

@meilisearch/instant-meilisearch

Package Overview
Dependencies
Maintainers
6
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.5.1 to 0.5.2

24

dist/instant-meilisearch.cjs.js

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

function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
function __spreadArray(to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
}

@@ -176,3 +172,3 @@

result[key] = {
value: replaceHighlightTags(formattedHit[key], highlightPreTag, highlightPostTag)
value: replaceHighlightTags(formattedHit[key], highlightPreTag, highlightPostTag),
};

@@ -210,3 +206,3 @@ return result;

result[key] = {
value: snippetValue(formattedHit[key], snippetEllipsisText, highlightPreTag, highlightPostTag)
value: snippetValue(formattedHit[key], snippetEllipsisText, highlightPreTag, highlightPostTag),
};

@@ -223,3 +219,3 @@ }

_highlightResult: createHighlighResult(__assign({ formattedHit: formattedHit }, instantSearchParams)),
_snippetResult: createSnippetResult(__assign({ formattedHit: formattedHit }, instantSearchParams))
_snippetResult: createSnippetResult(__assign({ formattedHit: formattedHit }, instantSearchParams)),
};

@@ -246,3 +242,3 @@ };

return {
results: [ISResponse]
results: [ISResponse],
};

@@ -331,3 +327,3 @@ };

hitsPerPage: hitsPerPage === undefined ? 20 : hitsPerPage,
page: page || 0
page: page || 0, // default page is 0 if none is provided
};

@@ -355,3 +351,3 @@ msSearchParams = adaptToMeiliSearchParams(instantSearchParams, context);

});
}
},
};

@@ -358,0 +354,0 @@ }

@@ -15,3 +15,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("meilisearch"),e=function(){return(e=Object.assign||function(t){for(var e,r=1,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)};

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

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

function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
function __spreadArray(to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
}

@@ -172,3 +168,3 @@

result[key] = {
value: replaceHighlightTags(formattedHit[key], highlightPreTag, highlightPostTag)
value: replaceHighlightTags(formattedHit[key], highlightPreTag, highlightPostTag),
};

@@ -206,3 +202,3 @@ return result;

result[key] = {
value: snippetValue(formattedHit[key], snippetEllipsisText, highlightPreTag, highlightPostTag)
value: snippetValue(formattedHit[key], snippetEllipsisText, highlightPreTag, highlightPostTag),
};

@@ -219,3 +215,3 @@ }

_highlightResult: createHighlighResult(__assign({ formattedHit: formattedHit }, instantSearchParams)),
_snippetResult: createSnippetResult(__assign({ formattedHit: formattedHit }, instantSearchParams))
_snippetResult: createSnippetResult(__assign({ formattedHit: formattedHit }, instantSearchParams)),
};

@@ -242,3 +238,3 @@ };

return {
results: [ISResponse]
results: [ISResponse],
};

@@ -327,3 +323,3 @@ };

hitsPerPage: hitsPerPage === undefined ? 20 : hitsPerPage,
page: page || 0
page: page || 0, // default page is 0 if none is provided
};

@@ -351,3 +347,3 @@ msSearchParams = adaptToMeiliSearchParams(instantSearchParams, context);

});
}
},
};

@@ -354,0 +350,0 @@ }

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

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

@@ -1,4 +0,17 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("stream"),require("http"),require("https"),require("zlib"),require("encoding")):"function"==typeof define&&define.amd?define(["exports","stream","http","https","zlib","encoding"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{},t.require$$0,t.require$$1,t.require$$3,t.require$$4,t.require$$5)}(this,(function(t,e,r,n,i,o){"use strict";function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=s(e),a=s(r),c=s(n),h=s(i),l=s(o),f=function(){return(f=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 p(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function d(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function y(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function b(t){var e={exports:{}};return t(e,e.exports),e.exports
/*! https://mths.be/punycode v1.3.2 by @mathias */}var m=b((function(t,e){!function(r){var n=e&&!e.nodeType&&e,i=t&&!t.nodeType&&t,o="object"==typeof v&&v;o.global!==o&&o.window!==o&&o.self!==o||(r=o);var s,u,a=2147483647,c=36,h=/^xn--/,l=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,y=String.fromCharCode;function b(t){throw RangeError(p[t])}function m(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function g(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+m((t=t.replace(f,".")).split("."),e).join(".")}function w(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function x(t){return m(t,(function(t){var e="";return t>65535&&(e+=y((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=y(t)})).join("")}function S(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function T(t,e,r){var n=0;for(t=r?d(t/700):t>>1,t+=d(t/e);t>455;n+=c)t=d(t/35);return d(n+36*t/(t+38))}function j(t){var e,r,n,i,o,s,u,h,l,f,p,y=[],v=t.length,m=0,g=128,w=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&b("not-basic"),y.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<v;){for(o=m,s=1,u=c;i>=v&&b("invalid-input"),((h=(p=t.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:c)>=c||h>d((a-m)/s))&&b("overflow"),m+=h*s,!(h<(l=u<=w?1:u>=w+26?26:u-w));u+=c)s>d(a/(f=c-l))&&b("overflow"),s*=f;w=T(m-o,e=y.length+1,0==o),d(m/e)>a-g&&b("overflow"),g+=d(m/e),m%=e,y.splice(m++,0,g)}return x(y)}function R(t){var e,r,n,i,o,s,u,h,l,f,p,v,m,g,x,j=[];for(v=(t=w(t)).length,e=128,r=0,o=72,s=0;s<v;++s)(p=t[s])<128&&j.push(y(p));for(n=i=j.length,i&&j.push("-");n<v;){for(u=a,s=0;s<v;++s)(p=t[s])>=e&&p<u&&(u=p);for(u-e>d((a-r)/(m=n+1))&&b("overflow"),r+=(u-e)*m,e=u,s=0;s<v;++s)if((p=t[s])<e&&++r>a&&b("overflow"),p==e){for(h=r,l=c;!(h<(f=l<=o?1:l>=o+26?26:l-o));l+=c)x=h-f,g=c-f,j.push(y(S(f+x%g,0))),h=d(x/g);j.push(y(S(h,0))),o=T(r,m,n==i),r=0,++n}++r,++e}return j.join("")}if(s={version:"1.3.2",ucs2:{decode:w,encode:x},decode:j,encode:R,toASCII:function(t){return g(t,(function(t){return l.test(t)?"xn--"+R(t):t}))},toUnicode:function(t){return g(t,(function(t){return h.test(t)?j(t.slice(4).toLowerCase()):t}))}},n&&i)if(t.exports==n)i.exports=s;else for(u in s)s.hasOwnProperty(u)&&(n[u]=s[u]);else r.punycode=s}(v)})),g=function(t){return"string"==typeof t},w=function(t){return"object"==typeof t&&null!==t},x=function(t){return null===t},S=function(t){return null==t};function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var j=function(t,e,r,n){e=e||"&",r=r||"=";var i={};if("string"!=typeof t||0===t.length)return i;var o=/\+/g;t=t.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var u=t.length;s>0&&u>s&&(u=s);for(var a=0;a<u;++a){var c,h,l,f,p=t[a].replace(o,"%20"),d=p.indexOf(r);d>=0?(c=p.substr(0,d),h=p.substr(d+1)):(c=p,h=""),l=decodeURIComponent(c),f=decodeURIComponent(h),T(i,l)?Array.isArray(i[l])?i[l].push(f):i[l]=[i[l],f]:i[l]=f}return i},R=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},O=function(t,e,r,n){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(n){var i=encodeURIComponent(R(n))+r;return Array.isArray(t[n])?t[n].map((function(t){return i+encodeURIComponent(R(t))})).join(e):i+encodeURIComponent(R(t[n]))})).join(e):n?encodeURIComponent(R(n))+r+encodeURIComponent(R(t)):""},q=b((function(t,e){e.decode=e.parse=j,e.encode=e.stringify=O})),P=G,A=function(t,e){return G(t,!1,!0).resolve(e)},E=function(t,e){return t?G(t,!1,!0).resolveObject(e):e},C=function(t){g(t)&&(t=G(t));return t instanceof I?t.format():I.prototype.format.call(t)},k=I;function I(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var $=/^([a-z0-9.+-]+:)/i,_=/:[0-9]*$/,B=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,H=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),U=["'"].concat(H),L=["%","/","?",";","#"].concat(U),D=["/","?","#"],M=/^[+a-z0-9A-Z_-]{0,63}$/,z=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,F={javascript:!0,"javascript:":!0},K={javascript:!0,"javascript:":!0},N={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function G(t,e,r){if(t&&w(t)&&t instanceof I)return t;var n=new I;return n.parse(t,e,r),n}I.prototype.parse=function(t,e,r){if(!g(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=-1!==n&&n<t.indexOf("#")?"?":"#",o=t.split(i);o[0]=o[0].replace(/\\/g,"/");var s=t=o.join(i);if(s=s.trim(),!r&&1===t.split("#").length){var u=B.exec(s);if(u)return this.path=s,this.href=s,this.pathname=u[1],u[2]?(this.search=u[2],this.query=e?q.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var a=$.exec(s);if(a){var c=(a=a[0]).toLowerCase();this.protocol=c,s=s.substr(a.length)}if(r||a||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var h="//"===s.substr(0,2);!h||a&&K[a]||(s=s.substr(2),this.slashes=!0)}if(!K[a]&&(h||a&&!N[a])){for(var l,f,p=-1,d=0;d<D.length;d++){-1!==(y=s.indexOf(D[d]))&&(-1===p||y<p)&&(p=y)}-1!==(f=-1===p?s.lastIndexOf("@"):s.lastIndexOf("@",p))&&(l=s.slice(0,f),s=s.slice(f+1),this.auth=decodeURIComponent(l)),p=-1;for(d=0;d<L.length;d++){var y;-1!==(y=s.indexOf(L[d]))&&(-1===p||y<p)&&(p=y)}-1===p&&(p=s.length),this.host=s.slice(0,p),s=s.slice(p),this.parseHost(),this.hostname=this.hostname||"";var v="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!v)for(var b=this.hostname.split(/\./),w=(d=0,b.length);d<w;d++){var x=b[d];if(x&&!x.match(M)){for(var S="",T=0,j=x.length;T<j;T++)x.charCodeAt(T)>127?S+="x":S+=x[T];if(!S.match(M)){var R=b.slice(0,d),O=b.slice(d+1),P=x.match(z);P&&(R.push(P[1]),O.unshift(P[2])),O.length&&(s="/"+O.join(".")+s),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=m.toASCII(this.hostname));var A=this.port?":"+this.port:"",E=this.hostname||"";this.host=E+A,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!F[c])for(d=0,w=U.length;d<w;d++){var C=U[d];if(-1!==s.indexOf(C)){var k=encodeURIComponent(C);k===C&&(k=escape(C)),s=s.split(C).join(k)}}var I=s.indexOf("#");-1!==I&&(this.hash=s.substr(I),s=s.slice(0,I));var _=s.indexOf("?");if(-1!==_?(this.search=s.substr(_),this.query=s.substr(_+1),e&&(this.query=q.parse(this.query)),s=s.slice(0,_)):e&&(this.search="",this.query={}),s&&(this.pathname=s),N[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){A=this.pathname||"";var H=this.search||"";this.path=A+H}return this.href=this.format(),this},I.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&w(this.query)&&Object.keys(this.query).length&&(o=q.stringify(this.query));var s=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||N[e])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),e+i+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+n},I.prototype.resolve=function(t){return this.resolveObject(G(t,!1,!0)).format()},I.prototype.resolveObject=function(t){if(g(t)){var e=new I;e.parse(t,!1,!0),t=e}for(var r=new I,n=Object.keys(this),i=0;i<n.length;i++){var o=n[i];r[o]=this[o]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),u=0;u<s.length;u++){var a=s[u];"protocol"!==a&&(r[a]=t[a])}return N[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!N[t.protocol]){for(var c=Object.keys(t),h=0;h<c.length;h++){var l=c[h];r[l]=t[l]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||K[t.protocol])r.pathname=t.pathname;else{for(var f=(t.pathname||"").split("/");f.length&&!(t.host=f.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==f[0]&&f.unshift(""),f.length<2&&f.unshift(""),r.pathname=f.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var p=r.pathname||"",d=r.search||"";r.path=p+d}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var y=r.pathname&&"/"===r.pathname.charAt(0),v=t.host||t.pathname&&"/"===t.pathname.charAt(0),b=v||y||r.host&&t.pathname,m=b,w=r.pathname&&r.pathname.split("/")||[],T=(f=t.pathname&&t.pathname.split("/")||[],r.protocol&&!N[r.protocol]);if(T&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===f[0]?f[0]=t.host:f.unshift(t.host)),t.host=null),b=b&&(""===f[0]||""===w[0])),v)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,w=f;else if(f.length)w||(w=[]),w.pop(),w=w.concat(f),r.search=t.search,r.query=t.query;else if(!S(t.search)){if(T)r.hostname=r.host=w.shift(),(P=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=P.shift(),r.host=r.hostname=P.shift());return r.search=t.search,r.query=t.query,x(r.pathname)&&x(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var j=w.slice(-1)[0],R=(r.host||t.host||w.length>1)&&("."===j||".."===j)||""===j,O=0,q=w.length;q>=0;q--)"."===(j=w[q])?w.splice(q,1):".."===j?(w.splice(q,1),O++):O&&(w.splice(q,1),O--);if(!b&&!m)for(;O--;O)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),R&&"/"!==w.join("/").substr(-1)&&w.push("");var P,A=""===w[0]||w[0]&&"/"===w[0].charAt(0);T&&(r.hostname=r.host=A?"":w.length?w.shift():"",(P=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=P.shift(),r.host=r.hostname=P.shift()));return(b=b||r.host&&w.length)&&!A&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),x(r.pathname)&&x(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},I.prototype.parseHost=function(){var t=this.host,e=_.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var V={parse:P,resolve:A,resolveObject:E,format:C,Url:k},W=b((function(t,e){function r(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(e,"__esModule",{value:!0});var n=r(u.default),i=r(a.default),o=r(V),s=r(c.default),f=r(h.default);const p=n.Readable,d=Symbol("buffer"),y=Symbol("type");class b{constructor(){this[y]="";const t=arguments[0],e=arguments[1],r=[];let n=0;if(t){const e=t,i=Number(e.length);for(let t=0;t<i;t++){const i=e[t];let o;o=i instanceof Buffer?i:ArrayBuffer.isView(i)?Buffer.from(i.buffer,i.byteOffset,i.byteLength):i instanceof ArrayBuffer?Buffer.from(i):i instanceof b?i[d]:Buffer.from("string"==typeof i?i:String(i)),n+=o.length,r.push(o)}}this[d]=Buffer.concat(r);let i=e&&void 0!==e.type&&String(e.type).toLowerCase();i&&!/[^\u0020-\u007E]/.test(i)&&(this[y]=i)}get size(){return this[d].length}get type(){return this[y]}text(){return Promise.resolve(this[d].toString())}arrayBuffer(){const t=this[d],e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return Promise.resolve(e)}stream(){const t=new p;return t._read=function(){},t.push(this[d]),t.push(null),t}toString(){return"[object Blob]"}slice(){const t=this.size,e=arguments[0],r=arguments[1];let n,i;n=void 0===e?0:e<0?Math.max(t+e,0):Math.min(e,t),i=void 0===r?t:r<0?Math.max(t+r,0):Math.min(r,t);const o=Math.max(i-n,0),s=this[d].slice(n,n+o),u=new b([],{type:arguments[2]});return u[d]=s,u}}function m(t,e,r){Error.call(this,t),this.message=t,this.type=e,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}let g;Object.defineProperties(b.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(b.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,m.prototype.name="FetchError";try{g=l.default.convert}catch(t){}const w=Symbol("Body internals"),x=n.PassThrough;function S(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.size;let o=void 0===i?0:i;var s=r.timeout;let u=void 0===s?0:s;null==t?t=null:j(t)?t=Buffer.from(t.toString()):R(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof n||(t=Buffer.from(String(t)))),this[w]={body:t,disturbed:!1,error:null},this.size=o,this.timeout=u,t instanceof n&&t.on("error",(function(t){const r="AbortError"===t.name?t:new m(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[w].error=r}))}function T(){var t=this;if(this[w].disturbed)return S.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[w].disturbed=!0,this[w].error)return S.Promise.reject(this[w].error);let e=this.body;if(null===e)return S.Promise.resolve(Buffer.alloc(0));if(R(e)&&(e=e.stream()),Buffer.isBuffer(e))return S.Promise.resolve(e);if(!(e instanceof n))return S.Promise.resolve(Buffer.alloc(0));let r=[],i=0,o=!1;return new S.Promise((function(n,s){let u;t.timeout&&(u=setTimeout((function(){o=!0,s(new m(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(o=!0,s(e)):s(new m(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!o&&null!==e){if(t.size&&i+e.length>t.size)return o=!0,void s(new m(`content size at ${t.url} over limit: ${t.size}`,"max-size"));i+=e.length,r.push(e)}})),e.on("end",(function(){if(!o){clearTimeout(u);try{n(Buffer.concat(r,i))}catch(e){s(new m(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function j(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function R(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function O(t){let e,r,i=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return i instanceof n&&"function"!=typeof i.getBoundary&&(e=new x,r=new x,i.pipe(e),i.pipe(r),t[w].body=e,i=r),i}function q(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":j(t)?"application/x-www-form-urlencoded;charset=UTF-8":R(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?`multipart/form-data;boundary=${t.getBoundary()}`:t instanceof n?null:"text/plain;charset=UTF-8"}function P(t){const e=t.body;return null===e?0:R(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}S.prototype={get body(){return this[w].body},get bodyUsed(){return this[w].disturbed},arrayBuffer(){return T.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return T.call(this).then((function(e){return Object.assign(new b([],{type:t.toLowerCase()}),{[d]:e})}))},json(){var t=this;return T.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return S.Promise.reject(new m(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return T.call(this).then((function(t){return t.toString()}))},buffer(){return T.call(this)},textConverted(){var t=this;return T.call(this).then((function(e){return function(t,e){if("function"!=typeof g)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=e.get("content-type");let n,i,o="utf-8";r&&(n=/charset=([^;]*)/i.exec(r));i=t.slice(0,1024).toString(),!n&&i&&(n=/<meta.+?charset=(['"])(.+?)\1/i.exec(i));!n&&i&&(n=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(i),n||(n=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(i),n&&n.pop()),n&&(n=/charset=(.*)/i.exec(n.pop())));!n&&i&&(n=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(i));n&&(o=n.pop(),"gb2312"!==o&&"gbk"!==o||(o="gb18030"));return g(t,"UTF-8",o).toString()}(e,t.headers)}))}},Object.defineProperties(S.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),S.mixIn=function(t){for(const e of Object.getOwnPropertyNames(S.prototype))if(!(e in t)){const r=Object.getOwnPropertyDescriptor(S.prototype,e);Object.defineProperty(t,e,r)}},S.Promise=v.Promise;const A=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,E=/[^\t\x20-\x7e\x80-\xff]/;function C(t){if(t=`${t}`,A.test(t)||""===t)throw new TypeError(`${t} is not a legal HTTP header name`)}function k(t){if(t=`${t}`,E.test(t))throw new TypeError(`${t} is not a legal HTTP header value`)}function I(t,e){e=e.toLowerCase();for(const r in t)if(r.toLowerCase()===e)return r}const $=Symbol("map");class _{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[$]=Object.create(null),t instanceof _){const e=t.raw(),r=Object.keys(e);for(const t of r)for(const r of e[t])this.append(t,r)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const r=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(e))}for(const t of r){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const r=t[e];this.append(e,r)}}}}get(t){C(t=`${t}`);const e=I(this[$],t);return void 0===e?null:this[$][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=B(this),n=0;for(;n<r.length;){var i=r[n];const o=i[0],s=i[1];t.call(e,s,o,this),r=B(this),n++}}set(t,e){e=`${e}`,C(t=`${t}`),k(e);const r=I(this[$],t);this[$][void 0!==r?r:t]=[e]}append(t,e){e=`${e}`,C(t=`${t}`),k(e);const r=I(this[$],t);void 0!==r?this[$][r].push(e):this[$][t]=[e]}has(t){return C(t=`${t}`),void 0!==I(this[$],t)}delete(t){C(t=`${t}`);const e=I(this[$],t);void 0!==e&&delete this[$][e]}raw(){return this[$]}keys(){return U(this,"key")}values(){return U(this,"value")}[Symbol.iterator](){return U(this,"key+value")}}function B(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(t[$]).sort();return r.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[$][e].join(", ")}:function(e){return[e.toLowerCase(),t[$][e].join(", ")]})}_.prototype.entries=_.prototype[Symbol.iterator],Object.defineProperty(_.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(_.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const H=Symbol("internal");function U(t,e){const r=Object.create(L);return r[H]={target:t,kind:e,index:0},r}const L=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==L)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[H];const e=t.target,r=t.kind,n=t.index,i=B(e,r);return n>=i.length?{value:void 0,done:!0}:(this[H].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function D(t){const e=Object.assign({__proto__:null},t[$]),r=I(t[$],"Host");return void 0!==r&&(e[r]=e[r][0]),e}Object.defineProperty(L,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const M=Symbol("Response internals"),z=i.STATUS_CODES;class F{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};S.call(this,t,e);const r=e.status||200,n=new _(e.headers);if(null!=t&&!n.has("Content-Type")){const e=q(t);e&&n.append("Content-Type",e)}this[M]={url:e.url,status:r,statusText:e.statusText||z[r],headers:n,counter:e.counter}}get url(){return this[M].url||""}get status(){return this[M].status}get ok(){return this[M].status>=200&&this[M].status<300}get redirected(){return this[M].counter>0}get statusText(){return this[M].statusText}get headers(){return this[M].headers}clone(){return new F(O(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}S.mixIn(F.prototype),Object.defineProperties(F.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(F.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const K=Symbol("Request internals"),N=o.parse,G=o.format,W="destroy"in n.Readable.prototype;function Z(t){return"object"==typeof t&&"object"==typeof t[K]}class J{constructor(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Z(t)?e=N(t.url):(e=t&&t.href?N(t.href):N(`${t}`),t={});let n=r.method||t.method||"GET";if(n=n.toUpperCase(),(null!=r.body||Z(t)&&null!==t.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let i=null!=r.body?r.body:Z(t)&&null!==t.body?O(t):null;S.call(this,i,{timeout:r.timeout||t.timeout||0,size:r.size||t.size||0});const o=new _(r.headers||t.headers||{});if(null!=i&&!o.has("Content-Type")){const t=q(i);t&&o.append("Content-Type",t)}let s=Z(t)?t.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[K]={method:n,redirect:r.redirect||t.redirect||"follow",headers:o,parsedURL:e,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===t.compress||t.compress,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent}get method(){return this[K].method}get url(){return G(this[K].parsedURL)}get headers(){return this[K].headers}get redirect(){return this[K].redirect}get signal(){return this[K].signal}clone(){return new J(this)}}function Y(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}S.mixIn(J.prototype),Object.defineProperty(J.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(J.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),Y.prototype=Object.create(Error.prototype),Y.prototype.constructor=Y,Y.prototype.name="AbortError";const X=n.PassThrough,Q=o.resolve;function tt(t,e){if(!tt.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return S.Promise=tt.Promise,new tt.Promise((function(r,o){const u=new J(t,e),a=function(t){const e=t[K].parsedURL,r=new _(t[K].headers);if(r.has("Accept")||r.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof n.Readable&&!W)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let i=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(i="0"),null!=t.body){const e=P(t);"number"==typeof e&&(i=String(e))}i&&r.set("Content-Length",i),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let o=t.agent;return"function"==typeof o&&(o=o(e)),r.has("Connection")||o||r.set("Connection","close"),Object.assign({},e,{method:t.method,headers:D(r),agent:o})}(u),c=("https:"===a.protocol?s:i).request,h=u.signal;let l=null;const p=function(){let t=new Y("The user aborted a request.");o(t),u.body&&u.body instanceof n.Readable&&u.body.destroy(t),l&&l.body&&l.body.emit("error",t)};if(h&&h.aborted)return void p();const d=function(){p(),b()},y=c(a);let v;function b(){y.abort(),h&&h.removeEventListener("abort",d),clearTimeout(v)}h&&h.addEventListener("abort",d),u.timeout&&y.once("socket",(function(t){v=setTimeout((function(){o(new m(`network timeout at: ${u.url}`,"request-timeout")),b()}),u.timeout)})),y.on("error",(function(t){o(new m(`request to ${u.url} failed, reason: ${t.message}`,"system",t)),b()})),y.on("response",(function(t){clearTimeout(v);const e=function(t){const e=new _;for(const r of Object.keys(t))if(!A.test(r))if(Array.isArray(t[r]))for(const n of t[r])E.test(n)||(void 0===e[$][r]?e[$][r]=[n]:e[$][r].push(n));else E.test(t[r])||(e[$][r]=[t[r]]);return e}(t.headers);if(tt.isRedirect(t.statusCode)){const n=e.get("Location"),i=null===n?null:Q(u.url,n);switch(u.redirect){case"error":return o(new m(`uri requested responds with a redirect, redirect mode is set to error: ${u.url}`,"no-redirect")),void b();case"manual":if(null!==i)try{e.set("Location",i)}catch(t){o(t)}break;case"follow":if(null===i)break;if(u.counter>=u.follow)return o(new m(`maximum redirect reached at: ${u.url}`,"max-redirect")),void b();const n={headers:new _(u.headers),follow:u.follow,counter:u.counter+1,agent:u.agent,compress:u.compress,method:u.method,body:u.body,signal:u.signal,timeout:u.timeout,size:u.size};return 303!==t.statusCode&&u.body&&null===P(u)?(o(new m("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==u.method)||(n.method="GET",n.body=void 0,n.headers.delete("content-length")),r(tt(new J(i,n))),void b())}}t.once("end",(function(){h&&h.removeEventListener("abort",d)}));let n=t.pipe(new X);const i={url:u.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:u.size,timeout:u.timeout,counter:u.counter},s=e.get("Content-Encoding");if(!u.compress||"HEAD"===u.method||null===s||204===t.statusCode||304===t.statusCode)return l=new F(n,i),void r(l);const a={flush:f.Z_SYNC_FLUSH,finishFlush:f.Z_SYNC_FLUSH};if("gzip"==s||"x-gzip"==s)return n=n.pipe(f.createGunzip(a)),l=new F(n,i),void r(l);if("deflate"!=s&&"x-deflate"!=s){if("br"==s&&"function"==typeof f.createBrotliDecompress)return n=n.pipe(f.createBrotliDecompress()),l=new F(n,i),void r(l);l=new F(n,i),r(l)}else{t.pipe(new X).once("data",(function(t){n=8==(15&t[0])?n.pipe(f.createInflate()):n.pipe(f.createInflateRaw()),l=new F(n,i),r(l)}))}})),function(t,e){const r=e.body;null===r?t.end():R(r)?r.stream().pipe(t):Buffer.isBuffer(r)?(t.write(r),t.end()):r.pipe(t)}(y,u)}))}tt.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},tt.Promise=v.Promise,t.exports=e=tt,Object.defineProperty(e,"__esModule",{value:!0}),e.default=e,e.Headers=_,e.Request=J,e.Response=F,e.FetchError=m})),Z=b((function(t,e){const r=W.default||W,n=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),r.call(this,t,e)};n.ponyfill=!0,t.exports=e=n,e.fetch=n,e.Headers=W.Headers,e.Request=W.Request,e.Response=W.Response,e.default=n}));const J=Z.fetch.bind({});J.polyfill=!0,v.fetch||(v.fetch=J,v.Response=Z.Response,v.Headers=Z.Headers,v.Request=Z.Request);var Y=b((function(t,e){!function(t){
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(){return(e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,e,r,n){return new(r||(r=Promise))((function(i,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){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,u)}a((n=n.apply(t,e||[])).next())}))}function n(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(s){return function(u){return function(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=o.trys,(i=i.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}}([s,u])}}}function i(t,e){for(var r=0,n=e.length,i=t.length;r<n;r++,i++)t[i]=e[r];return t}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){var e={exports:{}};return t(e,e.exports),e.exports}o((function(t){!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 f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(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=p(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=l(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?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=l(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(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}d.prototype.append=function(t,e){t=c(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,e){this.map[c(t)]=h(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),f(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(t)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function 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 d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function 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 d(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 d(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 d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;n(new 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=d,t.Request=w,t.Response=x),e.Headers=d,e.Request=w,e.Response=x,e.fetch=R,Object.defineProperty(e,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:s)}));var u=o((function(t,e){!function(t){
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

@@ -15,3 +28,3 @@ Permission to use, copy, modify, and/or distribute this software for any

***************************************************************************** */
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,r,n){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?r(t.value):i(t.value).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(t){return function(e){return a([t,e])}}function a(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var s=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error),u=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error);function a(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function c(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}var h=function(t){function e(r,n){var i=t.call(this,r)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error),l=function(t){function e(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,l),n}return r(e,t),e}(Error);function f(t){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new h(t.statusText,t);case 4:throw new l(e,t.status);case 5:return[2,t]}}))}))}function p(t){if("MeiliSearchApiError"!==t.type)throw new h(t.message,t);throw t}var d=function(){function t(t){this.headers=n(n(n({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,r=t.url,s=t.params,u=t.body,a=t.config;return i(this,void 0,void 0,(function(){var t,i,c;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),t=new URL(r,this.url),s&&(i=new URLSearchParams,Object.keys(s).filter((function(t){return null!==s[t]})).map((function(t){return i.set(t,s[t])})),t.search=i.toString()),[4,fetch(t.toString(),n(n({},a),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return f(t)}))];case 1:return[4,o.sent().text()];case 2:c=o.sent();try{return[2,JSON.parse(c)]}catch(t){return[2]}return[3,4];case 3:return p(o.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return i(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t}(),y=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new d(t)}return t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,n=r.timeOutMs,s=void 0===n?5e3:n,a=r.intervalMs,h=void 0===a?50:a;return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<s?[4,this.getUpdateStatus(t)]:[3,4];case 2:return r=n.sent(),["enqueued","processing"].includes(r.status)?[4,c(h)]:[2,r];case 3:return n.sent(),[3,1];case 4:throw new u("timeout of "+s+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.search=function(t,e,r){return i(this,void 0,void 0,(function(){var i;return o(this,(function(o){switch(o.label){case 0:return i="indexes/"+this.uid+"/search",[4,this.httpRequest.post(i,a(n(n({},e),{q:t})),void 0,r)];case 1:return[2,o.sent()]}}))}))},t.prototype.searchGet=function(t,e,r){return i(this,void 0,void 0,(function(){var i,u,c;return o(this,(function(o){switch(o.label){case 0:return i="indexes/"+this.uid+"/search",u=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new s("The filter query parameter should be in string format when using searchGet")},c=n(n({q:t},e),{filter:u(null==e?void 0:e.filter),facetsDistribution:(null==e?void 0:e.facetsDistribution)?e.facetsDistribution.join(","):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(i,a(c),r)];case 1:return[2,o.sent()]}}))}))},t.prototype.getRawInfo=function(){return i(this,void 0,void 0,(function(){var t,e;return o(this,(function(r){switch(r.label){case 0:return t="indexes/"+this.uid,[4,this.httpRequest.get(t)];case 1:return e=r.sent(),this.primaryKey=e.primaryKey,[2,e]}}))}))},t.prototype.fetchInfo=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(e,r,s){return void 0===s&&(s={}),i(this,void 0,void 0,(function(){var i,u;return o(this,(function(o){switch(o.label){case 0:return i="indexes",[4,new d(e).post(i,n(n({},s),{uid:r}))];case 1:return u=o.sent(),[2,new t(e,r,u.primaryKey)]}}))}))},t.prototype.update=function(t){return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return e="indexes/"+this.uid,[4,this.httpRequest.put(e,t)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid,[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.deleteIfExists=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.delete()];case 1:return e.sent(),[2,!0];case 2:if("index_not_found"===(t=e.sent()).errorCode)return[2,!1];throw t;case 3:return[2]}}))}))},t.prototype.getAllUpdateStatus=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid+"/updates",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getUpdateStatus=function(t){return i(this,void 0,void 0,(function(){var e;return o(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.getStats=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid+"/stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(t){return i(this,void 0,void 0,(function(){var e,r;return o(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.httpRequest.get(e,n(n({},t),void 0!==r?{attributesToRetrieve:r}:{}))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(t){return i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var r;return o(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 i(this,void 0,void 0,(function(){var r;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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.getFilterableAttributes=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid+"/settings/filterable-attributes",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e="indexes/"+this.uid+"/settings/filterable-attributes",[4,this.httpRequest.post(e,t)];case 1:return[2,r.sent()]}}))}))},t.prototype.resetFilterableAttributes=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid+"/settings/filterable-attributes",[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid+"/settings/searchable-attributes",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(t){return i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var e;return o(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 i(this,void 0,void 0,(function(){var t;return o(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}(),v=function(){function t(t){t.host=d.addTrailingSlash(t.host),this.config=t,this.httpRequest=new d(t)}return t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new y(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new l(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return i(this,void 0,void 0,(function(){var t;return o(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={}),i(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,y.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(r){return[2,new y(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new y(this.config,t).delete()]}))}))},t.prototype.deleteIndexIfExists=function(t){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return r.sent(),[2,!0];case 2:if("index_not_found"===(e=r.sent()).errorCode)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.getKeys=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="keys",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.health=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="health",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.isHealthy=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t="health",[4,this.httpRequest.get(t)];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.stats=function(){return i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var t;return o(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 i(this,void 0,void 0,(function(){var e;return o(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}();t.MeiliSearch=v,Object.defineProperty(t,"__esModule",{value:!0})}(e)})),X=function(t){return t.replace(/:(.*)/i,'="$1"')},Q=function(t,e){var r=t.query,n=t.facets,i=t.facetFilters,o=t.attributesToSnippet,s=t.attributesToRetrieve,u=t.attributesToHighlight,a=t.filters,c=void 0===a?"":a,h=t.numericFilters,l=void 0===h?[]:h,p=e.paginationTotalHits,d=e.placeholderSearch,v=p,b=function(t,e,r){var n=[r.join(" AND "),e.trim()].filter((function(t){return t})).join(" AND ").trim();return Array.isArray(t)&&n?y(y([],t),[[n]]):"string"==typeof t&&n?[t,[n]]:t}(function(t){return"string"==typeof t?X(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return X(t)})):X(t)})):[]}(i),c,l);return f(f(f(f(f({q:r},(null==n?void 0:n.length)&&{facetsDistribution:n}),o&&{attributesToCrop:o}),s&&{attributesToRetrieve:s}),b&&{filter:b}),{attributesToHighlight:u||["*"],limit:!d&&""===r||!v?0:v})},tt=function(t,e){var r=e.hitsPerPage;return r>0?Math.ceil(t/r):0},et=function(t,e){var r=e.page,n=e.hitsPerPage,i=r*n;return t.splice(i,n)};function rt(t){return"string"==typeof t||t instanceof String}var nt=function(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",rt(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)},it=function(t){var e=t.formattedHit,r=t.highlightPreTag,n=t.highlightPostTag;return Object.keys(e).reduce((function(t,i){return t[i]={value:nt(e[i],r,n)},t}),{})},ot=function(t,e,r,n){var i=t;return void 0!==e&&rt(i)&&i&&(i[0]===i[0].toLowerCase()&&!1===i.startsWith("<em>")&&(i=""+e+i),!1==!!i.match(/[.!?]$/)&&(i=""+i+e)),nt(i,r,n)},st=function(t){var e=t.formattedHit,r=t.attributesToSnippet,n=t.snippetEllipsisText,i=t.highlightPreTag,o=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,s){return r.includes(s)&&(t[s]={value:ot(e[s],n,i,o)}),t}),{}))},ut=function(t,e,r){var n=r.primaryKey;return et(t,r).map((function(t){if(Object.keys(t).length>0){var r=t._formatted;t._matchesInfo;var i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["_formatted","_matchesInfo"]);return f(f(f({},i),function(t,e){return!t||t.length?{}:{_highlightResult:it(f({formattedHit:t},e)),_snippetResult:st(f({formattedHit:t},e))}}(r,e)),n&&{objectID:t[n]})}return t}))},at=function(t,e,r,n){var i=e.exhaustiveFacetsCount,o=e.exhaustiveNbHits,s=e.facetsDistribution,u=e.nbHits,a=e.processingTimeMs,c=e.query,h=e.hits,l=n.hitsPerPage,p=n.page;return{results:[f(f(f({index:t,hitsPerPage:l},s&&{facets:s}),i&&{exhaustiveFacetsCount:i}),{page:p,nbPages:tt(h.length,n),exhaustiveNbHits:o,nbHits:u,processingTimeMS:a,query:c,hits:ut(h,r,n)})]}},ct=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[void 0]},ht=function(t){var e=function(t){return"string"==typeof t?ct(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return ct(t)})):ct(t)})).flat(2):[void 0]}(t);return e.filter((function(t){return void 0!==t})).reduce((function(t,e){var r,n=e.filterName,i=e.value,o=t[n]||[];return t=f(f({},t),((r={})[n]=y(y([],o),[i]),r))}),{})};t.adaptToISHits=ut,t.adaptToISResponse=at,t.adaptToMeiliSearchParams=Q,t.createHighlighResult=it,t.createSnippetResult=st,t.getNumberPages=tt,t.instantMeiliSearch=function(t,e,r){return void 0===r&&(r={}),{MeiliSearchClient:new Y.MeiliSearch({host:t,apiKey:e}),search:function(t){return p(this,void 0,void 0,(function(){var e,n,i,o,s,u,a,c,h,l,f,p,y,v;return d(this,(function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),e=t[0],n=e.params,i=e.indexName,o=r.paginationTotalHits,s=r.primaryKey,u=r.placeholderSearch,a=n.page,c=n.hitsPerPage,h=this.MeiliSearchClient,f=Q(n,l={client:h,paginationTotalHits:o||200,primaryKey:s||void 0,placeholderSearch:!1!==u,hitsPerPage:void 0===c?20:c,page:a||0}),p=ht(f.filter),[4,h.index(i).search(f.q,f)];case 1:return(y=d.sent()).facetsDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var r in t)for(var n=0,i=t[r];n<i.length;n++){var o=i[n];e[r]&&Object.keys(e[r]).includes(o)||(e[r]=e[r]||{},e[r][o]=0)}return e}(p,y.facetsDistribution),[2,at(i,y,n,l)];case 2:throw v=d.sent(),console.error(v),new Error(v);case 3:return[2]}}))}))}}},t.isString=rt,t.paginateHits=et,t.replaceHighlightTags=nt,t.snippetValue=ot,Object.defineProperty(t,"__esModule",{value:!0})}));
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,r,n){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,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 s(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 o=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error),u=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error);function a(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function c(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}var h=function(t){function e(r,n){var i=t.call(this,r)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error),f=function(t){function e(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,f),n}return r(e,t),e}(Error);function d(t){return i(this,void 0,void 0,(function(){var e;return s(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new h(t.statusText,t);case 4:throw new f(e,t.status);case 5:return[2,t]}}))}))}function l(t){if("MeiliSearchApiError"!==t.type)throw new h(t.message,t);throw t}var p=function(){function t(t){this.headers=n(n(n({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,r=t.url,o=t.params,u=t.body,a=t.config;return i(this,void 0,void 0,(function(){var t,i,c;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),t=new URL(r,this.url),o&&(i=new URLSearchParams,Object.keys(o).filter((function(t){return null!==o[t]})).map((function(t){return i.set(t,o[t])})),t.search=i.toString()),[4,fetch(t.toString(),n(n({},a),{method:e,body:JSON.stringify(u),headers:this.headers})).then((function(t){return d(t)}))];case 1:return[4,s.sent().text()];case 2:c=s.sent();try{return[2,JSON.parse(c)]}catch(t){return[2]}return[3,4];case 3:return l(s.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,n){return i(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,r,n){return i(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,r,n){return i(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t}(),y=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new p(t)}return t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,n=r.timeOutMs,o=void 0===n?5e3:n,a=r.intervalMs,h=void 0===a?50:a;return i(this,void 0,void 0,(function(){var e,r;return s(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<o?[4,this.getUpdateStatus(t)]:[3,4];case 2:return r=n.sent(),["enqueued","processing"].includes(r.status)?[4,c(h)]:[2,r];case 3:return n.sent(),[3,1];case 4:throw new u("timeout of "+o+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.search=function(t,e,r){return i(this,void 0,void 0,(function(){var i;return s(this,(function(s){switch(s.label){case 0:return i="indexes/"+this.uid+"/search",[4,this.httpRequest.post(i,a(n(n({},e),{q:t})),void 0,r)];case 1:return[2,s.sent()]}}))}))},t.prototype.searchGet=function(t,e,r){return i(this,void 0,void 0,(function(){var i,u,c;return s(this,(function(s){switch(s.label){case 0:return i="indexes/"+this.uid+"/search",u=function(t){if("string"==typeof t)return t;if(Array.isArray(t))throw new o("The filter query parameter should be in string format when using searchGet")},c=n(n({q:t},e),{filter:u(null==e?void 0:e.filter),facetsDistribution:(null==e?void 0:e.facetsDistribution)?e.facetsDistribution.join(","):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(i,a(c),r)];case 1:return[2,s.sent()]}}))}))},t.prototype.getRawInfo=function(){return i(this,void 0,void 0,(function(){var t,e;return s(this,(function(r){switch(r.label){case 0:return t="indexes/"+this.uid,[4,this.httpRequest.get(t)];case 1:return e=r.sent(),this.primaryKey=e.primaryKey,[2,e]}}))}))},t.prototype.fetchInfo=function(){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(e,r,o){return void 0===o&&(o={}),i(this,void 0,void 0,(function(){var i,u;return s(this,(function(s){switch(s.label){case 0:return i="indexes",[4,new p(e).post(i,n(n({},o),{uid:r}))];case 1:return u=s.sent(),[2,new t(e,r,u.primaryKey)]}}))}))},t.prototype.update=function(t){return i(this,void 0,void 0,(function(){var e,r;return s(this,(function(n){switch(n.label){case 0:return e="indexes/"+this.uid,[4,this.httpRequest.put(e,t)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return i(this,void 0,void 0,(function(){var t;return s(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.deleteIfExists=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.delete()];case 1:return e.sent(),[2,!0];case 2:if("index_not_found"===(t=e.sent()).errorCode)return[2,!1];throw t;case 3:return[2]}}))}))},t.prototype.getAllUpdateStatus=function(){return i(this,void 0,void 0,(function(){var t;return s(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.getUpdateStatus=function(t){return i(this,void 0,void 0,(function(){var e;return s(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.getStats=function(){return i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e,r;return s(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.httpRequest.get(e,n(n({},t),void 0!==r?{attributesToRetrieve:r}:{}))];case 1:return[2,i.sent()]}}))}))},t.prototype.getDocument=function(t){return i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var r;return s(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 i(this,void 0,void 0,(function(){var r;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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.getFilterableAttributes=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid+"/settings/filterable-attributes",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.updateFilterableAttributes=function(t){return i(this,void 0,void 0,(function(){var e;return s(this,(function(r){switch(r.label){case 0:return e="indexes/"+this.uid+"/settings/filterable-attributes",[4,this.httpRequest.post(e,t)];case 1:return[2,r.sent()]}}))}))},t.prototype.resetFilterableAttributes=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="indexes/"+this.uid+"/settings/filterable-attributes",[4,this.httpRequest.delete(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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 i(this,void 0,void 0,(function(){var t;return s(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}(),v=function(){function t(t){t.host=p.addTrailingSlash(t.host),this.config=t,this.httpRequest=new p(t)}return t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new y(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){var r;return s(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new f(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return i(this,void 0,void 0,(function(){var t;return s(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={}),i(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return[4,y.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return s(this,(function(r){return[2,new y(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){return[2,new y(this.config,t).delete()]}))}))},t.prototype.deleteIndexIfExists=function(t){return i(this,void 0,void 0,(function(){var e;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.deleteIndex(t)];case 1:return r.sent(),[2,!0];case 2:if("index_not_found"===(e=r.sent()).errorCode)return[2,!1];throw e;case 3:return[2]}}))}))},t.prototype.getKeys=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="keys",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.health=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return t="health",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.isHealthy=function(){return i(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t="health",[4,this.httpRequest.get(t)];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.stats=function(){return i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var t;return s(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 i(this,void 0,void 0,(function(){var e;return s(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}();t.MeiliSearch=v,Object.defineProperty(t,"__esModule",{value:!0})}(e)})),a=function(t){return t.replace(/:(.*)/i,'="$1"')},c=function(t,r){var n=t.query,s=t.facets,o=t.facetFilters,u=t.attributesToSnippet,c=t.attributesToRetrieve,h=t.attributesToHighlight,f=t.filters,d=void 0===f?"":f,l=t.numericFilters,p=void 0===l?[]:l,y=r.paginationTotalHits,v=r.placeholderSearch,b=y,g=function(t,e,r){var n=[r.join(" AND "),e.trim()].filter((function(t){return t})).join(" AND ").trim();return Array.isArray(t)&&n?i(i([],t),[[n]]):"string"==typeof t&&n?[t,[n]]:t}(function(t){return"string"==typeof t?a(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return a(t)})):a(t)})):[]}(o),d,p);return e(e(e(e(e({q:n},(null==s?void 0:s.length)&&{facetsDistribution:s}),u&&{attributesToCrop:u}),c&&{attributesToRetrieve:c}),g&&{filter:g}),{attributesToHighlight:h||["*"],limit:!v&&""===n||!b?0:b})},h=function(t,e){var r=e.hitsPerPage;return r>0?Math.ceil(t/r):0},f=function(t,e){var r=e.page,n=e.hitsPerPage,i=r*n;return t.splice(i,n)};function d(t){return"string"==typeof t||t instanceof String}var l=function(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",d(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)},p=function(t){var e=t.formattedHit,r=t.highlightPreTag,n=t.highlightPostTag;return Object.keys(e).reduce((function(t,i){return t[i]={value:l(e[i],r,n)},t}),{})},y=function(t,e,r,n){var i=t;return void 0!==e&&d(i)&&i&&(i[0]===i[0].toLowerCase()&&!1===i.startsWith("<em>")&&(i=""+e+i),!1==!!i.match(/[.!?]$/)&&(i=""+i+e)),l(i,r,n)},v=function(t){var e=t.formattedHit,r=t.attributesToSnippet,n=t.snippetEllipsisText,i=t.highlightPreTag,s=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,o){return r.includes(o)&&(t[o]={value:y(e[o],n,i,s)}),t}),{}))},b=function(t,r,n){var i=n.primaryKey;return f(t,n).map((function(t){if(Object.keys(t).length>0){var n=t._formatted;t._matchesInfo;var s=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["_formatted","_matchesInfo"]);return e(e(e({},s),function(t,r){return!t||t.length?{}:{_highlightResult:p(e({formattedHit:t},r)),_snippetResult:v(e({formattedHit:t},r))}}(n,r)),i&&{objectID:t[i]})}return t}))},g=function(t,r,n,i){var s=r.exhaustiveFacetsCount,o=r.exhaustiveNbHits,u=r.facetsDistribution,a=r.nbHits,c=r.processingTimeMs,f=r.query,d=r.hits,l=i.hitsPerPage,p=i.page;return{results:[e(e(e({index:t,hitsPerPage:l},u&&{facets:u}),s&&{exhaustiveFacetsCount:s}),{page:p,nbPages:h(d.length,i),exhaustiveNbHits:o,nbHits:a,processingTimeMS:c,query:f,hits:b(d,n,i)})]}},w=function(t){var e=t.match(/([^=]*)="?([^\\"]*)"?$/);return e?(e[0],[{filterName:e[1],value:e[2]}]):[void 0]},m=function(t){var r=function(t){return"string"==typeof t?w(t):Array.isArray(t)?t.map((function(t){return Array.isArray(t)?t.map((function(t){return w(t)})):w(t)})).flat(2):[void 0]}(t);return r.filter((function(t){return void 0!==t})).reduce((function(t,r){var n,s=r.filterName,o=r.value,u=t[s]||[];return t=e(e({},t),((n={})[s]=i(i([],u),[o]),n))}),{})};t.adaptToISHits=b,t.adaptToISResponse=g,t.adaptToMeiliSearchParams=c,t.createHighlighResult=p,t.createSnippetResult=v,t.getNumberPages=h,t.instantMeiliSearch=function(t,e,i){return void 0===i&&(i={}),{MeiliSearchClient:new u.MeiliSearch({host:t,apiKey:e}),search:function(t){return r(this,void 0,void 0,(function(){var e,r,s,o,u,a,h,f,d,l,p,y,v,b;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),e=t[0],r=e.params,s=e.indexName,o=i.paginationTotalHits,u=i.primaryKey,a=i.placeholderSearch,h=r.page,f=r.hitsPerPage,d=this.MeiliSearchClient,p=c(r,l={client:d,paginationTotalHits:o||200,primaryKey:u||void 0,placeholderSearch:!1!==a,hitsPerPage:void 0===f?20:f,page:h||0}),y=m(p.filter),[4,d.index(s).search(p.q,p)];case 1:return(v=n.sent()).facetsDistribution=function(t,e){if(e=e||{},t&&Object.keys(t).length>0)for(var r in t)for(var n=0,i=t[r];n<i.length;n++){var s=i[n];e[r]&&Object.keys(e[r]).includes(s)||(e[r]=e[r]||{},e[r][s]=0)}return e}(y,v.facetsDistribution),[2,g(s,v,r,l)];case 2:throw b=n.sent(),console.error(b),new Error(b);case 3:return[2]}}))}))}}},t.isString=d,t.paginateHits=f,t.replaceHighlightTags=l,t.snippetValue=y,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=instant-meilisearch.umd.min.js.map

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

// Type definitions for @meilisearch/instant-meilisearch 0.5.1
// Type definitions for @meilisearch/instant-meilisearch 0.5.2
// Project: https://github.com/meilisearch/instant-meilisearch.git

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

{
"name": "@meilisearch/instant-meilisearch",
"version": "0.5.1",
"version": "0.5.2",
"private": false,

@@ -9,7 +9,8 @@ "description": "The search client to use MeiliSearch with InstantSearch.",

"test:watch": "yarn test --watch",
"test": "jest --runInBand",
"test": "jest --runInBand --selectProjects dom --selectProjects node",
"test:build": "yarn build && jest --runInBand --selectProjects build",
"test:e2e": "concurrently --kill-others -s first \"NODE_ENV=test yarn playground:javascript\" \"cypress run --env playground=javascript\"",
"test:e2e:all": "sh scripts/e2e.sh",
"test:e2e:watch": "concurrently --kill-others -s first \"NODE_ENV=test yarn playground:javascript\" \"cypress open --env playground=javascript\"",
"test:all": "yarn test:e2e:all && yarn test",
"test:all": "yarn test:e2e:all && yarn test && test:build",
"playground:vue": "yarn --cwd ./playgrounds/vue && yarn --cwd ./playgrounds/vue serve",

@@ -63,3 +64,2 @@ "playground:react": "yarn --cwd ./playgrounds/react && yarn --cwd ./playgrounds/react start",

"@rollup/plugin-node-resolve": "^11.2.0",
"@rollup/plugin-typescript": "^8.2.5",
"@typescript-eslint/eslint-plugin": "^4.16.1",

@@ -91,3 +91,2 @@ "@typescript-eslint/parser": "^4.16.1",

"jest": "^26.6.3",
"jest-environment-jsdom": "25.5",
"jest-watch-typeahead": "^0.6.3",

@@ -98,3 +97,5 @@ "prettier": "^2.0.0",

"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-terser": "^7.0.0",
"rollup-plugin-typescript2": "^0.30.0",
"shx": "^0.3.3",

@@ -101,0 +102,0 @@ "ts-jest": "^26.5.2",

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