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