typesense-instantsearch-adapter 2.3.1-0 → 2.4.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -90,13 +90,13 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
|
|
|
90
90
|
protocol: "http",
|
|
91
91
|
},
|
|
92
92
|
],
|
|
93
|
+
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
93
94
|
},
|
|
94
|
-
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
95
95
|
// The following parameters are directly passed to Typesense's search API endpoint.
|
|
96
96
|
// So you can pass any parameters supported by the search endpoint below.
|
|
97
|
-
//
|
|
97
|
+
// query_by is required.
|
|
98
98
|
additionalSearchParameters: {
|
|
99
|
-
|
|
99
|
+
query_by: "name,description,categories",
|
|
100
100
|
},
|
|
101
101
|
});
|
|
102
102
|
const searchClient = typesenseInstantsearchAdapter.searchClient;
|
|
@@ -146,13 +146,13 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
|
|
|
146
146
|
protocol: "http",
|
|
147
147
|
},
|
|
148
148
|
],
|
|
149
|
+
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
149
150
|
},
|
|
150
|
-
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
151
151
|
// The following parameters are directly passed to Typesense's search API endpoint.
|
|
152
152
|
// So you can pass any parameters supported by the search endpoint below.
|
|
153
|
-
//
|
|
153
|
+
// query_by is required.
|
|
154
154
|
additionalSearchParameters: {
|
|
155
|
-
|
|
155
|
+
query_by: "name,description,categories",
|
|
156
156
|
},
|
|
157
157
|
});
|
|
158
158
|
const searchClient = typesenseInstantsearchAdapter.searchClient;
|
|
@@ -196,13 +196,13 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
|
|
|
196
196
|
protocol: "http",
|
|
197
197
|
},
|
|
198
198
|
],
|
|
199
|
+
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
199
200
|
},
|
|
200
|
-
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
201
201
|
// The following parameters are directly passed to Typesense's search API endpoint.
|
|
202
202
|
// So you can pass any parameters supported by the search endpoint below.
|
|
203
|
-
//
|
|
203
|
+
// query_by is required.
|
|
204
204
|
additionalSearchParameters: {
|
|
205
|
-
|
|
205
|
+
query_by: "name,description,categories",
|
|
206
206
|
},
|
|
207
207
|
});
|
|
208
208
|
const searchClient = typesenseInstantsearchAdapter.searchClient;
|
|
@@ -236,13 +236,13 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
|
|
|
236
236
|
protocol: "http",
|
|
237
237
|
},
|
|
238
238
|
],
|
|
239
|
+
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
239
240
|
},
|
|
240
|
-
cacheSearchResultsForSeconds: 2 * 60, // Cache search results from server. Defaults to 2 minutes. Set to 0 to disable caching.
|
|
241
241
|
// The following parameters are directly passed to Typesense's search API endpoint.
|
|
242
242
|
// So you can pass any parameters supported by the search endpoint below.
|
|
243
|
-
//
|
|
243
|
+
// query_by is required.
|
|
244
244
|
additionalSearchParameters: {
|
|
245
|
-
|
|
245
|
+
query_by: "name,description,categories",
|
|
246
246
|
},
|
|
247
247
|
});
|
|
248
248
|
const searchClient = typesenseInstantsearchAdapter.searchClient;
|
|
@@ -316,10 +316,10 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
|
|
|
316
316
|
// Search parameters that need to be *overridden* on a per-collection-basis go here:
|
|
317
317
|
collectionSpecificSearchParameters: {
|
|
318
318
|
products: {
|
|
319
|
-
|
|
319
|
+
query_by: "name,description,categories",
|
|
320
320
|
},
|
|
321
321
|
brands: {
|
|
322
|
-
|
|
322
|
+
query_by: "name",
|
|
323
323
|
},
|
|
324
324
|
},
|
|
325
325
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TypesenseInstantSearchAdapter=t():e.TypesenseInstantSearchAdapter=t()}(self,(function(){return(()=>{var e={7757:(e,t,r)=>{e.exports=r(5666)},9669:(e,t,r)=>{e.exports=r(1609)},5448:(e,t,r)=>{"use strict";var n=r(4867),i=r(6026),s=r(4372),o=r(5327),a=r(4097),c=r(4109),u=r(7985),l=r(5061);e.exports=function(e){return new Promise((function(t,r){var h=e.data,d=e.headers,f=e.responseType;n.isFormData(h)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var y=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(y+":"+m)}var v=a(e.baseURL,e.url);function g(){if(p){var n="getAllResponseHeaders"in p?c(p.getAllResponseHeaders()):null,s={data:f&&"text"!==f&&"json"!==f?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};i(t,r,s),p=null}}if(p.open(e.method.toUpperCase(),o(v,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(r(l("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){r(l("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var w=(e.withCredentials||u(v))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;w&&(d[e.xsrfHeaderName]=w)}"setRequestHeader"in p&&n.forEach(d,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),f&&"json"!==f&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),r(e),p=null)})),h||(h=null),p.send(h)}))}},1609:(e,t,r)=>{"use strict";var n=r(4867),i=r(1849),s=r(321),o=r(7185);function a(e){var t=new s(e),r=i(s.prototype.request,t);return n.extend(r,s.prototype,t),n.extend(r,t),r}var c=a(r(5655));c.Axios=s,c.create=function(e){return a(o(c.defaults,e))},c.Cancel=r(5263),c.CancelToken=r(4972),c.isCancel=r(6502),c.all=function(e){return Promise.all(e)},c.spread=r(8713),c.isAxiosError=r(6268),e.exports=c,e.exports.default=c},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,r)=>{"use strict";var n=r(5263);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(4867),i=r(5327),s=r(782),o=r(3572),a=r(7185),c=r(4875),u=c.validators;function l(e){this.defaults=e,this.interceptors={request:new s,response:new s}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&c.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var i,s=[];if(this.interceptors.response.forEach((function(e){s.push(e.fulfilled,e.rejected)})),!n){var l=[o,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(s),i=Promise.resolve(e);l.length;)i=i.then(l.shift(),l.shift());return i}for(var h=e;r.length;){var d=r.shift(),f=r.shift();try{h=d(h)}catch(e){f(e);break}}try{i=o(h)}catch(e){return Promise.reject(e)}for(;s.length;)i=i.then(s.shift(),s.shift());return i},l.prototype.getUri=function(e){return e=a(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=l},782:(e,t,r)=>{"use strict";var n=r(4867);function i(){this.handlers=[]}i.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},4097:(e,t,r)=>{"use strict";var n=r(1793),i=r(7303);e.exports=function(e,t){return e&&!n(t)?i(e,t):t}},5061:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,i,s){var o=new Error(e);return n(o,t,r,i,s)}},3572:(e,t,r)=>{"use strict";var n=r(4867),i=r(8527),s=r(6502),o=r(5655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return a(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(a(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},7185:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){t=t||{};var r={},i=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function u(i){n.isUndefined(t[i])?n.isUndefined(e[i])||(r[i]=c(void 0,e[i])):r[i]=c(e[i],t[i])}n.forEach(i,(function(e){n.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),n.forEach(s,u),n.forEach(o,(function(i){n.isUndefined(t[i])?n.isUndefined(e[i])||(r[i]=c(void 0,e[i])):r[i]=c(void 0,t[i])})),n.forEach(a,(function(n){n in t?r[n]=c(e[n],t[n]):n in e&&(r[n]=c(void 0,e[n]))}));var l=i.concat(s).concat(o).concat(a),h=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(h,u),r}},6026:(e,t,r)=>{"use strict";var n=r(5061);e.exports=function(e,t,r){var i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},8527:(e,t,r)=>{"use strict";var n=r(4867),i=r(5655);e.exports=function(e,t,r){var s=this||i;return n.forEach(r,(function(r){e=r.call(s,e,t)})),e}},5655:(e,t,r)=>{"use strict";var n=r(4867),i=r(6016),s=r(481),o={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(c=r(5448)),c),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||i&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw s(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(o)})),e.exports=u},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},5327:(e,t,r)=>{"use strict";var n=r(4867);function i(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(n.isURLSearchParams(t))s=t.toString();else{var o=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),o.push(i(t)+"="+i(e))})))})),s=o.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},7303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},4372:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,i,s,o){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(i)&&a.push("path="+i),n.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=n.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},6016:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},4109:(e,t,r)=>{"use strict";var n=r(4867),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,o={};return e?(n.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=n.trim(e.substr(0,s)).toLowerCase(),r=n.trim(e.substr(s+1)),t){if(o[t]&&i.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([r]):o[t]?o[t]+", "+r:r}})),o):o}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:(e,t,r)=>{"use strict";var n=r(8593),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var s={},o=n.version.split(".");function a(e,t){for(var r=t?t.split("."):o,n=e.split("."),i=0;i<3;i++){if(r[i]>n[i])return!0;if(r[i]<n[i])return!1}return!1}i.transitional=function(e,t,r){var i=t&&a(t);function o(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,a){if(!1===e)throw new Error(o(n," has been removed in "+t));return i&&!s[n]&&(s[n]=!0,console.warn(o(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),i=n.length;i-- >0;){var s=n[i],o=t[s];if(o){var a=e[s],c=void 0===a||o(a,s,e);if(!0!==c)throw new TypeError("option "+s+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+s)}},validators:i}},4867:(e,t,r)=>{"use strict";var n=r(1849),i=Object.prototype.toString;function s(e){return"[object Array]"===i.call(e)}function o(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===i.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===i.call(e)},isBuffer:function(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:c,isUndefined:o,isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function e(){var t={};function r(r,n){c(t[n])&&c(r)?t[n]=e(t[n],r):c(r)?t[n]=e({},r):s(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},2043:function(e,t,r){var n,i;!function(s,o){"use strict";void 0===(i="function"==typeof(n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function i(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function o(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?s:void 0!==console[n]?i(console,n):void 0!==console.log?i(console,"log"):e)}function a(t,r){for(var i=0;i<n.length;i++){var s=n[i];this[s]=i<t?e:this.methodFactory(s,t,r)}this.log=this.debug}function c(e,r,n){return function(){typeof console!==t&&(a.call(this,r,n),this[e].apply(this,arguments))}}function u(e,t,r){return o(e)||c.apply(this,arguments)}function l(e,r,i){var s,o=this;r=null==r?"WARN":r;var c="loglevel";function l(){var e;if(typeof window!==t&&c){try{e=window.localStorage[c]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(c)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===o.levels[e]&&(e=void 0),e}}"string"==typeof e?c+=":"+e:"symbol"==typeof e&&(c=void 0),o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=i||u,o.getLevel=function(){return s},o.setLevel=function(r,i){if("string"==typeof r&&void 0!==o.levels[r.toUpperCase()]&&(r=o.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=o.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(s=r,!1!==i&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&c){try{return void(window.localStorage[c]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+r+";"}catch(e){}}}(r),a.call(o,r,e),typeof console===t&&r<o.levels.SILENT)return"No console available for logging"},o.setDefaultLevel=function(e){r=e,l()||o.setLevel(e,!1)},o.resetLevel=function(){o.setLevel(r,!1),function(){if(typeof window!==t&&c){try{return void window.localStorage.removeItem(c)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}()},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)};var h=l();null==h&&(h=r),o.setLevel(h,!1)}var h=new l,d={};h.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=d[e];return t||(t=d[e]=new l(e,h.getLevel(),h.methodFactory)),t};var f=typeof window!==t?window.log:void 0;return h.noConflict=function(){return typeof window!==t&&window.log===h&&(window.log=f),h},h.getLoggers=function(){return d},h.default=h,h})?n.call(t,r,t,e):n)||(e.exports=i)}()},5666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,s=Object.create(i.prototype),o=new x(n||[]);return s._invoke=function(e,t,r){var n=h;return function(i,s){if(n===f)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw s;return N()}for(r.method=i,r.arg=s;;){var o=r.delegate;if(o){var a=O(o,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var c=l(e,t,r);if("normal"===c.type){if(n=r.done?p:d,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=p,r.method="throw",r.arg=c.arg)}}}(e,r,o),s}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",f="executing",p="completed",y={};function m(){}function v(){}function g(){}var w={};c(w,s,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(j([])));b&&b!==r&&n.call(b,s)&&(w=b);var S=g.prototype=m.prototype=Object.create(w);function P(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function r(i,s,o,a){var c=l(e[i],e,s);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,o,a)}),(function(e){r("throw",e,o,a)})):t.resolve(h).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,a)}))}a(c.arg)}var i;this._invoke=function(e,n){function s(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(s,s):s()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var s=i.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function j(e){if(e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:N}}function N(){return{value:t,done:!0}}return v.prototype=g,c(S,"constructor",g),c(g,"constructor",v),v.displayName=c(g,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,a,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},P(C.prototype),c(C.prototype,o,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,i,s){void 0===s&&(s=Promise);var o=new C(u(t,r,n,i),s);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},P(S),c(S,a,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=j,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return a.type="throw",a.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},8871:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=t.SearchClient=t.Client=void 0;const a=o(r(4339));t.Client=a.default;const c=o(r(8834));t.SearchClient=c.default;const u=s(r(6718));t.Errors=u,t.default={Client:a.default,SearchClient:c.default,Errors:u}},8480:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(5346));t.default=class{constructor(e,t){this.name=e,this.apiCall=t}async retrieve(){return await this.apiCall.get(this.endpointPath())}async delete(){return await this.apiCall.delete(this.endpointPath())}endpointPath(){return`${i.default.RESOURCEPATH}/${this.name}`}}},5346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r="/aliases";class n{constructor(e){this.apiCall=e}async upsert(e,t){return await this.apiCall.put(this.endpointPath(e),t)}async retrieve(){return await this.apiCall.get(r)}endpointPath(e){return`${n.RESOURCEPATH}/${e}`}static get RESOURCEPATH(){return r}}t.default=n},9777:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(9669)),s=r(6718),o=n(r(4492)),a=!0;t.default=class{constructor(e){this.configuration=e,this.apiKey=this.configuration.apiKey,this.nodes=JSON.parse(JSON.stringify(this.configuration.nodes)),this.nearestNode=JSON.parse(JSON.stringify(this.configuration.nearestNode)),this.connectionTimeoutSeconds=this.configuration.connectionTimeoutSeconds,this.healthcheckIntervalSeconds=this.configuration.healthcheckIntervalSeconds,this.numRetriesPerRequest=this.configuration.numRetries,this.retryIntervalSeconds=this.configuration.retryIntervalSeconds,this.sendApiKeyAsQueryParam=this.configuration.sendApiKeyAsQueryParam,this.additionalUserHeaders=this.configuration.additionalHeaders,this.logger=this.configuration.logger,this.initializeMetadataForNodes(),this.currentNodeIndex=-1}get(e,t={},{abortSignal:r=null,responseType:n=null}={}){return this.performRequest("get",e,{queryParameters:t,abortSignal:r,responseType:n})}delete(e,t={}){return this.performRequest("delete",e,{queryParameters:t})}post(e,t={},r={},n={}){return this.performRequest("post",e,{queryParameters:r,bodyParameters:t,additionalHeaders:n})}put(e,t={},r={}){return this.performRequest("put",e,{queryParameters:r,bodyParameters:t})}patch(e,t={},r={}){return this.performRequest("patch",e,{queryParameters:r,bodyParameters:t})}async performRequest(e,t,{queryParameters:r=null,bodyParameters:n=null,additionalHeaders:s={},abortSignal:o=null,responseType:c=null}){var u,l,h;this.configuration.validate();const d=Date.now();let f;this.logger.debug(`Request #${d}: Performing ${e.toUpperCase()} request: ${t}`);for(let p=1;p<=this.numRetriesPerRequest+1;p++){let y,m=this.getNextNode(d);if(this.logger.debug(`Request #${d}: Attempting ${e.toUpperCase()} request Try #${p} to Node ${m.index}`),o&&o.aborted)return Promise.reject(new Error("Request aborted by caller."));try{let h={method:e,url:this.uriFor(t,m),headers:Object.assign({},this.defaultHeaders(),s,this.additionalUserHeaders),timeout:1e3*this.connectionTimeoutSeconds,maxContentLength:1/0,maxBodyLength:1/0,responseType:c,validateStatus:e=>e>0,transformResponse:[(e,t)=>{let r=e;return void 0!==t&&"string"==typeof e&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(r=JSON.parse(e)),r}]};if(r&&0!==Object.keys(r).length&&(h.params=r),this.sendApiKeyAsQueryParam&&(h.params=h.params||{},h.params["x-typesense-api-key"]=this.apiKey),n&&("string"==typeof n&&0!==n.length||"object"==typeof n&&0!==Object.keys(n).length)&&(h.data=n),o){const e=i.default.CancelToken.source();y=()=>e.cancel(),o.addEventListener("abort",y),h.cancelToken=e.token}let f=await i.default(h);if(f.status>=1&&f.status<=499&&this.setNodeHealthcheck(m,a),this.logger.debug(`Request #${d}: Request to Node ${m.index} was made. Response Code was ${f.status}.`),f.status>=200&&f.status<300)return Promise.resolve(f.data);if(f.status<500)return Promise.reject(this.customErrorForResponse(f,null===(u=f.data)||void 0===u?void 0:u.message));throw this.customErrorForResponse(f,null===(l=f.data)||void 0===l?void 0:l.message)}catch(e){this.setNodeHealthcheck(m,!1),f=e,this.logger.warn(`Request #${d}: Request to Node ${m.index} failed due to "${e.code} ${e.message}${null==e.response?"":" - "+JSON.stringify(null===(h=e.response)||void 0===h?void 0:h.data)}"`),this.logger.warn(`Request #${d}: Sleeping for ${this.retryIntervalSeconds}s and then retrying request...`),await this.timer(this.retryIntervalSeconds)}finally{o&&y&&o.removeEventListener("abort",y)}}return this.logger.debug(`Request #${d}: No retries left. Raising last error`),Promise.reject(f)}getNextNode(e=0){if(null!=this.nearestNode){if(this.logger.debug(`Request #${e}: Nodes Health: Node ${this.nearestNode.index} is ${!0===this.nearestNode.isHealthy?"Healthy":"Unhealthy"}`),!0===this.nearestNode.isHealthy||this.nodeDueForHealthcheck(this.nearestNode,e))return this.logger.debug(`Request #${e}: Updated current node to Node ${this.nearestNode.index}`),this.nearestNode;this.logger.debug(`Request #${e}: Falling back to individual nodes`)}let t;this.logger.debug(`Request #${e}: Nodes Health: ${this.nodes.map((e=>`Node ${e.index} is ${!0===e.isHealthy?"Healthy":"Unhealthy"}`)).join(" || ")}`);for(let r=0;r<=this.nodes.length;r++)if(this.currentNodeIndex=(this.currentNodeIndex+1)%this.nodes.length,t=this.nodes[this.currentNodeIndex],!0===t.isHealthy||this.nodeDueForHealthcheck(t,e))return this.logger.debug(`Request #${e}: Updated current node to Node ${t.index}`),t;return this.logger.debug(`Request #${e}: No healthy nodes were found. Returning the next node, Node ${t.index}`),t}nodeDueForHealthcheck(e,t=0){const r=Date.now()-e.lastAccessTimestamp>1e3*this.healthcheckIntervalSeconds;return r&&this.logger.debug(`Request #${t}: Node ${e.index} has exceeded healtcheckIntervalSeconds of ${this.healthcheckIntervalSeconds}. Adding it back into rotation.`),r}initializeMetadataForNodes(){null!=this.nearestNode&&(this.nearestNode.index="nearestNode",this.setNodeHealthcheck(this.nearestNode,a)),this.nodes.forEach(((e,t)=>{e.index=t,this.setNodeHealthcheck(e,a)}))}setNodeHealthcheck(e,t){e.isHealthy=t,e.lastAccessTimestamp=Date.now()}uriFor(e,t){return null!=t.url?`${t.url}${e}`:`${t.protocol}://${t.host}:${t.port}${t.path}${e}`}defaultHeaders(){let e={};return this.sendApiKeyAsQueryParam||(e["X-TYPESENSE-API-KEY"]=this.apiKey),e["Content-Type"]="application/json",e}async timer(e){return new Promise((t=>setTimeout(t,1e3*e)))}customErrorForResponse(e,t){let r=`Request failed with HTTP code ${e.status}`;"string"==typeof t&&""!==t.trim()&&(r+=` | Server said: ${t}`);let n=new o.default(r);return n=400===e.status?new s.RequestMalformed(r):401===e.status?new s.RequestUnauthorized(r):404===e.status?new s.ObjectNotFound(r):409===e.status?new s.ObjectAlreadyExists(r):422===e.status?new s.ObjectUnprocessable(r):e.status>=500&&e.status<=599?new s.ServerError(r):new s.HTTPError(r),n.httpStatus=e.status,n}}},4339:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(2554)),s=n(r(9777)),o=n(r(6581)),a=n(r(8243)),c=n(r(5346)),u=n(r(8480)),l=n(r(2708)),h=n(r(7309)),d=n(r(7634)),f=n(r(6029)),p=n(r(1930)),y=n(r(3095)),m=n(r(9092));t.default=class{constructor(e){this.configuration=new i.default(e),this.apiCall=new s.default(this.configuration),this.debug=new d.default(this.apiCall),this.metrics=new f.default(this.apiCall),this.health=new p.default(this.apiCall),this.operations=new y.default(this.apiCall),this.multiSearch=new m.default(this.apiCall,this.configuration),this._collections=new o.default(this.apiCall),this.individualCollections={},this._aliases=new c.default(this.apiCall),this.individualAliases={},this._keys=new l.default(this.apiCall),this.individualKeys={}}collections(e){return void 0===e?this._collections:(void 0===this.individualCollections[e]&&(this.individualCollections[e]=new a.default(e,this.apiCall,this.configuration)),this.individualCollections[e])}aliases(e){return void 0===e?this._aliases:(void 0===this.individualAliases[e]&&(this.individualAliases[e]=new u.default(e,this.apiCall)),this.individualAliases[e])}keys(e){return void 0===e?this._keys:(void 0===this.individualKeys[e]&&(this.individualKeys[e]=new h.default(e,this.apiCall)),this.individualKeys[e])}}},8243:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(6581)),s=n(r(1949)),o=r(6718),a=n(r(6067)),c=n(r(3620)),u=n(r(1940)),l=n(r(1483)),h=r(9071);t.default=class{constructor(e,t,r){this.name=e,this.apiCall=t,this.configuration=r,this.individualDocuments={},this.individualOverrides={},this.individualSynonyms={},this.name=e,this.apiCall=t,this.configuration=r,this._documents=new s.default(this.name,this.apiCall,this.configuration),this._overrides=new a.default(this.name,this.apiCall),this._synonyms=new u.default(this.name,this.apiCall)}async retrieve(){return await this.apiCall.get(this.endpointPath())}async delete(){return await this.apiCall.delete(this.endpointPath())}async exists(){try{return await this.retrieve(),!0}catch(e){if(e instanceof o.ObjectNotFound)return!1;throw e}}documents(e){return e?(void 0===this.individualDocuments[e]&&(this.individualDocuments[e]=new h.Document(this.name,e,this.apiCall)),this.individualDocuments[e]):this._documents}overrides(e){return void 0===e?this._overrides:(void 0===this.individualOverrides[e]&&(this.individualOverrides[e]=new c.default(this.name,e,this.apiCall)),this.individualOverrides[e])}synonyms(e){return void 0===e?this._synonyms:(void 0===this.individualSynonyms[e]&&(this.individualSynonyms[e]=new l.default(this.name,e,this.apiCall)),this.individualSynonyms[e])}endpointPath(){return`${i.default.RESOURCEPATH}/${this.name}`}}},6581:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r="/collections";t.default=class{constructor(e){this.apiCall=e}async create(e){return await this.apiCall.post(r,e)}async retrieve(){return await this.apiCall.get(r)}static get RESOURCEPATH(){return r}}},2554:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const o=s(r(2043)),a=r(6718);t.default=class{constructor(e){this.nodes=e.nodes||[],this.nodes=this.nodes.map((e=>this.setDefaultPathInNode(e))).map((e=>this.setDefaultPortInNode(e))),this.nearestNode=e.nearestNode||null,this.nearestNode=this.setDefaultPathInNode(this.nearestNode),this.nearestNode=this.setDefaultPortInNode(this.nearestNode),this.connectionTimeoutSeconds=e.connectionTimeoutSeconds||e.timeoutSeconds||10,this.healthcheckIntervalSeconds=e.healthcheckIntervalSeconds||15,this.numRetries=e.numRetries||this.nodes.length+(null==this.nearestNode?0:1)||3,this.retryIntervalSeconds=e.retryIntervalSeconds||.1,this.apiKey=e.apiKey,this.sendApiKeyAsQueryParam=e.sendApiKeyAsQueryParam||!1,this.cacheSearchResultsForSeconds=e.cacheSearchResultsForSeconds||0,this.useServerSideSearchCache=e.useServerSideSearchCache||!1,this.logger=e.logger||o,this.logLevel=e.logLevel||"warn",this.logger.setLevel(this.logLevel),this.additionalHeaders=e.additionalHeaders,this.showDeprecationWarnings(e),this.validate()}validate(){if(null==this.nodes||0===this.nodes.length||this.validateNodes())throw new a.MissingConfigurationError("Ensure that nodes[].protocol, nodes[].host and nodes[].port are set");if(null!=this.nearestNode&&this.isNodeMissingAnyParameters(this.nearestNode))throw new a.MissingConfigurationError("Ensure that nearestNodes.protocol, nearestNodes.host and nearestNodes.port are set");if(null==this.apiKey)throw new a.MissingConfigurationError("Ensure that apiKey is set");return!0}validateNodes(){return this.nodes.some((e=>this.isNodeMissingAnyParameters(e)))}isNodeMissingAnyParameters(e){return!["protocol","host","port","path"].every((t=>e.hasOwnProperty(t)))&&null==e.url}setDefaultPathInNode(e){return null==e||e.hasOwnProperty("path")||(e.path=""),e}setDefaultPortInNode(e){if(null!=e&&!e.hasOwnProperty("port")&&e.hasOwnProperty("protocol"))switch(e.protocol){case"https":e.port=443;break;case"http":e.port=80}return e}showDeprecationWarnings(e){e.timeoutSeconds&&this.logger.warn("Deprecation warning: timeoutSeconds is now renamed to connectionTimeoutSeconds"),e.masterNode&&this.logger.warn("Deprecation warning: masterNode is now consolidated to nodes, starting with Typesense Server v0.12"),e.readReplicaNodes&&this.logger.warn("Deprecation warning: readReplicaNodes is now consolidated to nodes, starting with Typesense Server v0.12")}}},7634:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}async retrieve(){return await this.apiCall.get("/debug")}}},9071:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Document=void 0;const i=n(r(6581)),s=n(r(1949));t.Document=class{constructor(e,t,r){this.collectionName=e,this.documentId=t,this.apiCall=r}async retrieve(){return await this.apiCall.get(this.endpointPath())}async delete(){return await this.apiCall.delete(this.endpointPath())}async update(e,t={}){return await this.apiCall.patch(this.endpointPath(),e,t)}endpointPath(){return`${i.default.RESOURCEPATH}/${this.collectionName}${s.default.RESOURCEPATH}/${this.documentId}`}}},1949:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6718),i=r(5586);class s extends i.SearchOnlyDocuments{constructor(e,t,r){super(e,t,r)}async create(e,t={}){if(!e)throw new Error("No document provided");return await this.apiCall.post(this.endpointPath(),e,t)}upsert(e,t={}){if(!e)throw new Error("No document provided");return this.apiCall.post(this.endpointPath(),e,Object.assign({},t,{action:"upsert"}))}update(e,t={}){if(!e)throw new Error("No document provided");return this.apiCall.post(this.endpointPath(),e,Object.assign({},t,{action:"update"}))}delete(e={}){return"string"==typeof e?this.apiCall.delete(this.endpointPath(e),e):this.apiCall.delete(this.endpointPath(),e)}async createMany(e,t={}){return this.configuration.logger.warn("createMany is deprecated and will be removed in a future version. Use import instead, which now takes both an array of documents or a JSONL string of documents"),this.import(e,t)}async import(e,t={}){let r;if(Array.isArray(e))try{r=e.map((e=>JSON.stringify(e))).join("\n")}catch(e){if(RangeError instanceof e&&(null==e?void 0:e.includes("Too many properties to enumerate")))throw new Error(`${e}\n It looks like you have reached a Node.js limit that restricts the number of keys in an Object: https://stackoverflow.com/questions/9282869/are-there-limits-to-the-number-of-properties-in-a-javascript-object\n\n Please try reducing the number of keys in your document, or using CURL to import your data.\n `);throw new Error(e)}else r=e;const i=await this.apiCall.performRequest("post",this.endpointPath("import"),{queryParameters:t,bodyParameters:r,additionalHeaders:{"Content-Type":"text/plain"}});if(Array.isArray(e)){const e=i.split("\n").map((e=>JSON.parse(e))),t=e.filter((e=>!1===e.success));if(t.length>0)throw new n.ImportError(`${e.length-t.length} documents imported successfully, ${t.length} documents failed during import. Use \`error.importResults\` from the raised exception to get a detailed error reason for each document.`,e);return e}return i}async export(e={}){return this.apiCall.get(this.endpointPath("export"),e)}async exportStream(e={}){return this.apiCall.get(this.endpointPath("export"),e,{responseType:"stream"})}}t.default=s},7117:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},9229:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{constructor(e,t){super(e),this.importResults=t}}t.default=s},1254:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},4105:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},3836:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},220:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},4913:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},9976:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},4959:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(4492));class s extends i.default{}t.default=s},4492:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{}t.default=r},6718:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ImportError=t.TypesenseError=t.ServerError=t.RequestUnauthorized=t.RequestMalformed=t.ObjectUnprocessable=t.ObjectNotFound=t.ObjectAlreadyExists=t.MissingConfigurationError=t.HTTPError=void 0;const i=n(r(7117));t.HTTPError=i.default;const s=n(r(1254));t.MissingConfigurationError=s.default;const o=n(r(4105));t.ObjectAlreadyExists=o.default;const a=n(r(3836));t.ObjectNotFound=a.default;const c=n(r(220));t.ObjectUnprocessable=c.default;const u=n(r(4913));t.RequestMalformed=u.default;const l=n(r(9976));t.RequestUnauthorized=l.default;const h=n(r(4959));t.ServerError=h.default;const d=n(r(9229));t.ImportError=d.default;const f=n(r(4492));t.TypesenseError=f.default},1930:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}async retrieve(){return await this.apiCall.get("/health")}}},7309:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(2708));t.default=class{constructor(e,t){this.id=e,this.apiCall=t}async retrieve(){return await this.apiCall.get(this.endpointPath())}async delete(){return await this.apiCall.delete(this.endpointPath())}endpointPath(){return`${i.default.RESOURCEPATH}/${this.id}`}}},2708:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(9964),i="/keys";class s{constructor(e){this.apiCall=e,this.apiCall=e}async create(e){return await this.apiCall.post(s.RESOURCEPATH,e)}retrieve(){return this.apiCall.get(i)}generateScopedSearchKey(e,t){const r=JSON.stringify(t),i=`${Buffer.from(n.createHmac("sha256",e).update(r).digest("base64"))}${e.substr(0,4)}${r}`;return Buffer.from(i).toString("base64")}static get RESOURCEPATH(){return i}}t.default=s},6029:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}retrieve(){return this.apiCall.get("/metrics.json")}}},9092:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(2598));t.default=class{constructor(e,t,r=!1){this.apiCall=e,this.configuration=t,this.useTextContentType=r,this.requestWithCache=new i.default}perform(e,t={},{cacheSearchResultsForSeconds:r=this.configuration.cacheSearchResultsForSeconds}={}){let n={};this.useTextContentType&&(n["content-type"]="text/plain");let i={};!0===this.configuration.useServerSideSearchCache&&(i.use_cache=!0);const s=Object.assign({},t,i);return this.requestWithCache.perform(this.apiCall,this.apiCall.post,["/multi_search",e,s,n],{cacheResponseForSeconds:r})}}},3095:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}perform(e,t={}){return this.apiCall.post(`/operations/${e}`,{},t)}}},3620:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(6581)),s=n(r(6067));t.default=class{constructor(e,t,r){this.collectionName=e,this.overrideId=t,this.apiCall=r}async retrieve(){return await this.apiCall.get(this.endpointPath())}async delete(){return await this.apiCall.delete(this.endpointPath())}endpointPath(){return`${i.default.RESOURCEPATH}/${this.collectionName}${s.default.RESOURCEPATH}/${this.overrideId}`}}},6067:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(6581));class s{constructor(e,t){this.collectionName=e,this.apiCall=t}async upsert(e,t){return await this.apiCall.put(this.endpointPath(e),t)}async retrieve(){return await this.apiCall.get(this.endpointPath())}endpointPath(e){return`${i.default.RESOURCEPATH}/${this.collectionName}${s.RESOURCEPATH}${void 0===e?"":"/"+e}`}static get RESOURCEPATH(){return"/overrides"}}t.default=s},2598:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=120,n=100;t.default=class{constructor(){this.responseCache=new Map}async perform(e,t,i,s){const{cacheResponseForSeconds:o=r,maxSize:a=n}=s;if(o<=0||a<=0)return t.call(e,...i);const c=JSON.stringify(i),u=this.responseCache.get(c),l=Date.now();if(u){if(l-u.requestTimestamp<1e3*o)return this.responseCache.delete(c),this.responseCache.set(c,u),Promise.resolve(u.response);this.responseCache.delete(c)}const h=await t.call(e,...i);if(this.responseCache.set(c,{requestTimestamp:l,response:h}),this.responseCache.size>a){const e=this.responseCache.keys().next().value;this.responseCache.delete(e)}return h}}},8834:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(2554)),s=n(r(9777)),o=n(r(9092)),a=r(3320);t.default=class{constructor(e){(e.apiKey||"").length<2e3&&(e.sendApiKeyAsQueryParam=!0),this.configuration=new i.default(e),this.apiCall=new s.default(this.configuration),this.multiSearch=new o.default(this.apiCall,this.configuration,!0),this.individualCollections={}}collections(e){if(e)return void 0===this.individualCollections[e]&&(this.individualCollections[e]=new a.SearchOnlyCollection(e,this.apiCall,this.configuration)),this.individualCollections[e];throw new Error("Typesense.SearchClient only supports search operations, so the collectionName that needs to be searched must be specified. Use Typesense.Client if you need to access the collection object.")}}},3320:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchOnlyCollection=void 0;const n=r(5586);t.SearchOnlyCollection=class{constructor(e,t,r){this.name=e,this.apiCall=t,this.configuration=r,this._documents=new n.SearchOnlyDocuments(this.name,this.apiCall,this.configuration)}documents(){return this._documents}}},5586:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SearchOnlyDocuments=void 0;const i=n(r(2598)),s=n(r(6581));t.SearchOnlyDocuments=class{constructor(e,t,r){this.collectionName=e,this.apiCall=t,this.configuration=r,this.requestWithCache=new i.default}async search(e,{cacheSearchResultsForSeconds:t=this.configuration.cacheSearchResultsForSeconds,abortSignal:r=null}={}){let n={};!0===this.configuration.useServerSideSearchCache&&(n.use_cache=!0);const i=Object.assign({},e,n);return await this.requestWithCache.perform(this.apiCall,this.apiCall.get,[this.endpointPath("search"),i,{abortSignal:r}],{cacheResponseForSeconds:t})}endpointPath(e){return`${s.default.RESOURCEPATH}/${this.collectionName}/documents${void 0===e?"":"/"+e}`}static get RESOURCEPATH(){return"/documents"}}},1483:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(6581)),s=n(r(1940));t.default=class{constructor(e,t,r){this.collectionName=e,this.synonymId=t,this.apiCall=r}async retrieve(){return await this.apiCall.get(this.endpointPath())}async delete(){return await this.apiCall.delete(this.endpointPath())}endpointPath(){return`${i.default.RESOURCEPATH}/${this.collectionName}${s.default.RESOURCEPATH}/${this.synonymId}`}}},1940:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(r(6581));class s{constructor(e,t){this.collectionName=e,this.apiCall=t}async upsert(e,t){return await this.apiCall.put(this.endpointPath(e),t)}async retrieve(){return await this.apiCall.get(this.endpointPath())}endpointPath(e){return`${i.default.RESOURCEPATH}/${this.collectionName}${s.RESOURCEPATH}${void 0===e?"":"/"+e}`}static get RESOURCEPATH(){return"/synonyms"}}t.default=s},9964:()=>{},8593:e=>{"use strict";e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz","_integrity":"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==","_from":"axios@0.21.4"}')}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};return(()=>{"use strict";function e(e,t,r,n,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(i,s){var o=t.apply(r,n);function a(t){e(o,i,s,a,c,"next",t)}function c(t){e(o,i,s,a,c,"throw",t)}a(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),e}r.d(n,{default:()=>b});var a=r(7757),c=r.n(a),u=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.server=r.server||{nodes:[{host:"localhost",port:"8108",path:"",protocol:"http"}]},this.server.cacheSearchResultsForSeconds=null==this.server.cacheSearchResultsForSeconds?120:this.server.cacheSearchResultsForSeconds,this.additionalSearchParameters=r.additionalSearchParameters||{},this.additionalSearchParameters.queryBy=this.additionalSearchParameters.queryBy||"",this.additionalSearchParameters.sortBy=this.additionalSearchParameters.sortBy||"",this.additionalSearchParameters.highlightFullFields=this.additionalSearchParameters.highlightFullFields||this.additionalSearchParameters.queryBy,this.geoLocationField=r.geoLocationField||"_geoloc",this.collectionSpecificSearchParameters=r.collectionSpecificSearchParameters||{},Object.keys(this.collectionSpecificSearchParameters).forEach((function(e){var r=t.collectionSpecificSearchParameters[e].highlightFullFields||t.collectionSpecificSearchParameters[e].queryBy;r&&(t.collectionSpecificSearchParameters[e].highlightFullFields=r)}))}return o(e,[{key:"validate",value:function(){if(0===this.additionalSearchParameters.queryBy.length&&Object.values(this.collectionSpecificSearchParameters).some((function(e){return 0===(e.queryBy||"").length})))throw new Error("Missing parameter: Either additionalSearchParameters.queryBy needs to be set, or all collectionSpecificSearchParameters need to have .queryBy set")}}]),e}(),l=r(8871);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,s=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){a=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw i}}return s}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=function(){function e(t,r,n){i(this,e),this.instantsearchRequests=t,this.typesenseClient=r,this.configuration=n,this.additionalSearchParameters=n.additionalSearchParameters,this.collectionSpecificSearchParameters=n.collectionSpecificSearchParameters}var r;return o(e,[{key:"_adaptFacetFilters",value:function(e){var t=this,r="";return e?r=e.map((function(e){if(Array.isArray(e)){var r={};e.forEach((function(e){var n=e.match(t.constructor.FILTER_STRING_MATCHING_REGEX),i="".concat(n[1]).concat(n[2]),s="".concat(n[3]);r[i]=r[i]||[],r[i].push(s)})),Object.keys(r).length>1&&console.error("[Typesense-Instantsearch-Adapter] Typesense does not support cross-field ORs at the moment. The adapter could not OR values between these fields: ".concat(Object.keys(r).join(",")));var n=Object.keys(r)[0],i=f(r[n].reduce((function(e,r){return r.startsWith("-")&&!t._isNumber(r)?e[0].push(r.substring(1)):e[1].push(r),e}),[[],[]]),2),s=i[0],o=i[1],a=[];return o.length>0&&a.push("".concat(n,":=[").concat(o.map((function(e){return t._escapeFacetValue(e)})).join(","),"]")),s.length>0&&a.push("".concat(n,":!=[").concat(s.map((function(e){return t._escapeFacetValue(e)})).join(","),"]")),a.filter((function(e){return e})).join(" && ")}var c=e.match(t.constructor.FILTER_STRING_MATCHING_REGEX),u="".concat(c[1]).concat(c[2]),l="".concat(c[3]);return l.startsWith("-")&&!t._isNumber(l)?"".concat(u,":!=[").concat(t._escapeFacetValue(l.substring(1)),"]"):"".concat(u,":=[").concat(t._escapeFacetValue(l),"]")})).join(" && "):r}},{key:"_escapeFacetValue",value:function(e){return"boolean"==typeof e||"true"===e||"false"===e||this._isNumber(e)?e:"`".concat(e,"`")}},{key:"_isNumber",value:function(e){return Number.isInteger(e%1)||!!(e%1)}},{key:"_adaptNumericFilters",value:function(e){var t="";if(!e)return t;var r={};e.forEach((function(e){var t=f(e.match(new RegExp("(.*)(<=|>=|>|<|:)(.*)")),4),n=t[1],i=t[2],s=t[3];r[n]=r[n]||{},r[n][i]=s}));var n=[];return Object.keys(r).forEach((function(e){null!=r[e]["<="]&&null!=r[e][">="]?n.push("".concat(e,":=[").concat(r[e][">="],"..").concat(r[e]["<="],"]")):null!=r[e]["<="]?n.push("".concat(e,":<=").concat(r[e]["<="])):null!=r[e][">="]?n.push("".concat(e,":>=").concat(r[e][">="])):console.warn("[Typesense-Instantsearch-Adapter] Unsupported operator found ".concat(JSON.stringify(r[e])))})),n.join(" && ")}},{key:"_adaptGeoFilter",value:function(e){var t=e.insideBoundingBox,r=e.aroundRadius,n=e.aroundLatLng,i=e.insidePolygon;if(t){var s,o,a,c;if(Array.isArray(t)){var u=f(t.flat(),4);s=u[0],o=u[1],a=u[2],c=u[3]}else{var l=f(t.split(","),4);s=l[0],o=l[1],a=l[2],c=l[3]}return"".concat(this.configuration.geoLocationField,":(").concat(s,", ").concat(o,", ").concat(s,", ").concat(c,", ").concat(a,", ").concat(c,", ").concat(a,", ").concat(o,")")}if(n||r){if(!r||"all"===r)throw new Error("[Typesense-Instantsearch-Adapter] In Typesense, geo-filtering around a lat/lng also requires a numerical radius. So the `aroundRadius` parameter is required when `aroundLatLng` is used. If you intend to just geo-sort around a lat/long, you want to use the sortBy InstantSearch widget (or a virtual sortBy custom widget).");var h="".concat(parseFloat(r)/1e3," km");return"".concat(this.configuration.geoLocationField,":(").concat(n,", ").concat(h,")")}if(i){var d=i;return Array.isArray(i)&&(d=i.flat().join(",")),"".concat(this.configuration.geoLocationField,":(").concat(d,")")}}},{key:"_adaptFilters",value:function(e){var t=[];return t.push(this._adaptFacetFilters(e.facetFilters)),t.push(this._adaptNumericFilters(e.numericFilters)),t.push(this._adaptGeoFilter(e)),t.filter((function(e){return e&&""!==e})).join(" && ")}},{key:"_adaptIndexName",value:function(e){return e.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[1]}},{key:"_adaptSortBy",value:function(e){return e.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[3]}},{key:"_buildSearchParameters",value:function(e){for(var t=e.params,r=e.indexName,n=this._adaptIndexName(r),i={},s=0,o=Object.entries(this.additionalSearchParameters);s<o.length;s++){var a=f(o[s],2),c=a[0],u=a[1];i[this._camelToSnakeCase(c)]=u}if(this.collectionSpecificSearchParameters[n])for(var l=0,h=Object.entries(this.collectionSpecificSearchParameters[n]);l<h.length;l++){var d=f(h[l],2),p=d[0],y=d[1];i[this._camelToSnakeCase(p)]=y}var m=Object.assign({},i),v=this._adaptSortBy(r);return Object.assign(m,{collection:n,q:""===t.query||void 0===t.query?"*":t.query,facet_by:[t.facets].flat().join(","),filter_by:this._adaptFilters(t)||i.filter_by,sort_by:v||i.sort_by,max_facet_values:t.maxValuesPerFacet,page:(t.page||0)+1}),t.hitsPerPage&&(m.per_page=t.hitsPerPage),t.facetQuery&&(m.facet_query="".concat(t.facetName,":").concat(t.facetQuery),m.per_page=0),m}},{key:"_camelToSnakeCase",value:function(e){return e.split(/(?=[A-Z])/).join("_").toLowerCase()}},{key:"request",value:(r=t(c().mark((function e(){var t,r=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.instantsearchRequests.map((function(e){return r._buildSearchParameters(e)})),e.abrupt("return",this.typesenseClient.multiSearch.perform({searches:t}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}],[{key:"INDEX_NAME_MATCHING_REGEX",get:function(){return new RegExp("^(.+?)(?=(/sort/(.*))|$)")}},{key:"FILTER_STRING_MATCHING_REGEX",get:function(){return new RegExp("(.*)((?!:).):(?!:)(.*)")}}]),e}();function y(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v={_adaptHighlightTag:function(e,t,r){return e.replace(new RegExp("<mark>","g"),t||"<mark>").replace(new RegExp("</mark>","g"),r||"</mark>")},_adaptNumberOfPages:function(){var e=this.typesenseResponse.found/this.typesenseResponse.request_params.per_page;return Number.isFinite(e)?Math.ceil(e):1}};function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var w=function(){function e(t,r,n){i(this,e),this.typesenseResponse=t,this.instantsearchRequest=r,this.configuration=n}return o(e,[{key:"_adaptGroupedHits",value:function(e){var t=this;return e.map((function(e){return t._adaptHits(e.hits)})).flat()}},{key:"_adaptHits",value:function(e){var t=this;return e.map((function(e){var r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e.document);r.objectID=e.document.id,r._snippetResult=t._adaptHighlightResult(e,"snippet"),r._highlightResult=t._adaptHighlightResult(e,"value"),r.text_match||(r.text_match=e.text_match);var n=r[t.configuration.geoLocationField];return n&&(r._geoloc={lat:n[0],lng:n[1]}),r}))}},{key:"_adaptHighlightResult",value:function(e,t){var r=this,n=Object.assign.apply(Object,[{}].concat(y(Object.entries(e.document).map((function(e){var t=f(e,2);return m({},t[0],{value:t[1],matchLevel:"none",matchedWords:[]})})))));return e.highlights.forEach((function(e){n[e.field]={value:e[t]||e["".concat(t,"s")],matchLevel:"full",matchedWords:e.matched_tokens},e.indices&&(n[e.field].matchedIndices=e.indices)})),Object.entries(n).forEach((function(t){var i=f(t,2),s=i[0],o=i[1],a=s,c=o.value,u=o.matchLevel,l=o.matchedWords,h=o.matchedIndices;Array.isArray(c)?(n[a]=[],e.document[a].forEach((function(e,t){h&&h.includes(t)?n[a].push({value:r._adaptHighlightTag("".concat(c[h.indexOf(t)]),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag),matchLevel:u,matchedWords:l[t]}):n[a].push({value:"".concat(e),matchLevel:"none",matchedWords:[]})}))):n[a].value=r._adaptHighlightTag("".concat(c),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag)})),n}},{key:"_adaptFacets",value:function(e){var t={};return e.forEach((function(e){Object.assign(t,m({},e.field_name,Object.assign.apply(Object,[{}].concat(y(e.counts.map((function(e){return m({},e.value,e.count)})))))))})),t}},{key:"_adaptFacetStats",value:function(e){var t={};return e.forEach((function(e){Object.keys(e.stats).length>0&&Object.assign(t,m({},e.field_name,e.stats))})),t}},{key:"adapt",value:function(){return{hits:this.typesenseResponse.grouped_hits?this._adaptGroupedHits(this.typesenseResponse.grouped_hits):this._adaptHits(this.typesenseResponse.hits),nbHits:this.typesenseResponse.found,page:this.typesenseResponse.page-1,nbPages:this._adaptNumberOfPages(),hitsPerPage:this.typesenseResponse.request_params.per_page,facets:this._adaptFacets(this.typesenseResponse.facet_counts||[]),facets_stats:this._adaptFacetStats(this.typesenseResponse.facet_counts||{}),query:this.typesenseResponse.request_params.q,processingTimeMS:this.typesenseResponse.search_time_ms}}}]),e}();Object.assign(w.prototype,v);var _=function(){function e(t,r){i(this,e),this.typesenseResponse=t,this.instantsearchRequest=r}return o(e,[{key:"_adaptFacetHits",value:function(e){var t=this;return e.find((function(e){return e.field_name===t.instantsearchRequest.params.facetName})).counts.map((function(e){return{value:e.value,highlighted:t._adaptHighlightTag(e.highlighted,t.instantsearchRequest.params.highlightPreTag,t.instantsearchRequest.params.highlightPostTag),count:e.count}}))}},{key:"adapt",value:function(){return{facetHits:this._adaptFacetHits(this.typesenseResponse.facet_counts),exhaustiveFacetsCount:!0,processingTimeMS:this.typesenseResponse.search_time_ms}}}]),e}();Object.assign(_.prototype,v);var b=function(){function e(t){var r=this;i(this,e),this.configuration=new u(t),this.configuration.validate(),this.typesenseClient=new l.SearchClient(this.configuration.server),this.searchClient={clearCache:function(){return r.clearCache()},search:function(e){return r.searchTypesenseAndAdapt(e)},searchForFacetValues:function(e){return r.searchTypesenseForFacetValuesAndAdapt(e)}}}var r,n,s;return o(e,[{key:"searchTypesenseAndAdapt",value:(s=t(c().mark((function e(t){var r,n,i=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._adaptAndPerformTypesenseRequest(t);case 3:return r=e.sent,n=r.results.map((function(e,r){return i._validateTypesenseResult(e),new w(e,t[r],i.configuration).adapt()})),e.abrupt("return",{results:n});case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(e){return s.apply(this,arguments)})},{key:"searchTypesenseForFacetValuesAndAdapt",value:(n=t(c().mark((function e(t){var r,n,i=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._adaptAndPerformTypesenseRequest(t);case 3:return r=e.sent,n=r.results.map((function(e,r){return i._validateTypesenseResult(e),new _(e,t[r],i.configuration).adapt()})),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(e){return n.apply(this,arguments)})},{key:"_adaptAndPerformTypesenseRequest",value:(r=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new p(t,this.typesenseClient,this.configuration),e.next=3,r.request();case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"clearCache",value:function(){return this.typesenseClient=new l.SearchClient(this.configuration.server),this.searchClient}},{key:"_validateTypesenseResult",value:function(e){if(e.error)throw new Error("".concat(e.code," - ").concat(e.error));if(!e.hits&&!e.grouped_hits)throw new Error("Did not find any hits. ".concat(e.code," - ").concat(e.error))}}]),e}()})(),n.default})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TypesenseInstantSearchAdapter=t():e.TypesenseInstantSearchAdapter=t()}(self,(function(){return(()=>{var e={7757:(e,t,r)=>{e.exports=r(5666)},9669:(e,t,r)=>{e.exports=r(1609)},5448:(e,t,r)=>{"use strict";var n=r(4867),s=r(6026),i=r(4372),o=r(5327),a=r(4097),c=r(4109),u=r(7985),l=r(5061);e.exports=function(e){return new Promise((function(t,r){var h=e.data,d=e.headers,f=e.responseType;n.isFormData(h)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var y=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(y+":"+m)}var v=a(e.baseURL,e.url);function g(){if(p){var n="getAllResponseHeaders"in p?c(p.getAllResponseHeaders()):null,i={data:f&&"text"!==f&&"json"!==f?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};s(t,r,i),p=null}}if(p.open(e.method.toUpperCase(),o(v,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(r(l("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){r(l("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var _=(e.withCredentials||u(v))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;_&&(d[e.xsrfHeaderName]=_)}"setRequestHeader"in p&&n.forEach(d,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),f&&"json"!==f&&(p.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),r(e),p=null)})),h||(h=null),p.send(h)}))}},1609:(e,t,r)=>{"use strict";var n=r(4867),s=r(1849),i=r(321),o=r(7185);function a(e){var t=new i(e),r=s(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var c=a(r(5655));c.Axios=i,c.create=function(e){return a(o(c.defaults,e))},c.Cancel=r(5263),c.CancelToken=r(4972),c.isCancel=r(6502),c.all=function(e){return Promise.all(e)},c.spread=r(8713),c.isAxiosError=r(6268),e.exports=c,e.exports.default=c},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,r)=>{"use strict";var n=r(5263);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(4867),s=r(5327),i=r(782),o=r(3572),a=r(7185),c=r(4875),u=c.validators;function l(e){this.defaults=e,this.interceptors={request:new i,response:new i}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&c.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!n){var l=[o,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(i),s=Promise.resolve(e);l.length;)s=s.then(l.shift(),l.shift());return s}for(var h=e;r.length;){var d=r.shift(),f=r.shift();try{h=d(h)}catch(e){f(e);break}}try{s=o(h)}catch(e){return Promise.reject(e)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},l.prototype.getUri=function(e){return e=a(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,r,n){return this.request(a(n||{},{method:e,url:t,data:r}))}})),e.exports=l},782:(e,t,r)=>{"use strict";var n=r(4867);function s(){this.handlers=[]}s.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},4097:(e,t,r)=>{"use strict";var n=r(1793),s=r(7303);e.exports=function(e,t){return e&&!n(t)?s(e,t):t}},5061:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,s,i){var o=new Error(e);return n(o,t,r,s,i)}},3572:(e,t,r)=>{"use strict";var n=r(4867),s=r(8527),i=r(6502),o=r(5655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return a(e),t.data=s.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,s){return e.config=t,r&&(e.code=r),e.request=n,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},7185:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){t=t||{};var r={},s=["url","method","data"],i=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function u(s){n.isUndefined(t[s])?n.isUndefined(e[s])||(r[s]=c(void 0,e[s])):r[s]=c(e[s],t[s])}n.forEach(s,(function(e){n.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),n.forEach(i,u),n.forEach(o,(function(s){n.isUndefined(t[s])?n.isUndefined(e[s])||(r[s]=c(void 0,e[s])):r[s]=c(void 0,t[s])})),n.forEach(a,(function(n){n in t?r[n]=c(e[n],t[n]):n in e&&(r[n]=c(void 0,e[n]))}));var l=s.concat(i).concat(o).concat(a),h=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(h,u),r}},6026:(e,t,r)=>{"use strict";var n=r(5061);e.exports=function(e,t,r){var s=r.config.validateStatus;r.status&&s&&!s(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},8527:(e,t,r)=>{"use strict";var n=r(4867),s=r(5655);e.exports=function(e,t,r){var i=this||s;return n.forEach(r,(function(r){e=r.call(i,e,t)})),e}},5655:(e,t,r)=>{"use strict";var n=r(4867),s=r(6016),i=r(481),o={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(c=r(5448)),c),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,r=t&&t.silentJSONParsing,s=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||s&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(o)})),e.exports=u},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},5327:(e,t,r)=>{"use strict";var n=r(4867);function s(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(n.isURLSearchParams(t))i=t.toString();else{var o=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),o.push(s(t)+"="+s(e))})))})),i=o.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},7303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},4372:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,s,i,o){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(s)&&a.push("path="+s),n.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,r)=>{"use strict";var n=r(4867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function s(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=s(window.location.href),function(t){var r=n.isString(t)?s(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},6016:(e,t,r)=>{"use strict";var n=r(4867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},4109:(e,t,r)=>{"use strict";var n=r(4867),s=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,i,o={};return e?(n.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=n.trim(e.substr(0,i)).toLowerCase(),r=n.trim(e.substr(i+1)),t){if(o[t]&&s.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([r]):o[t]?o[t]+", "+r:r}})),o):o}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:(e,t,r)=>{"use strict";var n=r(8593),s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var i={},o=n.version.split(".");function a(e,t){for(var r=t?t.split("."):o,n=e.split("."),s=0;s<3;s++){if(r[s]>n[s])return!0;if(r[s]<n[s])return!1}return!1}s.transitional=function(e,t,r){var s=t&&a(t);function o(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,a){if(!1===e)throw new Error(o(n," has been removed in "+t));return s&&!i[n]&&(i[n]=!0,console.warn(o(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),s=n.length;s-- >0;){var i=n[s],o=t[i];if(o){var a=e[i],c=void 0===a||o(a,i,e);if(!0!==c)throw new TypeError("option "+i+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:s}},4867:(e,t,r)=>{"use strict";var n=r(1849),s=Object.prototype.toString;function i(e){return"[object Array]"===s.call(e)}function o(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==s.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===s.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===s.call(e)},isBuffer:function(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:c,isUndefined:o,isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function e(){var t={};function r(r,n){c(t[n])&&c(r)?t[n]=e(t[n],r):c(r)?t[n]=e({},r):i(r)?t[n]=r.slice():t[n]=r}for(var n=0,s=arguments.length;n<s;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,s){e[s]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},2043:function(e,t,r){var n,s;!function(i,o){"use strict";void 0===(s="function"==typeof(n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function s(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function o(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?i:void 0!==console[n]?s(console,n):void 0!==console.log?s(console,"log"):e)}function a(t,r){for(var s=0;s<n.length;s++){var i=n[s];this[i]=s<t?e:this.methodFactory(i,t,r)}this.log=this.debug}function c(e,r,n){return function(){typeof console!==t&&(a.call(this,r,n),this[e].apply(this,arguments))}}function u(e,t,r){return o(e)||c.apply(this,arguments)}function l(e,r,s){var i,o=this;r=null==r?"WARN":r;var c="loglevel";function l(){var e;if(typeof window!==t&&c){try{e=window.localStorage[c]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(c)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===o.levels[e]&&(e=void 0),e}}"string"==typeof e?c+=":"+e:"symbol"==typeof e&&(c=void 0),o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=s||u,o.getLevel=function(){return i},o.setLevel=function(r,s){if("string"==typeof r&&void 0!==o.levels[r.toUpperCase()]&&(r=o.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=o.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(i=r,!1!==s&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&c){try{return void(window.localStorage[c]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+r+";"}catch(e){}}}(r),a.call(o,r,e),typeof console===t&&r<o.levels.SILENT)return"No console available for logging"},o.setDefaultLevel=function(e){r=e,l()||o.setLevel(e,!1)},o.resetLevel=function(){o.setLevel(r,!1),function(){if(typeof window!==t&&c){try{return void window.localStorage.removeItem(c)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}()},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)};var h=l();null==h&&(h=r),o.setLevel(h,!1)}var h=new l,d={};h.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=d[e];return t||(t=d[e]=new l(e,h.getLevel(),h.methodFactory)),t};var f=typeof window!==t?window.log:void 0;return h.noConflict=function(){return typeof window!==t&&window.log===h&&(window.log=f),h},h.getLoggers=function(){return d},h.default=h,h})?n.call(t,r,t,e):n)||(e.exports=s)}()},5666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},i=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",a=s.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var s=t&&t.prototype instanceof m?t:m,i=Object.create(s.prototype),o=new R(n||[]);return i._invoke=function(e,t,r){var n=h;return function(s,i){if(n===f)throw new Error("Generator is already running");if(n===p){if("throw"===s)throw i;return N()}for(r.method=s,r.arg=i;;){var o=r.delegate;if(o){var a=O(o,r);if(a){if(a===y)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var c=l(e,t,r);if("normal"===c.type){if(n=r.done?p:d,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=p,r.method="throw",r.arg=c.arg)}}}(e,r,o),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",f="executing",p="completed",y={};function m(){}function v(){}function g(){}var _={};c(_,i,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(x([])));w&&w!==r&&n.call(w,i)&&(_=w);var S=g.prototype=m.prototype=Object.create(_);function P(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function r(s,i,o,a){var c=l(e[s],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,o,a)}),(function(e){r("throw",e,o,a)})):t.resolve(h).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,a)}))}a(c.arg)}var s;this._invoke=function(e,n){function i(){return new t((function(t,s){r(e,n,t,s)}))}return s=s?s.then(i,i):i()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var s=l(n,e.iterator,r.arg);if("throw"===s.type)return r.method="throw",r.arg=s.arg,r.delegate=null,y;var i=s.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function x(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var s=-1,o=function r(){for(;++s<e.length;)if(n.call(e,s))return r.value=e[s],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:N}}function N(){return{value:t,done:!0}}return v.prototype=g,c(S,"constructor",g),c(g,"constructor",v),v.displayName=c(g,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,a,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},P(C.prototype),c(C.prototype,o,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,s,i){void 0===i&&(i=Promise);var o=new C(u(t,r,n,s),i);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},P(S),c(S,a,"Generator"),c(S,i,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=x,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function s(n,s){return a.type="throw",a.arg=e,r.next=n,s&&(r.method="next",r.arg=t),!!s}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return s("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return s(o.catchLoc,!0);if(this.prev<o.finallyLoc)return s(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return s(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return s(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var i=s;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var s=n.arg;j(r)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:x(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},8871:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return s(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=t.SearchClient=t.Client=void 0;const a=o(r(4339));t.Client=a.default;const c=o(r(8834));t.SearchClient=c.default;const u=i(r(6718));t.Errors=u,t.default={Client:a.default,SearchClient:c.default,Errors:u}},8480:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(5346));t.default=class{constructor(e,t){this.name=e,this.apiCall=t}async retrieve(){return this.apiCall.get(this.endpointPath())}async delete(){return this.apiCall.delete(this.endpointPath())}endpointPath(){return`${s.default.RESOURCEPATH}/${this.name}`}}},5346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r="/aliases";class n{constructor(e){this.apiCall=e}async upsert(e,t){return this.apiCall.put(this.endpointPath(e),t)}async retrieve(){return this.apiCall.get(r)}endpointPath(e){return`${n.RESOURCEPATH}/${e}`}static get RESOURCEPATH(){return r}}t.default=n},9777:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(9669)),i=r(6718),o=n(r(4492)),a=!0;t.default=class{constructor(e){this.configuration=e,this.apiKey=this.configuration.apiKey,this.nodes=JSON.parse(JSON.stringify(this.configuration.nodes)),this.nearestNode=JSON.parse(JSON.stringify(this.configuration.nearestNode)),this.connectionTimeoutSeconds=this.configuration.connectionTimeoutSeconds,this.healthcheckIntervalSeconds=this.configuration.healthcheckIntervalSeconds,this.numRetriesPerRequest=this.configuration.numRetries,this.retryIntervalSeconds=this.configuration.retryIntervalSeconds,this.sendApiKeyAsQueryParam=this.configuration.sendApiKeyAsQueryParam,this.additionalUserHeaders=this.configuration.additionalHeaders,this.logger=this.configuration.logger,this.initializeMetadataForNodes(),this.currentNodeIndex=-1}async get(e,t={},{abortSignal:r=null,responseType:n=null}={}){return this.performRequest("get",e,{queryParameters:t,abortSignal:r,responseType:n})}async delete(e,t={}){return this.performRequest("delete",e,{queryParameters:t})}async post(e,t={},r={},n={}){return this.performRequest("post",e,{queryParameters:r,bodyParameters:t,additionalHeaders:n})}async put(e,t={},r={}){return this.performRequest("put",e,{queryParameters:r,bodyParameters:t})}async patch(e,t={},r={}){return this.performRequest("patch",e,{queryParameters:r,bodyParameters:t})}async performRequest(e,t,{queryParameters:r=null,bodyParameters:n=null,additionalHeaders:i={},abortSignal:o=null,responseType:c=null}){var u,l,h;this.configuration.validate();const d=Date.now();let f;this.logger.debug(`Request #${d}: Performing ${e.toUpperCase()} request: ${t}`);for(let p=1;p<=this.numRetriesPerRequest+1;p++){let y,m=this.getNextNode(d);if(this.logger.debug(`Request #${d}: Attempting ${e.toUpperCase()} request Try #${p} to Node ${m.index}`),o&&o.aborted)return Promise.reject(new Error("Request aborted by caller."));try{let h={method:e,url:this.uriFor(t,m),headers:Object.assign({},this.defaultHeaders(),i,this.additionalUserHeaders),timeout:1e3*this.connectionTimeoutSeconds,maxContentLength:1/0,maxBodyLength:1/0,responseType:c,validateStatus:e=>e>0,transformResponse:[(e,t)=>{let r=e;return void 0!==t&&"string"==typeof e&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(r=JSON.parse(e)),r}]};if(r&&0!==Object.keys(r).length&&(h.params=r),this.sendApiKeyAsQueryParam&&(h.params=h.params||{},h.params["x-typesense-api-key"]=this.apiKey),n&&("string"==typeof n&&0!==n.length||"object"==typeof n&&0!==Object.keys(n).length)&&(h.data=n),o){const e=s.default.CancelToken.source();y=()=>e.cancel(),o.addEventListener("abort",y),h.cancelToken=e.token}let f=await s.default(h);if(f.status>=1&&f.status<=499&&this.setNodeHealthcheck(m,a),this.logger.debug(`Request #${d}: Request to Node ${m.index} was made. Response Code was ${f.status}.`),f.status>=200&&f.status<300)return Promise.resolve(f.data);if(f.status<500)return Promise.reject(this.customErrorForResponse(f,null===(u=f.data)||void 0===u?void 0:u.message));throw this.customErrorForResponse(f,null===(l=f.data)||void 0===l?void 0:l.message)}catch(e){this.setNodeHealthcheck(m,!1),f=e,this.logger.warn(`Request #${d}: Request to Node ${m.index} failed due to "${e.code} ${e.message}${null==e.response?"":" - "+JSON.stringify(null===(h=e.response)||void 0===h?void 0:h.data)}"`),this.logger.warn(`Request #${d}: Sleeping for ${this.retryIntervalSeconds}s and then retrying request...`),await this.timer(this.retryIntervalSeconds)}finally{o&&y&&o.removeEventListener("abort",y)}}return this.logger.debug(`Request #${d}: No retries left. Raising last error`),Promise.reject(f)}getNextNode(e=0){if(null!=this.nearestNode){if(this.logger.debug(`Request #${e}: Nodes Health: Node ${this.nearestNode.index} is ${!0===this.nearestNode.isHealthy?"Healthy":"Unhealthy"}`),!0===this.nearestNode.isHealthy||this.nodeDueForHealthcheck(this.nearestNode,e))return this.logger.debug(`Request #${e}: Updated current node to Node ${this.nearestNode.index}`),this.nearestNode;this.logger.debug(`Request #${e}: Falling back to individual nodes`)}let t;this.logger.debug(`Request #${e}: Nodes Health: ${this.nodes.map((e=>`Node ${e.index} is ${!0===e.isHealthy?"Healthy":"Unhealthy"}`)).join(" || ")}`);for(let r=0;r<=this.nodes.length;r++)if(this.currentNodeIndex=(this.currentNodeIndex+1)%this.nodes.length,t=this.nodes[this.currentNodeIndex],!0===t.isHealthy||this.nodeDueForHealthcheck(t,e))return this.logger.debug(`Request #${e}: Updated current node to Node ${t.index}`),t;return this.logger.debug(`Request #${e}: No healthy nodes were found. Returning the next node, Node ${t.index}`),t}nodeDueForHealthcheck(e,t=0){const r=Date.now()-e.lastAccessTimestamp>1e3*this.healthcheckIntervalSeconds;return r&&this.logger.debug(`Request #${t}: Node ${e.index} has exceeded healtcheckIntervalSeconds of ${this.healthcheckIntervalSeconds}. Adding it back into rotation.`),r}initializeMetadataForNodes(){null!=this.nearestNode&&(this.nearestNode.index="nearestNode",this.setNodeHealthcheck(this.nearestNode,a)),this.nodes.forEach(((e,t)=>{e.index=t,this.setNodeHealthcheck(e,a)}))}setNodeHealthcheck(e,t){e.isHealthy=t,e.lastAccessTimestamp=Date.now()}uriFor(e,t){return null!=t.url?`${t.url}${e}`:`${t.protocol}://${t.host}:${t.port}${t.path}${e}`}defaultHeaders(){let e={};return this.sendApiKeyAsQueryParam||(e["X-TYPESENSE-API-KEY"]=this.apiKey),e["Content-Type"]="application/json",e}async timer(e){return new Promise((t=>setTimeout(t,1e3*e)))}customErrorForResponse(e,t){let r=`Request failed with HTTP code ${e.status}`;"string"==typeof t&&""!==t.trim()&&(r+=` | Server said: ${t}`);let n=new o.default(r);return n=400===e.status?new i.RequestMalformed(r):401===e.status?new i.RequestUnauthorized(r):404===e.status?new i.ObjectNotFound(r):409===e.status?new i.ObjectAlreadyExists(r):422===e.status?new i.ObjectUnprocessable(r):e.status>=500&&e.status<=599?new i.ServerError(r):new i.HTTPError(r),n.httpStatus=e.status,n}}},4339:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(2554)),i=n(r(9777)),o=n(r(6581)),a=n(r(8243)),c=n(r(5346)),u=n(r(8480)),l=n(r(2708)),h=n(r(7309)),d=n(r(7634)),f=n(r(6029)),p=n(r(1930)),y=n(r(3095)),m=n(r(9092));t.default=class{constructor(e){this.configuration=new s.default(e),this.apiCall=new i.default(this.configuration),this.debug=new d.default(this.apiCall),this.metrics=new f.default(this.apiCall),this.health=new p.default(this.apiCall),this.operations=new y.default(this.apiCall),this.multiSearch=new m.default(this.apiCall,this.configuration),this._collections=new o.default(this.apiCall),this.individualCollections={},this._aliases=new c.default(this.apiCall),this.individualAliases={},this._keys=new l.default(this.apiCall),this.individualKeys={}}collections(e){return void 0===e?this._collections:(void 0===this.individualCollections[e]&&(this.individualCollections[e]=new a.default(e,this.apiCall,this.configuration)),this.individualCollections[e])}aliases(e){return void 0===e?this._aliases:(void 0===this.individualAliases[e]&&(this.individualAliases[e]=new u.default(e,this.apiCall)),this.individualAliases[e])}keys(e){return void 0===e?this._keys:(void 0===this.individualKeys[e]&&(this.individualKeys[e]=new h.default(e,this.apiCall)),this.individualKeys[e])}}},8243:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(6581)),i=n(r(1949)),o=r(6718),a=n(r(6067)),c=n(r(3620)),u=n(r(1940)),l=n(r(1483)),h=r(9071);t.default=class{constructor(e,t,r){this.name=e,this.apiCall=t,this.configuration=r,this.individualDocuments={},this.individualOverrides={},this.individualSynonyms={},this.name=e,this.apiCall=t,this.configuration=r,this._documents=new i.default(this.name,this.apiCall,this.configuration),this._overrides=new a.default(this.name,this.apiCall),this._synonyms=new u.default(this.name,this.apiCall)}async retrieve(){return this.apiCall.get(this.endpointPath())}async delete(){return this.apiCall.delete(this.endpointPath())}async exists(){try{return await this.retrieve(),!0}catch(e){if(e instanceof o.ObjectNotFound)return!1;throw e}}documents(e){return e?(void 0===this.individualDocuments[e]&&(this.individualDocuments[e]=new h.Document(this.name,e,this.apiCall)),this.individualDocuments[e]):this._documents}overrides(e){return void 0===e?this._overrides:(void 0===this.individualOverrides[e]&&(this.individualOverrides[e]=new c.default(this.name,e,this.apiCall)),this.individualOverrides[e])}synonyms(e){return void 0===e?this._synonyms:(void 0===this.individualSynonyms[e]&&(this.individualSynonyms[e]=new l.default(this.name,e,this.apiCall)),this.individualSynonyms[e])}endpointPath(){return`${s.default.RESOURCEPATH}/${this.name}`}}},6581:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r="/collections";t.default=class{constructor(e){this.apiCall=e}async create(e){return this.apiCall.post(r,e)}async retrieve(){return this.apiCall.get(r)}static get RESOURCEPATH(){return r}}},2554:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const o=i(r(2043)),a=r(6718);t.default=class{constructor(e){this.nodes=e.nodes||[],this.nodes=this.nodes.map((e=>this.setDefaultPathInNode(e))).map((e=>this.setDefaultPortInNode(e))),this.nearestNode=e.nearestNode||null,this.nearestNode=this.setDefaultPathInNode(this.nearestNode),this.nearestNode=this.setDefaultPortInNode(this.nearestNode),this.connectionTimeoutSeconds=e.connectionTimeoutSeconds||e.timeoutSeconds||10,this.healthcheckIntervalSeconds=e.healthcheckIntervalSeconds||15,this.numRetries=e.numRetries||this.nodes.length+(null==this.nearestNode?0:1)||3,this.retryIntervalSeconds=e.retryIntervalSeconds||.1,this.apiKey=e.apiKey,this.sendApiKeyAsQueryParam=e.sendApiKeyAsQueryParam||!1,this.cacheSearchResultsForSeconds=e.cacheSearchResultsForSeconds||0,this.useServerSideSearchCache=e.useServerSideSearchCache||!1,this.logger=e.logger||o,this.logLevel=e.logLevel||"warn",this.logger.setLevel(this.logLevel),this.additionalHeaders=e.additionalHeaders,this.showDeprecationWarnings(e),this.validate()}validate(){if(null==this.nodes||0===this.nodes.length||this.validateNodes())throw new a.MissingConfigurationError("Ensure that nodes[].protocol, nodes[].host and nodes[].port are set");if(null!=this.nearestNode&&this.isNodeMissingAnyParameters(this.nearestNode))throw new a.MissingConfigurationError("Ensure that nearestNodes.protocol, nearestNodes.host and nearestNodes.port are set");if(null==this.apiKey)throw new a.MissingConfigurationError("Ensure that apiKey is set");return!0}validateNodes(){return this.nodes.some((e=>this.isNodeMissingAnyParameters(e)))}isNodeMissingAnyParameters(e){return!["protocol","host","port","path"].every((t=>e.hasOwnProperty(t)))&&null==e.url}setDefaultPathInNode(e){return null==e||e.hasOwnProperty("path")||(e.path=""),e}setDefaultPortInNode(e){if(null!=e&&!e.hasOwnProperty("port")&&e.hasOwnProperty("protocol"))switch(e.protocol){case"https":e.port=443;break;case"http":e.port=80}return e}showDeprecationWarnings(e){e.timeoutSeconds&&this.logger.warn("Deprecation warning: timeoutSeconds is now renamed to connectionTimeoutSeconds"),e.masterNode&&this.logger.warn("Deprecation warning: masterNode is now consolidated to nodes, starting with Typesense Server v0.12"),e.readReplicaNodes&&this.logger.warn("Deprecation warning: readReplicaNodes is now consolidated to nodes, starting with Typesense Server v0.12")}}},7634:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}async retrieve(){return this.apiCall.get("/debug")}}},9071:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Document=void 0;const s=n(r(6581)),i=n(r(1949));t.Document=class{constructor(e,t,r){this.collectionName=e,this.documentId=t,this.apiCall=r}async retrieve(){return this.apiCall.get(this.endpointPath())}async delete(){return this.apiCall.delete(this.endpointPath())}async update(e,t={}){return this.apiCall.patch(this.endpointPath(),e,t)}endpointPath(){return`${s.default.RESOURCEPATH}/${this.collectionName}${i.default.RESOURCEPATH}/${this.documentId}`}}},1949:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(6718),s=r(5586);class i extends s.SearchOnlyDocuments{constructor(e,t,r){super(e,t,r)}async create(e,t={}){if(!e)throw new Error("No document provided");return this.apiCall.post(this.endpointPath(),e,t)}async upsert(e,t={}){if(!e)throw new Error("No document provided");return this.apiCall.post(this.endpointPath(),e,Object.assign({},t,{action:"upsert"}))}async update(e,t={}){if(!e)throw new Error("No document provided");return this.apiCall.post(this.endpointPath(),e,Object.assign({},t,{action:"update"}))}async delete(e={}){return"string"==typeof e?this.apiCall.delete(this.endpointPath(e),e):this.apiCall.delete(this.endpointPath(),e)}async createMany(e,t={}){return this.configuration.logger.warn("createMany is deprecated and will be removed in a future version. Use import instead, which now takes both an array of documents or a JSONL string of documents"),this.import(e,t)}async import(e,t={}){let r;if(Array.isArray(e))try{r=e.map((e=>JSON.stringify(e))).join("\n")}catch(e){if(RangeError instanceof e&&(null==e?void 0:e.includes("Too many properties to enumerate")))throw new Error(`${e}\n It looks like you have reached a Node.js limit that restricts the number of keys in an Object: https://stackoverflow.com/questions/9282869/are-there-limits-to-the-number-of-properties-in-a-javascript-object\n\n Please try reducing the number of keys in your document, or using CURL to import your data.\n `);throw new Error(e)}else r=e;const s=await this.apiCall.performRequest("post",this.endpointPath("import"),{queryParameters:t,bodyParameters:r,additionalHeaders:{"Content-Type":"text/plain"}});if(Array.isArray(e)){const e=s.split("\n").map((e=>JSON.parse(e))),t=e.filter((e=>!1===e.success));if(t.length>0)throw new n.ImportError(`${e.length-t.length} documents imported successfully, ${t.length} documents failed during import. Use \`error.importResults\` from the raised exception to get a detailed error reason for each document.`,e);return e}return s}async export(e={}){return this.apiCall.get(this.endpointPath("export"),e)}async exportStream(e={}){return this.apiCall.get(this.endpointPath("export"),e,{responseType:"stream"})}}t.default=i},7117:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},9229:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{constructor(e,t){super(e),this.importResults=t}}t.default=i},1254:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},4105:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},3836:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},220:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},4913:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},9976:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},4959:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(4492));class i extends s.default{}t.default=i},4492:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{}t.default=r},6718:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ImportError=t.TypesenseError=t.ServerError=t.RequestUnauthorized=t.RequestMalformed=t.ObjectUnprocessable=t.ObjectNotFound=t.ObjectAlreadyExists=t.MissingConfigurationError=t.HTTPError=void 0;const s=n(r(7117));t.HTTPError=s.default;const i=n(r(1254));t.MissingConfigurationError=i.default;const o=n(r(4105));t.ObjectAlreadyExists=o.default;const a=n(r(3836));t.ObjectNotFound=a.default;const c=n(r(220));t.ObjectUnprocessable=c.default;const u=n(r(4913));t.RequestMalformed=u.default;const l=n(r(9976));t.RequestUnauthorized=l.default;const h=n(r(4959));t.ServerError=h.default;const d=n(r(9229));t.ImportError=d.default;const f=n(r(4492));t.TypesenseError=f.default},1930:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}async retrieve(){return this.apiCall.get("/health")}}},7309:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(2708));t.default=class{constructor(e,t){this.id=e,this.apiCall=t}async retrieve(){return this.apiCall.get(this.endpointPath())}async delete(){return this.apiCall.delete(this.endpointPath())}endpointPath(){return`${s.default.RESOURCEPATH}/${this.id}`}}},2708:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(9964),s="/keys";class i{constructor(e){this.apiCall=e,this.apiCall=e}async create(e){return this.apiCall.post(i.RESOURCEPATH,e)}async retrieve(){return this.apiCall.get(s)}generateScopedSearchKey(e,t){const r=JSON.stringify(t),s=`${Buffer.from(n.createHmac("sha256",e).update(r).digest("base64"))}${e.substr(0,4)}${r}`;return Buffer.from(s).toString("base64")}static get RESOURCEPATH(){return s}}t.default=i},6029:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}async retrieve(){return this.apiCall.get("/metrics.json")}}},9092:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(2598));t.default=class{constructor(e,t,r=!1){this.apiCall=e,this.configuration=t,this.useTextContentType=r,this.requestWithCache=new s.default}async perform(e,t={},{cacheSearchResultsForSeconds:r=this.configuration.cacheSearchResultsForSeconds}={}){let n={};this.useTextContentType&&(n["content-type"]="text/plain");let s={};!0===this.configuration.useServerSideSearchCache&&(s.use_cache=!0);const i=Object.assign({},t,s);return this.requestWithCache.perform(this.apiCall,this.apiCall.post,["/multi_search",e,i,n],{cacheResponseForSeconds:r})}}},3095:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.apiCall=e}async perform(e,t={}){return this.apiCall.post(`/operations/${e}`,{},t)}}},3620:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(6581)),i=n(r(6067));t.default=class{constructor(e,t,r){this.collectionName=e,this.overrideId=t,this.apiCall=r}async retrieve(){return this.apiCall.get(this.endpointPath())}async delete(){return this.apiCall.delete(this.endpointPath())}endpointPath(){return`${s.default.RESOURCEPATH}/${this.collectionName}${i.default.RESOURCEPATH}/${this.overrideId}`}}},6067:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(6581));class i{constructor(e,t){this.collectionName=e,this.apiCall=t}async upsert(e,t){return this.apiCall.put(this.endpointPath(e),t)}async retrieve(){return this.apiCall.get(this.endpointPath())}endpointPath(e){return`${s.default.RESOURCEPATH}/${this.collectionName}${i.RESOURCEPATH}${void 0===e?"":"/"+e}`}static get RESOURCEPATH(){return"/overrides"}}t.default=i},2598:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=120,n=100;t.default=class{constructor(){this.responseCache=new Map}async perform(e,t,s,i){const{cacheResponseForSeconds:o=r,maxSize:a=n}=i;if(o<=0||a<=0)return t.call(e,...s);const c=JSON.stringify(s),u=this.responseCache.get(c),l=Date.now();if(u){if(l-u.requestTimestamp<1e3*o)return this.responseCache.delete(c),this.responseCache.set(c,u),Promise.resolve(u.response);this.responseCache.delete(c)}const h=await t.call(e,...s);if(this.responseCache.set(c,{requestTimestamp:l,response:h}),this.responseCache.size>a){const e=this.responseCache.keys().next().value;this.responseCache.delete(e)}return h}}},8834:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(2554)),i=n(r(9777)),o=n(r(9092)),a=r(3320);t.default=class{constructor(e){(e.apiKey||"").length<2e3&&(e.sendApiKeyAsQueryParam=!0),this.configuration=new s.default(e),this.apiCall=new i.default(this.configuration),this.multiSearch=new o.default(this.apiCall,this.configuration,!0),this.individualCollections={}}collections(e){if(e)return void 0===this.individualCollections[e]&&(this.individualCollections[e]=new a.SearchOnlyCollection(e,this.apiCall,this.configuration)),this.individualCollections[e];throw new Error("Typesense.SearchClient only supports search operations, so the collectionName that needs to be searched must be specified. Use Typesense.Client if you need to access the collection object.")}}},3320:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SearchOnlyCollection=void 0;const n=r(5586);t.SearchOnlyCollection=class{constructor(e,t,r){this.name=e,this.apiCall=t,this.configuration=r,this._documents=new n.SearchOnlyDocuments(this.name,this.apiCall,this.configuration)}documents(){return this._documents}}},5586:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SearchOnlyDocuments=void 0;const s=n(r(2598)),i=n(r(6581));t.SearchOnlyDocuments=class{constructor(e,t,r){this.collectionName=e,this.apiCall=t,this.configuration=r,this.requestWithCache=new s.default}async search(e,{cacheSearchResultsForSeconds:t=this.configuration.cacheSearchResultsForSeconds,abortSignal:r=null}={}){let n={};!0===this.configuration.useServerSideSearchCache&&(n.use_cache=!0);const s=Object.assign({},e,n);return this.requestWithCache.perform(this.apiCall,this.apiCall.get,[this.endpointPath("search"),s,{abortSignal:r}],{cacheResponseForSeconds:t})}endpointPath(e){return`${i.default.RESOURCEPATH}/${this.collectionName}/documents${void 0===e?"":"/"+e}`}static get RESOURCEPATH(){return"/documents"}}},1483:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(6581)),i=n(r(1940));t.default=class{constructor(e,t,r){this.collectionName=e,this.synonymId=t,this.apiCall=r}async retrieve(){return this.apiCall.get(this.endpointPath())}async delete(){return this.apiCall.delete(this.endpointPath())}endpointPath(){return`${s.default.RESOURCEPATH}/${this.collectionName}${i.default.RESOURCEPATH}/${this.synonymId}`}}},1940:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=n(r(6581));class i{constructor(e,t){this.collectionName=e,this.apiCall=t}async upsert(e,t){return this.apiCall.put(this.endpointPath(e),t)}async retrieve(){return this.apiCall.get(this.endpointPath())}endpointPath(e){return`${s.default.RESOURCEPATH}/${this.collectionName}${i.RESOURCEPATH}${void 0===e?"":"/"+e}`}static get RESOURCEPATH(){return"/synonyms"}}t.default=i},9964:()=>{},8593:e=>{"use strict";e.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz","_integrity":"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==","_from":"axios@0.21.4"}')}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};return(()=>{"use strict";function e(e,t,r,n,s,i,o){try{var a=e[i](o),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,s)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(s,i){var o=t.apply(r,n);function a(t){e(o,s,i,a,c,"next",t)}function c(t){e(o,s,i,a,c,"throw",t)}a(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e}r.d(n,{default:()=>w});var a=r(7757),c=r.n(a),u=function(){function e(){var t,r,n,i,o,a,c,u,l,h,d=this,f=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,e),this.server=f.server||{nodes:[{host:"localhost",port:"8108",path:"",protocol:"http"}]},this.server.cacheSearchResultsForSeconds=null!==(t=this.server.cacheSearchResultsForSeconds)&&void 0!==t?t:120,this.additionalSearchParameters=null!==(r=f.additionalSearchParameters)&&void 0!==r?r:{},this.additionalSearchParameters.query_by=null!==(n=null!==(i=this.additionalSearchParameters.queryBy)&&void 0!==i?i:this.additionalSearchParameters.query_by)&&void 0!==n?n:"",this.additionalSearchParameters.sort_by=null!==(o=null!==(a=this.additionalSearchParameters.sortBy)&&void 0!==a?a:this.additionalSearchParameters.sort_by)&&void 0!==o?o:"",this.additionalSearchParameters.highlightFullFields=null!==(c=null!==(u=this.additionalSearchParameters.highlightFullFields)&&void 0!==u?u:this.additionalSearchParameters.highlight_full_fields)&&void 0!==c?c:this.additionalSearchParameters.query_by,this.geoLocationField=null!==(l=f.geoLocationField)&&void 0!==l?l:"_geoloc",this.collectionSpecificSearchParameters=null!==(h=f.collectionSpecificSearchParameters)&&void 0!==h?h:{},Object.keys(this.collectionSpecificSearchParameters).forEach((function(e){var t,r,n,s,i,o=d.collectionSpecificSearchParameters[e];o.query_by=null!==(t=o.queryBy)&&void 0!==t?t:o.query_by,o.sort_by=null!==(r=o.sortBy)&&void 0!==r?r:o.sort_by,o.highlightFullFields=null!==(n=null!==(s=null!==(i=o.highlightFullFields)&&void 0!==i?i:o.highlight_full_fields)&&void 0!==s?s:d.additionalSearchParameters.highlight_full_fields)&&void 0!==n?n:o.query_by}))}return o(e,[{key:"validate",value:function(){if((this.additionalSearchParameters.queryBy||Object.values(this.collectionSpecificSearchParameters).some((function(e){return e.queryBy})))&&console.warn("[typesense-instantsearch-adapter] Please use snake_cased versions of parameters in additionalSearchParameters instead of camelCased parameters. For example: Use query_by instead of queryBy. camelCased parameters will be deprecated in a future version. We're making this change so that parameter names are identical to the ones sent to Typesense (which are all snake_cased), and to also keep the types for these parameters in sync with the types defined in typesense-js."),0===this.additionalSearchParameters.query_by.length&&(0===Object.keys(this.collectionSpecificSearchParameters).length||Object.values(this.collectionSpecificSearchParameters).some((function(e){return 0===(e.query_by||"").length}))))throw new Error("[typesense-instantsearch-adapter] Missing parameter: Either additionalSearchParameters.query_by needs to be set, or all collectionSpecificSearchParameters need to have .query_by set")}}]),e}(),l=r(8871);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,s,i=[],o=!0,a=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){a=!0,s=e}finally{try{o||null==r.return||r.return()}finally{if(a)throw s}}return i}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=function(){function e(t,r,n){s(this,e),this.instantsearchRequests=t,this.typesenseClient=r,this.configuration=n,this.additionalSearchParameters=n.additionalSearchParameters,this.collectionSpecificSearchParameters=n.collectionSpecificSearchParameters}var r;return o(e,[{key:"_adaptFacetFilters",value:function(e){var t=this,r="";return e?r=e.map((function(e){if(Array.isArray(e)){var r={};e.forEach((function(e){var n=e.match(t.constructor.FILTER_STRING_MATCHING_REGEX),s="".concat(n[1]).concat(n[2]),i="".concat(n[3]);r[s]=r[s]||[],r[s].push(i)})),Object.keys(r).length>1&&console.error("[Typesense-Instantsearch-Adapter] Typesense does not support cross-field ORs at the moment. The adapter could not OR values between these fields: ".concat(Object.keys(r).join(",")));var n=Object.keys(r)[0],s=f(r[n].reduce((function(e,r){return r.startsWith("-")&&!t._isNumber(r)?e[0].push(r.substring(1)):e[1].push(r),e}),[[],[]]),2),i=s[0],o=s[1],a=[];return o.length>0&&a.push("".concat(n,":=[").concat(o.map((function(e){return t._escapeFacetValue(e)})).join(","),"]")),i.length>0&&a.push("".concat(n,":!=[").concat(i.map((function(e){return t._escapeFacetValue(e)})).join(","),"]")),a.filter((function(e){return e})).join(" && ")}var c=e.match(t.constructor.FILTER_STRING_MATCHING_REGEX),u="".concat(c[1]).concat(c[2]),l="".concat(c[3]);return l.startsWith("-")&&!t._isNumber(l)?"".concat(u,":!=[").concat(t._escapeFacetValue(l.substring(1)),"]"):"".concat(u,":=[").concat(t._escapeFacetValue(l),"]")})).join(" && "):r}},{key:"_escapeFacetValue",value:function(e){return"boolean"==typeof e||"true"===e||"false"===e||this._isNumber(e)?e:"`".concat(e,"`")}},{key:"_isNumber",value:function(e){return Number.isInteger(e%1)||!!(e%1)}},{key:"_adaptNumericFilters",value:function(e){var t="";if(!e)return t;var r={};e.forEach((function(e){var t=f(e.match(new RegExp("(.*)(<=|>=|>|<|:)(.*)")),4),n=t[1],s=t[2],i=t[3];r[n]=r[n]||{},r[n][s]=i}));var n=[];return Object.keys(r).forEach((function(e){null!=r[e]["<="]&&null!=r[e][">="]?n.push("".concat(e,":=[").concat(r[e][">="],"..").concat(r[e]["<="],"]")):null!=r[e]["<="]?n.push("".concat(e,":<=").concat(r[e]["<="])):null!=r[e][">="]?n.push("".concat(e,":>=").concat(r[e][">="])):console.warn("[Typesense-Instantsearch-Adapter] Unsupported operator found ".concat(JSON.stringify(r[e])))})),n.join(" && ")}},{key:"_adaptGeoFilter",value:function(e){var t=e.insideBoundingBox,r=e.aroundRadius,n=e.aroundLatLng,s=e.insidePolygon;if(t){var i,o,a,c;if(Array.isArray(t)){var u=f(t.flat(),4);i=u[0],o=u[1],a=u[2],c=u[3]}else{var l=f(t.split(","),4);i=l[0],o=l[1],a=l[2],c=l[3]}return"".concat(this.configuration.geoLocationField,":(").concat(i,", ").concat(o,", ").concat(i,", ").concat(c,", ").concat(a,", ").concat(c,", ").concat(a,", ").concat(o,")")}if(n||r){if(!r||"all"===r)throw new Error("[Typesense-Instantsearch-Adapter] In Typesense, geo-filtering around a lat/lng also requires a numerical radius. So the `aroundRadius` parameter is required when `aroundLatLng` is used. If you intend to just geo-sort around a lat/long, you want to use the sortBy InstantSearch widget (or a virtual sortBy custom widget).");var h="".concat(parseFloat(r)/1e3," km");return"".concat(this.configuration.geoLocationField,":(").concat(n,", ").concat(h,")")}if(s){var d=s;return Array.isArray(s)&&(d=s.flat().join(",")),"".concat(this.configuration.geoLocationField,":(").concat(d,")")}}},{key:"_adaptFilters",value:function(e){var t=[];return t.push(this._adaptFacetFilters(e.facetFilters)),t.push(this._adaptNumericFilters(e.numericFilters)),t.push(this._adaptGeoFilter(e)),t.filter((function(e){return e&&""!==e})).join(" && ")}},{key:"_adaptIndexName",value:function(e){return e.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[1]}},{key:"_adaptSortBy",value:function(e){return e.match(this.constructor.INDEX_NAME_MATCHING_REGEX)[3]}},{key:"_buildSearchParameters",value:function(e){for(var t=e.params,r=e.indexName,n=this._adaptIndexName(r),s={},i=0,o=Object.entries(this.additionalSearchParameters);i<o.length;i++){var a=f(o[i],2),c=a[0],u=a[1];s[this._camelToSnakeCase(c)]=u}if(this.collectionSpecificSearchParameters[n])for(var l=0,h=Object.entries(this.collectionSpecificSearchParameters[n]);l<h.length;l++){var d=f(h[l],2),p=d[0],y=d[1];s[this._camelToSnakeCase(p)]=y}var m=Object.assign({},s),v=this._adaptSortBy(r);return Object.assign(m,{collection:n,q:""===t.query||void 0===t.query?"*":t.query,facet_by:[t.facets].flat().join(","),filter_by:this._adaptFilters(t)||s.filter_by,sort_by:v||s.sort_by,max_facet_values:t.maxValuesPerFacet,page:(t.page||0)+1}),t.hitsPerPage&&(m.per_page=t.hitsPerPage),t.facetQuery&&(m.facet_query="".concat(t.facetName,":").concat(t.facetQuery),m.per_page=0),m}},{key:"_camelToSnakeCase",value:function(e){return e.split(/(?=[A-Z])/).join("_").toLowerCase()}},{key:"request",value:(r=t(c().mark((function e(){var t,r=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.instantsearchRequests.map((function(e){return r._buildSearchParameters(e)})),e.abrupt("return",this.typesenseClient.multiSearch.perform({searches:t}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})}],[{key:"INDEX_NAME_MATCHING_REGEX",get:function(){return new RegExp("^(.+?)(?=(/sort/(.*))|$)")}},{key:"FILTER_STRING_MATCHING_REGEX",get:function(){return new RegExp("(.*)((?!:).):(?!:)(.*)")}}]),e}();function y(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v={_adaptHighlightTag:function(e,t,r){return e.replace(new RegExp("<mark>","g"),t||"<mark>").replace(new RegExp("</mark>","g"),r||"</mark>")},_adaptNumberOfPages:function(){var e=this.typesenseResponse.found/this.typesenseResponse.request_params.per_page;return Number.isFinite(e)?Math.ceil(e):1}};function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var _=function(){function e(t,r,n){s(this,e),this.typesenseResponse=t,this.instantsearchRequest=r,this.configuration=n}return o(e,[{key:"_adaptGroupedHits",value:function(e){var t=this;return e.map((function(e){return t._adaptHits(e.hits)})).flat()}},{key:"_adaptHits",value:function(e){var t=this;return e.map((function(e){var r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e.document);r.objectID=e.document.id,r._snippetResult=t._adaptHighlightResult(e,"snippet"),r._highlightResult=t._adaptHighlightResult(e,"value"),r.text_match||(r.text_match=e.text_match);var n=r[t.configuration.geoLocationField];return n&&(r._geoloc={lat:n[0],lng:n[1]}),r}))}},{key:"_adaptHighlightResult",value:function(e,t){var r=this,n=Object.assign.apply(Object,[{}].concat(y(Object.entries(e.document).map((function(e){var t=f(e,2);return m({},t[0],{value:t[1],matchLevel:"none",matchedWords:[]})})))));return e.highlights.forEach((function(e){n[e.field]={value:e[t]||e["".concat(t,"s")],matchLevel:"full",matchedWords:e.matched_tokens},e.indices&&(n[e.field].matchedIndices=e.indices)})),Object.entries(n).forEach((function(t){var s=f(t,2),i=s[0],o=s[1],a=i,c=o.value,u=o.matchLevel,l=o.matchedWords,h=o.matchedIndices;Array.isArray(c)?(n[a]=[],e.document[a].forEach((function(e,t){h&&h.includes(t)?n[a].push({value:r._adaptHighlightTag("".concat(c[h.indexOf(t)]),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag),matchLevel:u,matchedWords:l[t]}):n[a].push({value:"".concat(e),matchLevel:"none",matchedWords:[]})}))):n[a].value=r._adaptHighlightTag("".concat(c),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag)})),n}},{key:"_adaptFacets",value:function(e){var t={};return e.forEach((function(e){Object.assign(t,m({},e.field_name,Object.assign.apply(Object,[{}].concat(y(e.counts.map((function(e){return m({},e.value,e.count)})))))))})),t}},{key:"_adaptFacetStats",value:function(e){var t={};return e.forEach((function(e){Object.keys(e.stats).length>0&&Object.assign(t,m({},e.field_name,e.stats))})),t}},{key:"adapt",value:function(){return{hits:this.typesenseResponse.grouped_hits?this._adaptGroupedHits(this.typesenseResponse.grouped_hits):this._adaptHits(this.typesenseResponse.hits),nbHits:this.typesenseResponse.found,page:this.typesenseResponse.page-1,nbPages:this._adaptNumberOfPages(),hitsPerPage:this.typesenseResponse.request_params.per_page,facets:this._adaptFacets(this.typesenseResponse.facet_counts||[]),facets_stats:this._adaptFacetStats(this.typesenseResponse.facet_counts||{}),query:this.typesenseResponse.request_params.q,processingTimeMS:this.typesenseResponse.search_time_ms}}}]),e}();Object.assign(_.prototype,v);var b=function(){function e(t,r){s(this,e),this.typesenseResponse=t,this.instantsearchRequest=r}return o(e,[{key:"_adaptFacetHits",value:function(e){var t=this;return e.find((function(e){return e.field_name===t.instantsearchRequest.params.facetName})).counts.map((function(e){return{value:e.value,highlighted:t._adaptHighlightTag(e.highlighted,t.instantsearchRequest.params.highlightPreTag,t.instantsearchRequest.params.highlightPostTag),count:e.count}}))}},{key:"adapt",value:function(){return{facetHits:this._adaptFacetHits(this.typesenseResponse.facet_counts),exhaustiveFacetsCount:!0,processingTimeMS:this.typesenseResponse.search_time_ms}}}]),e}();Object.assign(b.prototype,v);var w=function(){function e(t){var r=this;s(this,e),this.configuration=new u(t),this.configuration.validate(),this.typesenseClient=new l.SearchClient(this.configuration.server),this.searchClient={clearCache:function(){return r.clearCache()},search:function(e){return r.searchTypesenseAndAdapt(e)},searchForFacetValues:function(e){return r.searchTypesenseForFacetValuesAndAdapt(e)}}}var r,n,i;return o(e,[{key:"searchTypesenseAndAdapt",value:(i=t(c().mark((function e(t){var r,n,s=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._adaptAndPerformTypesenseRequest(t);case 3:return r=e.sent,n=r.results.map((function(e,r){return s._validateTypesenseResult(e),new _(e,t[r],s.configuration).adapt()})),e.abrupt("return",{results:n});case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(e){return i.apply(this,arguments)})},{key:"searchTypesenseForFacetValuesAndAdapt",value:(n=t(c().mark((function e(t){var r,n,s=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._adaptAndPerformTypesenseRequest(t);case 3:return r=e.sent,n=r.results.map((function(e,r){return s._validateTypesenseResult(e),new b(e,t[r],s.configuration).adapt()})),e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(e){return n.apply(this,arguments)})},{key:"_adaptAndPerformTypesenseRequest",value:(r=t(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new p(t,this.typesenseClient,this.configuration),e.next=3,r.request();case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"clearCache",value:function(){return this.typesenseClient=new l.SearchClient(this.configuration.server),this.searchClient}},{key:"_validateTypesenseResult",value:function(e){if(e.error)throw new Error("".concat(e.code," - ").concat(e.error));if(!e.hits&&!e.grouped_hits)throw new Error("Did not find any hits. ".concat(e.code," - ").concat(e.error))}}]),e}()})(),n.default})()}));
|
|
2
2
|
//# sourceMappingURL=typesense-instantsearch-adapter.min.js.map
|