typesense-instantsearch-adapter 2.3.0 → 2.3.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.
|
@@ -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={7228:e=>{e.exports=function(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},e.exports.default=e.exports,e.exports.__esModule=!0},3646:(e,t,r)=>{var n=r(7228);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.default=e.exports,e.exports.__esModule=!0},1506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},8926:e=>{function t(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=e.apply(r,n);function s(e){t(i,o,a,s,u,"next",e)}function u(e){t(i,o,a,s,u,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},4575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},9100:(e,t,r)=>{var n=r(9489),o=r(7067);function a(t,r,i){return o()?(e.exports=a=Reflect.construct,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=a=function(e,t,r){var o=[null];o.push.apply(o,t);var a=new(Function.bind.apply(e,o));return r&&n(a,r.prototype),a},e.exports.default=e.exports,e.exports.__esModule=!0),a.apply(null,arguments)}e.exports=a,e.exports.default=e.exports,e.exports.__esModule=!0},3913:e=>{function t(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)}}e.exports=function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0},9754:e=>{function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},2205:(e,t,r)=>{var n=r(9489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},5318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},430:e=>{e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.default=e.exports,e.exports.__esModule=!0},7067:e=>{e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0},6860:e=>{e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0},8206:e=>{e.exports=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.")},e.exports.default=e.exports,e.exports.__esModule=!0},8585:(e,t,r)=>{var n=r(8).default,o=r(1506);e.exports=function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)},e.exports.default=e.exports,e.exports.__esModule=!0},9489:e=>{function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(r,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},319:(e,t,r)=>{var n=r(3646),o=r(6860),a=r(379),i=r(8206);e.exports=function(e){return n(e)||o(e)||a(e)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},8:e=>{function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},379:(e,t,r)=>{var n=r(7228);e.exports=function(e,t){if(e){if("string"==typeof e)return n(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)?n(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},5957:(e,t,r)=>{var n=r(9754),o=r(9489),a=r(430),i=r(9100);function s(t){var r="function"==typeof Map?new Map:void 0;return e.exports=s=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return i(e,arguments,n(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o(t,e)},e.exports.default=e.exports,e.exports.__esModule=!0,s(t)}e.exports=s,e.exports.default=e.exports,e.exports.__esModule=!0},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),o=r(6026),a=r(4372),i=r(5327),s=r(4097),u=r(4109),c=r(7985),l=r(5061);e.exports=function(e){return new Promise((function(t,r){var f=e.data,d=e.headers,h=e.responseType;n.isFormData(f)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var v=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(v+":"+y)}var m=s(e.baseURL,e.url);function g(){if(p){var n="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,a={data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};o(t,r,a),p=null}}if(p.open(e.method.toUpperCase(),i(m,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||c(m))&&e.xsrfCookieName?a.read(e.xsrfCookieName):void 0;_&&(d[e.xsrfHeaderName]=_)}"setRequestHeader"in p&&n.forEach(d,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),h&&"json"!==h&&(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)})),f||(f=null),p.send(f)}))}},1609:(e,t,r)=>{"use strict";var n=r(4867),o=r(1849),a=r(321),i=r(7185);function s(e){var t=new a(e),r=o(a.prototype.request,t);return n.extend(r,a.prototype,t),n.extend(r,t),r}var u=s(r(5655));u.Axios=a,u.create=function(e){return s(i(u.defaults,e))},u.Cancel=r(5263),u.CancelToken=r(4972),u.isCancel=r(6502),u.all=function(e){return Promise.all(e)},u.spread=r(8713),u.isAxiosError=r(6268),e.exports=u,e.exports.default=u},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 o(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))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(4867),o=r(5327),a=r(782),i=r(3572),s=r(7185),u=r(4875),c=u.validators;function l(e){this.defaults=e,this.interceptors={request:new a,response:new a}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(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&&u.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean,"1.0.0"),forcedJSONParsing:c.transitional(c.boolean,"1.0.0"),clarifyTimeoutError:c.transitional(c.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 o,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!n){var l=[i,void 0];for(Array.prototype.unshift.apply(l,r),l=l.concat(a),o=Promise.resolve(e);l.length;)o=o.then(l.shift(),l.shift());return o}for(var f=e;r.length;){var d=r.shift(),h=r.shift();try{f=d(f)}catch(e){h(e);break}}try{o=i(f)}catch(e){return Promise.reject(e)}for(;a.length;)o=o.then(a.shift(),a.shift());return o},l.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,r){return this.request(s(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(s(n||{},{method:e,url:t,data:r}))}})),e.exports=l},782:(e,t,r)=>{"use strict";var n=r(4867);function o(){this.handlers=[]}o.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},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},4097:(e,t,r)=>{"use strict";var n=r(1793),o=r(7303);e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},5061:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,o,a){var i=new Error(e);return n(i,t,r,o,a)}},3572:(e,t,r)=>{"use strict";var n=r(4867),o=r(8527),a=r(6502),i=r(5655);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=o.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||i.adapter)(e).then((function(t){return s(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return a(t)||(s(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,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={},o=["url","method","data"],a=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function u(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 c(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(a,c),n.forEach(i,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(void 0,t[o])})),n.forEach(s,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var l=o.concat(a).concat(i).concat(s),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(f,c),r}},6026:(e,t,r)=>{"use strict";var n=r(5061);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(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),o=r(5655);e.exports=function(e,t,r){var a=this||o;return n.forEach(r,(function(r){e=r.call(a,e,t)})),e}},5655:(e,t,r)=>{"use strict";var n=r(4867),o=r(6016),a=r(481),i={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r(5448)),u),transformRequest:[function(e,t){return o(t,"Accept"),o(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)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(s(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,o=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||o&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw a(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){c.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){c.headers[e]=n.merge(i)})),e.exports=c},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 o(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 a;if(r)a=r(t);else if(n.isURLSearchParams(t))a=t.toString();else{var i=[];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)),i.push(o(t)+"="+o(e))})))})),a=i.join("&")}if(a){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+a}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,o,a,i){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(o)&&s.push("path="+o),n.isString(a)&&s.push("domain="+a),!0===i&&s.push("secure"),document.cookie=s.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 o(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=o(window.location.href),function(t){var r=n.isString(t)?o(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),o=["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,a,i={};return e?(n.forEach(e.split("\n"),(function(e){if(a=e.indexOf(":"),t=n.trim(e.substr(0,a)).toLowerCase(),r=n.trim(e.substr(a+1)),t){if(i[t]&&o.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},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),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var a={},i=n.version.split(".");function s(e,t){for(var r=t?t.split("."):i,n=e.split("."),o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}o.transitional=function(e,t,r){var o=t&&s(t);function i(e,t){return"[Axios v"+n.version+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,n,s){if(!1===e)throw new Error(i(n," has been removed in "+t));return o&&!a[n]&&(a[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,s)}},e.exports={isOlderVersion:s,assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var a=n[o],i=t[a];if(i){var s=e[a],u=void 0===s||i(s,a,e);if(!0!==u)throw new TypeError("option "+a+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+a)}},validators:o}},4867:(e,t,r)=>{"use strict";var n=r(1849),o=Object.prototype.toString;function a(e){return"[object Array]"===o.call(e)}function i(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===o.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:a,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(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:s,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return s(e)&&c(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){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):a(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,o){e[o]=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,o;!function(a,i){"use strict";void 0===(o="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 o(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 a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function i(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?a:void 0!==console[n]?o(console,n):void 0!==console.log?o(console,"log"):e)}function s(t,r){for(var o=0;o<n.length;o++){var a=n[o];this[a]=o<t?e:this.methodFactory(a,t,r)}this.log=this.debug}function u(e,r,n){return function(){typeof console!==t&&(s.call(this,r,n),this[e].apply(this,arguments))}}function c(e,t,r){return i(e)||u.apply(this,arguments)}function l(e,r,o){var a,i=this,u="loglevel";function l(){var e;if(typeof window!==t&&u){try{e=window.localStorage[u]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(u)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===i.levels[e]&&(e=void 0),e}}"string"==typeof e?u+=":"+e:"symbol"==typeof e&&(u=void 0),i.name=e,i.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},i.methodFactory=o||c,i.getLevel=function(){return a},i.setLevel=function(r,o){if("string"==typeof r&&void 0!==i.levels[r.toUpperCase()]&&(r=i.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=i.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(a=r,!1!==o&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&u){try{return void(window.localStorage[u]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(u)+"="+r+";"}catch(e){}}}(r),s.call(i,r,e),typeof console===t&&r<i.levels.SILENT)return"No console available for logging"},i.setDefaultLevel=function(e){l()||i.setLevel(e,!1)},i.enableAll=function(e){i.setLevel(i.levels.TRACE,e)},i.disableAll=function(e){i.setLevel(i.levels.SILENT,e)};var f=l();null==f&&(f=null==r?"WARN":r),i.setLevel(f,!1)}var f=new l,d={};f.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,f.getLevel(),f.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return f.noConflict=function(){return typeof window!==t&&window.log===f&&(window.log=h),f},f.getLoggers=function(){return d},f.default=f,f})?n.call(t,r,t,e):n)||(e.exports=o)}()},5666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,a=Object.create(o.prototype),i=new E(n||[]);return a._invoke=function(e,t,r){var n=f;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw a;return C()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=S(i,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?p:d,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,i),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",d="suspendedYield",h="executing",p="completed",v={};function y(){}function m(){}function g(){}var _={};u(_,a,(function(){return this}));var b=Object.getPrototypeOf,x=b&&b(b(j([])));x&&x!==r&&n.call(x,a)&&(_=x);var w=g.prototype=y.prototype=Object.create(_);function P(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,t){function r(o,a,i,s){var u=l(e[o],e,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(f).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(u.arg)}var o;this._invoke=function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}}function S(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,S(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function O(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function j(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:C}}function C(){return{value:t,done:!0}}return m.prototype=g,u(w,"constructor",g),u(g,"constructor",m),m.displayName=u(g,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},P(R.prototype),u(R.prototype,i,(function(){return this})),e.AsyncIterator=R,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new R(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},P(w),u(w,s,"Generator"),u(w,a,(function(){return this})),u(w,"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,E.prototype={constructor:E,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(k),!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 o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(i)},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),v},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),k(r),v}},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 o=n.arg;k(r)}return o}}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),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},8871:(e,t,r)=>{"use strict";var n=r(5318),o=r(8);Object.defineProperty(t,"w9",{enumerable:!0,get:function(){return a.default}});n(r(4339));var a=n(r(8834));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}!function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=a?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(n,s,u):n[s]=e[s]}n.default=e,r&&r.set(e,n)}(r(6718))},8480:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(5346)),s=function(){function e(t,r){(0,o.default)(this,e),this._apiCall=r,this._name=t}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._name)}}]),e}();t.default=s},5346:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i="/aliases",s=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"upsert",value:function(e,t){return this._apiCall.put(this._endpointPath(e),t)}},{key:"retrieve",value:function(e){return this._apiCall.get(i)}},{key:"_endpointPath",value:function(t){return"".concat(e.RESOURCEPATH,"/").concat(t)}}],[{key:"RESOURCEPATH",get:function(){return i}}]),e}();t.default=s},9777:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(7757)),a=n(r(8926)),i=n(r(4575)),s=n(r(3913)),u=n(r(9669)),c=r(6718),l=!0,f=function(){function e(t){(0,i.default)(this,e),this._configuration=t,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.logger=this._configuration.logger,this._initializeMetadataForNodes(),this._currentNodeIndex=-1}var t,r;return(0,s.default)(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.performRequest("get",e,{queryParameters:t})}},{key:"delete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.performRequest("delete",e,{queryParameters:t})}},{key:"post",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.performRequest("post",e,{queryParameters:r,bodyParameters:t,additionalHeaders:n})}},{key:"put",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.performRequest("put",e,{queryParameters:r,bodyParameters:t})}},{key:"patch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.performRequest("patch",e,{queryParameters:r,bodyParameters:t})}},{key:"performRequest",value:(r=(0,a.default)(o.default.mark((function e(t,r,n){var a,i,s,c,f,d,h,p,v,y,m,g;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=n.queryParameters,i=void 0===a?null:a,s=n.bodyParameters,c=void 0===s?null:s,f=n.additionalHeaders,d=void 0===f?{}:f,this._configuration.validate(),h=Date.now(),this.logger.debug("Request #".concat(h,": Performing ").concat(t.toUpperCase()," request: ").concat(r)),v=1;case 5:if(!(v<=this._numRetriesPerRequest+1)){e.next=40;break}return y=this._getNextNode(h),this.logger.debug("Request #".concat(h,": Attempting ").concat(t.toUpperCase()," request Try #").concat(v," to Node ").concat(y.index)),e.prev=8,m={method:t,url:this._uriFor(r,y),headers:Object.assign({},this._defaultHeaders(),d),timeout:1e3*this._connectionTimeoutSeconds,maxContentLength:1/0,maxBodyLength:1/0,validateStatus:function(e){return e>0},transformResponse:[function(e,t){var r=e;return void 0!==t&&"string"==typeof e&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(r=JSON.parse(e)),r}]},i&&0!==Object.keys(i).length&&(m.params=i),this._sendApiKeyAsQueryParam&&(m.params=m.params||{},m.params["x-typesense-api-key"]=this._apiKey),c&&0!==Object.keys(c).length&&(m.data=c),e.next=15,(0,u.default)(m);case 15:if((g=e.sent).status>=1&&g.status<=499&&this._setNodeHealthcheck(y,l),this.logger.debug("Request #".concat(h,": Request to Node ").concat(y.index," was made. Response Code was ").concat(g.status,".")),!(g.status>=200&&g.status<300)){e.next=22;break}return e.abrupt("return",Promise.resolve(g.data));case 22:if(!(g.status<500)){e.next=26;break}return e.abrupt("return",Promise.reject(this._customErrorForResponse(g,g.data.message)));case 26:throw this._customErrorForResponse(g,g.data.message);case 27:e.next=37;break;case 29:return e.prev=29,e.t0=e.catch(8),this._setNodeHealthcheck(y,!1),p=e.t0,this.logger.warn("Request #".concat(h,": Request to Node ").concat(y.index,' failed due to "').concat(e.t0.code," ").concat(e.t0.message).concat(null==e.t0.response?"":" - "+JSON.stringify(e.t0.response.data),'"')),this.logger.warn("Request #".concat(h,": Sleeping for ").concat(this._retryIntervalSeconds,"s and then retrying request...")),e.next=37,this._timer(this._retryIntervalSeconds);case 37:v++,e.next=5;break;case 40:return this.logger.debug("Request #".concat(h,": No retries left. Raising last error")),e.abrupt("return",Promise.reject(p));case 42:case"end":return e.stop()}}),e,this,[[8,29]])}))),function(e,t,n){return r.apply(this,arguments)})},{key:"_getNextNode",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(null!=this._nearestNode){if(this.logger.debug("Request #".concat(t,": Nodes Health: Node ").concat(this._nearestNode.index," is ").concat(!0===this._nearestNode.isHealthy?"Healthy":"Unhealthy")),!0===this._nearestNode.isHealthy||this._nodeDueForHealthcheck(this._nearestNode,t))return this.logger.debug("Request #".concat(t,": Updated current node to Node ").concat(this._nearestNode.index)),this._nearestNode;this.logger.debug("Request #".concat(t,": Falling back to individual nodes"))}this.logger.debug("Request #".concat(t,": Nodes Health: ").concat(this._nodes.map((function(e){return"Node ".concat(e.index," is ").concat(!0===e.isHealthy?"Healthy":"Unhealthy")})).join(" || ")));for(var r=0;r<=this._nodes.length;r++)if(this._currentNodeIndex=(this._currentNodeIndex+1)%this._nodes.length,!0===(e=this._nodes[this._currentNodeIndex]).isHealthy||this._nodeDueForHealthcheck(e,t))return this.logger.debug("Request #".concat(t,": Updated current node to Node ").concat(e.index)),e;return this.logger.debug("Request #".concat(t,": No healthy nodes were found. Returning the next node, Node ").concat(e.index)),e}},{key:"_nodeDueForHealthcheck",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=Date.now()-e.lastAccessTimestamp>1e3*this._healthcheckIntervalSeconds;return r&&this.logger.debug("Request #".concat(t,": Node ").concat(e.index," has exceeded healtcheckIntervalSeconds of ").concat(this._healthcheckIntervalSeconds,". Adding it back into rotation.")),r}},{key:"_initializeMetadataForNodes",value:function(){var e=this;null!=this._nearestNode&&(this._nearestNode.index="nearestNode",this._setNodeHealthcheck(this._nearestNode,l)),this._nodes.forEach((function(t,r){t.index=r,e._setNodeHealthcheck(t,l)}))}},{key:"_setNodeHealthcheck",value:function(e,t){e.isHealthy=t,e.lastAccessTimestamp=Date.now()}},{key:"_uriFor",value:function(e,t){return"".concat(t.protocol,"://").concat(t.host,":").concat(t.port).concat(t.path).concat(e)}},{key:"_defaultHeaders",value:function(){var e={};return this._sendApiKeyAsQueryParam||(e["X-TYPESENSE-API-KEY"]=this._apiKey),e["Content-Type"]="application/json",e}},{key:"_timer",value:(t=(0,a.default)(o.default.mark((function e(t){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return setTimeout(e,1e3*t)})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"_customErrorForResponse",value:function(e,t){var r;r=400===e.status?c.RequestMalformed:401===e.status?c.RequestUnauthorized:404===e.status?c.ObjectNotFound:409===e.status?c.ObjectAlreadyExists:422===e.status?c.ObjectUnprocessable:e.status>=500&&e.status<=599?c.ServerError:c.HTTPError;var n="Request failed with HTTP code ".concat(e.status);"string"==typeof t&&""!==t.trim()&&(n+=" | Server said: ".concat(t));var o=new r(n);return o.httpStatus=e.status,o}}]),e}();t.default=f},4339:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(2554)),s=n(r(9777)),u=n(r(6581)),c=n(r(8243)),l=n(r(5346)),f=n(r(8480)),d=n(r(2708)),h=n(r(7309)),p=n(r(7634)),v=n(r(6029)),y=n(r(1930)),m=n(r(3095)),g=n(r(9092)),_=function(){function e(t){(0,o.default)(this,e),this.configuration=new i.default(t),this._apiCall=new s.default(this.configuration),this.debug=new p.default(this._apiCall),this.metrics=new v.default(this._apiCall),this.health=new y.default(this._apiCall),this.operations=new m.default(this._apiCall),this.multiSearch=new g.default(this._apiCall,this.configuration),this._collections=new u.default(this._apiCall),this._individualCollections={},this._aliases=new l.default(this._apiCall),this._individualAliases={},this._keys=new d.default(this._apiCall),this._individualKeys={}}return(0,a.default)(e,[{key:"collections",value:function(e){return void 0===e?this._collections:(void 0===this._individualCollections[e]&&(this._individualCollections[e]=new c.default(e,this._apiCall,this.configuration)),this._individualCollections[e])}},{key:"aliases",value:function(e){return void 0===e?this._aliases:(void 0===this._individualAliases[e]&&(this._individualAliases[e]=new f.default(e,this._apiCall)),this._individualAliases[e])}},{key:"keys",value:function(e){return void 0===e?this._keys:(void 0===this._individualKeys[e]&&(this._individualKeys[e]=new h.default(e,this._apiCall)),this._individualKeys[e])}}]),e}();t.default=_},8243:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=n(r(1949)),u=n(r(9071)),c=n(r(6067)),l=n(r(3620)),f=n(r(1940)),d=n(r(1483)),h=function(){function e(t,r,n){(0,o.default)(this,e),this._name=t,this._apiCall=r,this._configuration=n,this._documents=new s.default(this._name,this._apiCall,this._configuration),this._individualDocuments={},this._overrides=new c.default(this._name,this._apiCall),this._individualOverrides={},this._synonyms=new f.default(this._name,this._apiCall),this._individualSynonyms={}}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"documents",value:function(e){return void 0===e?this._documents:(void 0===this._individualDocuments[e]&&(this._individualDocuments[e]=new u.default(this._name,e,this._apiCall)),this._individualDocuments[e])}},{key:"overrides",value:function(e){return void 0===e?this._overrides:(void 0===this._individualOverrides[e]&&(this._individualOverrides[e]=new l.default(this._name,e,this._apiCall)),this._individualOverrides[e])}},{key:"synonyms",value:function(e){return void 0===e?this._synonyms:(void 0===this._individualSynonyms[e]&&(this._individualSynonyms[e]=new d.default(this._name,e,this._apiCall)),this._individualSynonyms[e])}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._name)}}]),e}();t.default=h},6581:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i="/collections",s=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"create",value:function(e){return this._apiCall.post(i,e)}},{key:"retrieve",value:function(e){return this._apiCall.get(i)}}],[{key:"RESOURCEPATH",get:function(){return i}}]),e}();t.default=s},2554:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(2043)),s=r(6718),u=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,o.default)(this,e),this.nodes=r.nodes||[],this.nodes=this.nodes.map((function(e){return t._setDefaultPathInNode(e)})).map((function(e){return t._setDefaultPortInNode(e)})),this.nearestNode=r.nearestNode||null,this.nearestNode=this._setDefaultPathInNode(this.nearestNode),this.nearestNode=this._setDefaultPortInNode(this.nearestNode),this.connectionTimeoutSeconds=r.connectionTimeoutSeconds||r.timeoutSeconds||10,this.healthcheckIntervalSeconds=r.healthcheckIntervalSeconds||15,this.numRetries=r.numRetries||this.nodes.length+(null==this.nearestNode?0:1)||3,this.retryIntervalSeconds=r.retryIntervalSeconds||.1,this.apiKey=r.apiKey,this.sendApiKeyAsQueryParam=r.sendApiKeyAsQueryParam||!1,this.cacheSearchResultsForSeconds=r.cacheSearchResultsForSeconds||0,this.useServerSideSearchCache=r.useServerSideSearchCache||!1,this.logger=r.logger||i.default,this.logLevel=r.logLevel||"warn",this.logger.setLevel(this.logLevel),this._showDeprecationWarnings(r),this.validate()}return(0,a.default)(e,[{key:"validate",value:function(){if(null==this.nodes||0===this.nodes.length||this._validateNodes())throw new s.MissingConfigurationError("Ensure that nodes[].protocol, nodes[].host and nodes[].port are set");if(null!=this.nearestNode&&this._isNodeMissingAnyParameters(this.nearestNode))throw new s.MissingConfigurationError("Ensure that nearestNodes.protocol, nearestNodes.host and nearestNodes.port are set");if(null==this.apiKey)throw new s.MissingConfigurationError("Ensure that apiKey is set");return!0}},{key:"_validateNodes",value:function(){var e=this;return this.nodes.some((function(t){return e._isNodeMissingAnyParameters(t)}))}},{key:"_isNodeMissingAnyParameters",value:function(e){return!["protocol","host","port","path"].every((function(t){return e.hasOwnProperty(t)}))}},{key:"_setDefaultPathInNode",value:function(e){return null==e||e.hasOwnProperty("path")||(e.path=""),e}},{key:"_setDefaultPortInNode",value:function(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}},{key:"_showDeprecationWarnings",value:function(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")}}]),e}();t.default=u},7634:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get("/debug")}}]),e}();t.default=i},9071:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=n(r(1949)),u=function(){function e(t,r,n){(0,o.default)(this,e),this._collectionName=t,this._documentId=r,this._apiCall=n}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.patch(this._endpointPath(),e,t)}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._collectionName).concat(s.default.RESOURCEPATH,"/").concat(this._documentId)}}]),e}();t.default=u},1949:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(7757)),a=n(r(8926)),i=n(r(4575)),s=n(r(3913)),u=n(r(6581)),c=n(r(2598)),l=r(6718),f=function(){function e(t,r,n){(0,i.default)(this,e),this._collectionName=t,this._apiCall=r,this._configuration=n,this._requestWithCache=new c.default}var t,r;return(0,s.default)(e,[{key:"create",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.post(this._endpointPath(),e,t)}},{key:"upsert",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.post(this._endpointPath(),e,Object.assign({},t,{action:"upsert"}))}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.post(this._endpointPath(),e,Object.assign({},t,{action:"update"}))}},{key:"delete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._apiCall.delete(this._endpointPath(),e)}},{key:"createMany",value:(r=(0,a.default)(o.default.mark((function e(t){var r,n=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},this._apiCall.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"),e.abrupt("return",this.import(t,r));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"import",value:(t=(0,a.default)(o.default.mark((function e(t){var r,n,a,i,s,u=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},n=Array.isArray(t)?t.map((function(e){return JSON.stringify(e)})).join("\n"):t,e.next=4,this._apiCall.performRequest("post",this._endpointPath("import"),{queryParameters:r,bodyParameters:n,additionalHeaders:{"Content-Type":"text/plain"}});case 4:if(a=e.sent,!Array.isArray(t)){e.next=15;break}if(i=a.split("\n").map((function(e){return JSON.parse(e)})),!((s=i.filter((function(e){return!1===e.success}))).length>0)){e.next=12;break}throw new l.ImportError("".concat(i.length-s.length," documents imported successfully, ").concat(s.length," documents failed during import. Use `error.importResults` from the raised exception to get a detailed error reason for each document."),i);case 12:return e.abrupt("return",i);case 13:e.next=16;break;case 15:return e.abrupt("return",a);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"export",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._apiCall.get(this._endpointPath("export"),e)}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.cacheSearchResultsForSeconds,n=void 0===r?this._configuration.cacheSearchResultsForSeconds:r,o={};!0===this._configuration.useServerSideSearchCache&&(o.use_cache=!0);var a=Object.assign({},e,o);return this._requestWithCache.perform(this._apiCall,this._apiCall.get,[this._endpointPath("search"),a],{cacheResponseForSeconds:n})}},{key:"_endpointPath",value:function(t){return"".concat(u.default.RESOURCEPATH,"/").concat(this._collectionName).concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)}}],[{key:"RESOURCEPATH",get:function(){return"/documents"}}]),e}();t.default=f},7117:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},9229:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(e,t){var r;return(0,o.default)(this,u),(r=n.call(this,e)).importResults=t,r}return u}(n(r(4492)).default);t.default=u},1254:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},4105:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},3836:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},220:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},4913:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},9976:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},4959:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}(n(r(4492)).default);t.default=u},4492:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(2205)),i=n(r(8585)),s=n(r(9754));var u=function(e){(0,a.default)(u,e);var t,r,n=(t=u,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,s.default)(t);if(r){var o=(0,s.default)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return(0,i.default)(this,e)});function u(){return(0,o.default)(this,u),n.apply(this,arguments)}return u}((0,n(r(5957)).default)(Error));t.default=u},6718:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HTTPError",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"MissingConfigurationError",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"ObjectAlreadyExists",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"ObjectNotFound",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"ObjectUnprocessable",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"RequestMalformed",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"RequestUnauthorized",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"ServerError",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"ImportError",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"TypesenseError",{enumerable:!0,get:function(){return h.default}});var o=n(r(7117)),a=n(r(1254)),i=n(r(4105)),s=n(r(3836)),u=n(r(220)),c=n(r(4913)),l=n(r(9976)),f=n(r(4959)),d=n(r(9229)),h=n(r(4492))},1930:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get("/health")}}]),e}();t.default=i},7309:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(2708)),s=function(){function e(t,r){(0,o.default)(this,e),this._apiCall=r,this._id=t}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._id)}}]),e}();t.default=s},2708:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=r(9964),s="/keys",u=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"create",value:function(t){return this._apiCall.post(e.RESOURCEPATH,t)}},{key:"retrieve",value:function(){return this._apiCall.get(s)}},{key:"generateScopedSearchKey",value:function(e,t){var r=JSON.stringify(t),n=Buffer.from((0,i.createHmac)("sha256",e).update(r).digest("base64")),o=e.substr(0,4),a="".concat(n).concat(o).concat(r);return Buffer.from(a).toString("base64")}}],[{key:"RESOURCEPATH",get:function(){return s}}]),e}();t.default=u},6029:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get("/metrics.json")}}]),e}();t.default=i},9092:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(2598)),s="/multi_search",u=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,o.default)(this,e),this._apiCall=t,this._configuration=r,this._useTextContentType=n,this._requestWithCache=new i.default}return(0,a.default)(e,[{key:"perform",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.cacheSearchResultsForSeconds,o=void 0===n?this._configuration.cacheSearchResultsForSeconds:n,a={};this._useTextContentType&&(a["content-type"]="text/plain");var i={};!0===this._configuration.useServerSideSearchCache&&(i.use_cache=!0);var u=Object.assign({},t,i);return this._requestWithCache.perform(this._apiCall,this._apiCall.post,[s,e,u,a],{cacheResponseForSeconds:o})}}]),e}();t.default=u},3095:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i="/operations",s=function(){function e(t){(0,o.default)(this,e),this._apiCall=t}return(0,a.default)(e,[{key:"perform",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._apiCall.post("".concat(i,"/").concat(e),{},t)}}]),e}();t.default=s},3620:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=n(r(6067)),u=function(){function e(t,r,n){(0,o.default)(this,e),this._collectionName=t,this._overrideId=r,this._apiCall=n}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._collectionName).concat(s.default.RESOURCEPATH,"/").concat(this._overrideId)}}]),e}();t.default=u},6067:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=function(){function e(t,r){(0,o.default)(this,e),this._collectionName=t,this._apiCall=r}return(0,a.default)(e,[{key:"upsert",value:function(e,t){return this._apiCall.put(this._endpointPath(e),t)}},{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"_endpointPath",value:function(t){return"".concat(i.default.RESOURCEPATH,"/").concat(this._collectionName).concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)}}],[{key:"RESOURCEPATH",get:function(){return"/overrides"}}]),e}();t.default=s},2598:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(7757)),a=n(r(319)),i=n(r(8926)),s=n(r(4575)),u=n(r(3913)),c=function(){function e(){(0,s.default)(this,e),this._responseCache={}}var t;return(0,u.default)(e,[{key:"perform",value:(t=(0,i.default)(o.default.mark((function e(t,r,n){var i,s,u,c,l,f,d=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=d.length>3&&void 0!==d[3]?d[3]:{},s=i.cacheResponseForSeconds,!((u=void 0===s?120:s)<=0)){e.next=3;break}return e.abrupt("return",r.call.apply(r,[t].concat((0,a.default)(n))));case 3:if(c=JSON.stringify(n),!(l=this._responseCache[c])){e.next=11;break}if(!(Date.now()-l.requestTimestamp<1e3*u)){e.next=10;break}return e.abrupt("return",Promise.resolve(l.response));case 10:delete this._responseCache[c];case 11:return e.next=13,r.call.apply(r,[t].concat((0,a.default)(n)));case 13:return f=e.sent,this._responseCache[c]={requestTimestamp:Date.now(),response:f},e.abrupt("return",f);case 16:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})}]),e}();t.default=c},8834:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(2554)),s=n(r(9777)),u=n(r(8243)),c=n(r(9092)),l=function(){function e(t){(0,o.default)(this,e),((t=t||{}).apiKey||"").length<2e3&&(t.sendApiKeyAsQueryParam=!0),this.configuration=new i.default(t),this._apiCall=new s.default(this.configuration),this.multiSearch=new c.default(this._apiCall,this.configuration,!0),this._individualCollections={}}return(0,a.default)(e,[{key:"collections",value:function(e){if(void 0===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.");return void 0===this._individualCollections[e]&&(this._individualCollections[e]=new u.default(e,this._apiCall,this.configuration)),this._individualCollections[e]}}]),e}();t.default=l},1483:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=n(r(1940)),u=function(){function e(t,r,n){(0,o.default)(this,e),this._collectionName=t,this._synonymId=r,this._apiCall=n}return(0,a.default)(e,[{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"delete",value:function(){return this._apiCall.delete(this._endpointPath())}},{key:"_endpointPath",value:function(){return"".concat(i.default.RESOURCEPATH,"/").concat(this._collectionName).concat(s.default.RESOURCEPATH,"/").concat(this._synonymId)}}]),e}();t.default=u},1940:(e,t,r)=>{"use strict";var n=r(5318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(4575)),a=n(r(3913)),i=n(r(6581)),s=function(){function e(t,r){(0,o.default)(this,e),this._collectionName=t,this._apiCall=r}return(0,a.default)(e,[{key:"upsert",value:function(e,t){return this._apiCall.put(this._endpointPath(e),t)}},{key:"retrieve",value:function(){return this._apiCall.get(this._endpointPath())}},{key:"_endpointPath",value:function(t){return"".concat(i.default.RESOURCEPATH,"/").concat(this._collectionName).concat(e.RESOURCEPATH).concat(void 0===t?"":"/"+t)}}],[{key:"RESOURCEPATH",get:function(){return"/synonyms"}}]),e}();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 o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.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,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function s(t){e(i,o,a,s,u,"next",t)}function u(t){e(i,o,a,s,u,"throw",t)}s(void 0)}))}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 i(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}r.d(n,{default:()=>x});var s=r(7757),u=r.n(s),c=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(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 i(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 f(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 f(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)?f(e,t):void 0}}function h(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,o,a=[],i=!0,s=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){s=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(s)throw o}}return a}}(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){o(this,e),this.instantsearchRequests=t,this.typesenseClient=r,this.configuration=n,this.additionalSearchParameters=n.additionalSearchParameters,this.collectionSpecificSearchParameters=n.collectionSpecificSearchParameters}var r;return i(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),o="".concat(n[1]).concat(n[2]),a="".concat(n[3]);r[o]=r[o]||[],r[o].push(a)})),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],o=h(r[n].reduce((function(e,r){return r.startsWith("-")&&!t._isNumber(r)?e[0].push(r.substring(1)):e[1].push(r),e}),[[],[]]),2),a=o[0],i=o[1],s=[];return i.length>0&&s.push("".concat(n,":=[").concat(i.map((function(e){return t._escapeFacetValue(e)})).join(","),"]")),a.length>0&&s.push("".concat(n,":!=[").concat(a.map((function(e){return t._escapeFacetValue(e)})).join(","),"]")),s.filter((function(e){return e})).join(" && ")}var u=e.match(t.constructor.FILTER_STRING_MATCHING_REGEX),c="".concat(u[1]).concat(u[2]),l="".concat(u[3]);return l.startsWith("-")&&!t._isNumber(l)?"".concat(c,":!=[").concat(t._escapeFacetValue(l.substring(1)),"]"):"".concat(c,":=[").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=h(e.match(new RegExp("(.*)(<=|>=|>|<|:)(.*)")),4),n=t[1],o=t[2],a=t[3];r[n]=r[n]||{},r[n][o]=a}));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,o=e.insidePolygon;if(t){var a,i,s,u;if(Array.isArray(t)){var c=h(t.flat(),4);a=c[0],i=c[1],s=c[2],u=c[3]}else{var l=h(t.split(","),4);a=l[0],i=l[1],s=l[2],u=l[3]}return"".concat(this.configuration.geoLocationField,":(").concat(a,", ").concat(i,", ").concat(a,", ").concat(u,", ").concat(s,", ").concat(u,", ").concat(s,", ").concat(i,")")}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 f="".concat(parseFloat(r)/1e3," km");return"".concat(this.configuration.geoLocationField,":(").concat(n,", ").concat(f,")")}if(o){var d=o;return Array.isArray(o)&&(d=o.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),o={},a=0,i=Object.entries(this.additionalSearchParameters);a<i.length;a++){var s=h(i[a],2),u=s[0],c=s[1];o[this._camelToSnakeCase(u)]=c}if(this.collectionSpecificSearchParameters[n])for(var l=0,f=Object.entries(this.collectionSpecificSearchParameters[n]);l<f.length;l++){var d=h(f[l],2),p=d[0],v=d[1];o[this._camelToSnakeCase(p)]=v}var y=Object.assign({},o),m=this._adaptSortBy(r);return Object.assign(y,{collection:n,q:""===t.query||void 0===t.query?"*":t.query,facet_by:[t.facets].flat().join(","),filter_by:this._adaptFilters(t)||o.filter_by,sort_by:m||o.sort_by,max_facet_values:t.maxValuesPerFacet,page:(t.page||0)+1}),t.hitsPerPage&&(y.per_page=t.hitsPerPage),t.facetQuery&&(y.facet_query="".concat(t.facetName,":").concat(t.facetQuery),y.per_page=0),y}},{key:"_camelToSnakeCase",value:function(e){return e.split(/(?=[A-Z])/).join("_").toLowerCase()}},{key:"request",value:(r=t(u().mark((function e(){var t,r=this;return u().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 v(e){return function(e){if(Array.isArray(e))return f(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 y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var m={_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){o(this,e),this.typesenseResponse=t,this.instantsearchRequest=r,this.configuration=n}return i(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){y(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(v(Object.entries(e.document).map((function(e){var t=h(e,2);return y({},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 o=h(t,2),a=o[0],i=o[1],s=a,u=i.value,c=i.matchLevel,l=i.matchedWords,f=i.matchedIndices;Array.isArray(u)?(n[s]=[],e.document[s].forEach((function(e,t){f&&f.includes(t)?n[s].push({value:r._adaptHighlightTag("".concat(u[f.indexOf(t)]),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag),matchLevel:c,matchedWords:l[t]}):n[s].push({value:"".concat(e),matchLevel:"none",matchedWords:[]})}))):n[s].value=r._adaptHighlightTag("".concat(u),r.instantsearchRequest.params.highlightPreTag,r.instantsearchRequest.params.highlightPostTag)})),n}},{key:"_adaptFacets",value:function(e){var t={};return e.forEach((function(e){Object.assign(t,y({},e.field_name,Object.assign.apply(Object,[{}].concat(v(e.counts.map((function(e){return y({},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,y({},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,m);var b=function(){function e(t,r){o(this,e),this.typesenseResponse=t,this.instantsearchRequest=r}return i(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,m);var x=function(){function e(t){var r=this;o(this,e),this.configuration=new c(t),this.configuration.validate(),this.typesenseClient=new l.w9(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,a;return i(e,[{key:"searchTypesenseAndAdapt",value:(a=t(u().mark((function e(t){var r,n,o=this;return u().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 o._validateTypesenseResult(e),new _(e,t[r],o.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 a.apply(this,arguments)})},{key:"searchTypesenseForFacetValuesAndAdapt",value:(n=t(u().mark((function e(t){var r,n,o=this;return u().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 o._validateTypesenseResult(e),new b(e,t[r],o.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(u().mark((function e(t){var r,n;return u().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.w9(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),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})()}));
|
|
2
2
|
//# sourceMappingURL=typesense-instantsearch-adapter.min.js.map
|