Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@algolia/client-search

Package Overview
Dependencies
Maintainers
3
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/client-search - npm Package Compare versions

Comparing version 5.5.2 to 5.5.3

2

dist/builds/browser.min.js

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

function G(u,i,p="WithinHeaders"){let m={"x-algolia-api-key":i,"x-algolia-application-id":u};return{headers(){return p==="WithinHeaders"?m:{}},queryParameters(){return p==="WithinQueryParameters"?m:{}}}}function x({func:u,validate:i,aggregator:p,error:m,timeout:h=()=>0}){let P=c=>new Promise((e,r)=>{u(c).then(t=>(p&&p(t),i(t)?e(t):m&&m.validate(t)?r(new Error(m.message(t))):setTimeout(()=>{P(t).then(e).catch(r)},h()))).catch(t=>{r(t)})});return P()}function B(u){let i,p=`algolia-client-js-${u.key}`;function m(){return i===void 0&&(i=u.localStorage||window.localStorage),i}function h(){return JSON.parse(m().getItem(p)||"{}")}function P(e){m().setItem(p,JSON.stringify(e))}function c(){let e=u.timeToLive?u.timeToLive*1e3:null,r=h(),t=Object.fromEntries(Object.entries(r).filter(([,a])=>a.timestamp!==void 0));if(P(t),!e)return;let o=Object.fromEntries(Object.entries(t).filter(([,a])=>{let s=new Date().getTime();return!(a.timestamp+e<s)}));P(o)}return{get(e,r,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(c(),h()[JSON.stringify(e)])).then(o=>Promise.all([o?o.value:r(),o!==void 0])).then(([o,a])=>Promise.all([o,a||t.miss(o)])).then(([o])=>o)},set(e,r){return Promise.resolve().then(()=>{let t=h();return t[JSON.stringify(e)]={timestamp:new Date().getTime(),value:r},m().setItem(p,JSON.stringify(t)),r})},delete(e){return Promise.resolve().then(()=>{let r=h();delete r[JSON.stringify(e)],m().setItem(p,JSON.stringify(r))})},clear(){return Promise.resolve().then(()=>{m().removeItem(p)})}}}function Z(){return{get(u,i,p={miss:()=>Promise.resolve()}){return i().then(h=>Promise.all([h,p.miss(h)])).then(([h])=>h)},set(u,i){return Promise.resolve(i)},delete(u){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(u){let i=[...u.caches],p=i.shift();return p===void 0?Z():{get(m,h,P={miss:()=>Promise.resolve()}){return p.get(m,h,P).catch(()=>O({caches:i}).get(m,h,P))},set(m,h){return p.set(m,h).catch(()=>O({caches:i}).set(m,h))},delete(m){return p.delete(m).catch(()=>O({caches:i}).delete(m))},clear(){return p.clear().catch(()=>O({caches:i}).clear())}}}function T(u={serializable:!0}){let i={};return{get(p,m,h={miss:()=>Promise.resolve()}){let P=JSON.stringify(p);if(P in i)return Promise.resolve(u.serializable?JSON.parse(i[P]):i[P]);let c=m();return c.then(e=>h.miss(e)).then(()=>c)},set(p,m){return i[JSON.stringify(p)]=u.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(p){return delete i[JSON.stringify(p)],Promise.resolve()},clear(){return i={},Promise.resolve()}}}var H=2*60*1e3;function Q(u,i="up"){let p=Date.now();function m(){return i==="up"||Date.now()-p>H}function h(){return i==="timed out"&&Date.now()-p<=H}return{...u,status:i,lastUpdate:p,isUp:m,isTimedOut:h}}var K=class extends Error{name="AlgoliaError";constructor(u,i){super(u),i&&(this.name=i)}},L=class extends K{stackTrace;constructor(u,i,p){super(u,p),this.stackTrace=i}},ee=class extends L{constructor(u){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",u,"RetryError")}},b=class extends L{status;constructor(u,i,p,m="ApiError"){super(u,p,m),this.status=i}},re=class extends K{response;constructor(u,i){super(u,"DeserializationError"),this.response=i}},te=class extends b{error;constructor(u,i,p,m){super(u,i,m,"DetailedApiError"),this.error=p}};function F(u){let i=u;for(let p=u.length-1;p>0;p--){let m=Math.floor(Math.random()*(p+1)),h=u[p];i[p]=u[m],i[m]=h}return i}function se(u,i,p){let m=oe(p),h=`${u.protocol}://${u.url}${u.port?`:${u.port}`:""}/${i.charAt(0)==="/"?i.substring(1):i}`;return m.length&&(h+=`?${m}`),h}function oe(u){return Object.keys(u).filter(i=>u[i]!==void 0).sort().map(i=>`${i}=${encodeURIComponent(Object.prototype.toString.call(u[i])==="[object Array]"?u[i].join(","):u[i]).replaceAll("+","%20")}`).join("&")}function ae(u,i){if(u.method==="GET"||u.data===void 0&&i.data===void 0)return;let p=Array.isArray(u.data)?u.data:{...u.data,...i.data};return JSON.stringify(p)}function ne(u,i,p){let m={Accept:"application/json",...u,...i,...p},h={};return Object.keys(m).forEach(P=>{let c=m[P];h[P.toLowerCase()]=c}),h}function ie(u){try{return JSON.parse(u.content)}catch(i){throw new re(i.message,u)}}function ue({content:u,status:i},p){try{let m=JSON.parse(u);return"error"in m?new te(m.message,i,m.error,p):new b(m.message,i,p)}catch{}return new b(u,i,p)}function ce({isTimedOut:u,status:i}){return!u&&~~i===0}function me({isTimedOut:u,status:i}){return u||ce({isTimedOut:u,status:i})||~~(i/100)!==2&&~~(i/100)!==4}function pe({status:u}){return~~(u/100)===2}function de(u){return u.map(i=>_(i))}function _(u){let i=u.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...u,request:{...u.request,headers:{...u.request.headers,...i}}}}function M({hosts:u,hostsCache:i,baseHeaders:p,baseQueryParameters:m,algoliaAgent:h,timeouts:P,requester:c,requestsCache:e,responsesCache:r}){async function t(s){let n=await Promise.all(s.map(q=>i.get(q,()=>Promise.resolve(Q(q))))),d=n.filter(q=>q.isUp()),l=n.filter(q=>q.isTimedOut()),R=[...d,...l];return{hosts:R.length>0?R:s,getTimeout(q,g){return(l.length===0&&q===0?1:l.length+3+q)*g}}}async function o(s,n,d=!0){let l=[],R=ae(s,n),f=ne(p,s.headers,n.headers),q=s.method==="GET"?{...s.data,...n.data}:{},g={...m,...s.queryParameters,...q};if(h.value&&(g["x-algolia-agent"]=h.value),n&&n.queryParameters)for(let y of Object.keys(n.queryParameters))!n.queryParameters[y]||Object.prototype.toString.call(n.queryParameters[y])==="[object Object]"?g[y]=n.queryParameters[y]:g[y]=n.queryParameters[y].toString();let S=0,v=async(y,A)=>{let E=y.pop();if(E===void 0)throw new ee(de(l));let U={...P,...n.timeouts},C={data:R,headers:f,method:s.method,url:se(E,s.path,g),connectTimeout:A(S,U.connect),responseTimeout:A(S,d?U.read:U.write)},N=D=>{let k={request:C,response:D,host:E,triesLeft:y.length};return l.push(k),k},w=await c.send(C);if(me(w)){let D=N(w);return w.isTimedOut&&S++,console.log("Retryable failure",_(D)),await i.set(E,Q(E,w.isTimedOut?"timed out":"down")),v(y,A)}if(pe(w))return ie(w);throw N(w),ue(w,l)},Y=u.filter(y=>y.accept==="readWrite"||(d?y.accept==="read":y.accept==="write")),j=await t(Y);return v([...j.hosts].reverse(),j.getTimeout)}function a(s,n={}){let d=s.useReadTransporter||s.method==="GET";if(!d)return o(s,n,d);let l=()=>o(s,n);if((n.cacheable||s.cacheable)!==!0)return l();let f={request:s,requestOptions:n,transporter:{queryParameters:m,headers:p}};return r.get(f,()=>e.get(f,()=>e.set(f,l()).then(q=>Promise.all([e.delete(f),q]),q=>Promise.all([e.delete(f),Promise.reject(q)])).then(([q,g])=>g)),{miss:q=>r.set(f,q)})}return{hostsCache:i,requester:c,timeouts:P,algoliaAgent:h,baseHeaders:p,baseQueryParameters:m,hosts:u,request:a,requestsCache:e,responsesCache:r}}function he(u){let i={value:`Algolia for JavaScript (${u})`,add(p){let m=`; ${p.segment}${p.version!==void 0?` (${p.version})`:""}`;return i.value.indexOf(m)===-1&&(i.value=`${i.value}${m}`),i}};return i}function W({algoliaAgents:u,client:i,version:p}){let m=he(p).add({segment:i,version:p});return u.forEach(h=>m.add(h)),m}var $=1e3,J=2e3,z=3e4;function V(){function u(i){return new Promise(p=>{let m=new XMLHttpRequest;m.open(i.method,i.url,!0),Object.keys(i.headers).forEach(e=>m.setRequestHeader(e,i.headers[e]));let h=(e,r)=>setTimeout(()=>{m.abort(),p({status:0,content:r,isTimedOut:!0})},e),P=h(i.connectTimeout,"Connection timeout"),c;m.onreadystatechange=()=>{m.readyState>m.OPENED&&c===void 0&&(clearTimeout(P),c=h(i.responseTimeout,"Socket timeout"))},m.onerror=()=>{m.status===0&&(clearTimeout(P),clearTimeout(c),p({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}))},m.onload=()=>{clearTimeout(P),clearTimeout(c),p({content:m.responseText,status:m.status,isTimedOut:!1})},m.send(i.data)})}return{send:u}}var I="5.5.2";function le(u){return[{url:`${u}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${u}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${u}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:u,apiKey:i,authMode:p,algoliaAgents:m,...h}){let P=G(u,i,p),c=M({hosts:le(u),...h,algoliaAgent:W({algoliaAgents:m,client:"Search",version:I}),baseHeaders:{"content-type":"text/plain",...P.headers(),...h.baseHeaders},baseQueryParameters:{...P.queryParameters(),...h.baseQueryParameters}});return{transporter:c,appId:u,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(e,r){c.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!p||p==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=e:c.baseQueryParameters["x-algolia-api-key"]=e},waitForTask({indexName:e,taskID:r,maxRetries:t=50,timeout:o=s=>Math.min(s*200,5e3)},a){let s=0;return x({func:()=>this.getTask({indexName:e,taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>o(s)})},waitForAppTask({taskID:e,maxRetries:r=50,timeout:t=a=>Math.min(a*200,5e3)},o){let a=0;return x({func:()=>this.getAppTask({taskID:e},o),validate:s=>s.status==="published",aggregator:()=>a+=1,error:{validate:()=>a>=r,message:()=>`The maximum number of retries exceeded. (${a}/${r})`},timeout:()=>t(a)})},waitForApiKey({operation:e,key:r,apiKey:t,maxRetries:o=50,timeout:a=n=>Math.min(n*200,5e3)},s){let n=0,d={aggregator:()=>n+=1,error:{validate:()=>n>=o,message:()=>`The maximum number of retries exceeded. (${n}/${o})`},timeout:()=>a(n)};if(e==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return x({...d,func:()=>this.getApiKey({key:r},s),validate:l=>{for(let R of Object.keys(t)){let f=t[R],q=l[R];if(Array.isArray(f)&&Array.isArray(q)){if(f.length!==q.length||f.some((g,S)=>g!==q[S]))return!1}else if(f!==q)return!1}return!0}})}return x({...d,func:()=>this.getApiKey({key:r},s).catch(l=>{if(l.status!==404)throw l}),validate:l=>e==="add"?l!==void 0:l===void 0})},browseObjects({indexName:e,browseParams:r,...t},o){return x({func:a=>this.browse({indexName:e,browseParams:{cursor:a?a.cursor:void 0,...r}},o),validate:a=>a.cursor===void 0,...t})},browseRules({indexName:e,searchRulesParams:r,...t},o){let a={hitsPerPage:1e3,...r};return x({func:s=>this.searchRules({indexName:e,searchRulesParams:{...a,page:s?s.page+1:a.page||0}},o),validate:s=>s.nbHits<a.hitsPerPage,...t})},browseSynonyms({indexName:e,searchSynonymsParams:r,...t},o){let a={page:0,...r,hitsPerPage:1e3};return x({func:s=>{let n=this.searchSynonyms({indexName:e,searchSynonymsParams:{...a,page:a.page}},o);return a.page+=1,n},validate:s=>s.nbHits<a.hitsPerPage,...t})},async chunkedBatch({indexName:e,objects:r,action:t="addObject",waitForTasks:o,batchSize:a=1e3},s){let n=[],d=[],l=r.entries();for(let[R,f]of l)n.push({action:t,body:f}),(n.length===a||R===r.length-1)&&(d.push(await this.batch({indexName:e,batchWriteParams:{requests:n}},s)),n=[]);if(o)for(let R of d)await this.waitForTask({indexName:e,taskID:R.taskID});return d},async saveObjects({indexName:e,objects:r},t){return await this.chunkedBatch({indexName:e,objects:r,action:"addObject"},t)},async deleteObjects({indexName:e,objectIDs:r},t){return await this.chunkedBatch({indexName:e,objects:r.map(o=>({objectID:o})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:e,objects:r,createIfNotExists:t},o){return await this.chunkedBatch({indexName:e,objects:r,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},o)},async replaceAllObjects({indexName:e,objects:r,batchSize:t},o){let a=Math.floor(Math.random()*1e6)+1e5,s=`${e}_tmp_${a}`,n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),d=await this.chunkedBatch({indexName:s,objects:r,waitForTasks:!0,batchSize:t},o);await this.waitForTask({indexName:s,taskID:n.taskID}),n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),await this.waitForTask({indexName:s,taskID:n.taskID});let l=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:e}},o);return await this.waitForTask({indexName:s,taskID:l.taskID}),{copyOperationResponse:n,batchResponses:d,moveOperationResponse:l}},async indexExists({indexName:e}){try{await this.getSettings({indexName:e})}catch(r){if(r instanceof b&&r.status===404)return!1;throw r}return!0},searchForHits(e,r){return this.search(e,r)},searchForFacets(e,r){return this.search(e,r)},addApiKey(e,r){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return c.request(s,r)},addOrUpdateObject({indexName:e,objectID:r,body:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let d={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t};return c.request(d,o)},appendSource(e,r){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!e.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return c.request(s,r)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!r)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!r.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let o="/1/clusters/mapping",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batch({indexName:e,batchWriteParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!r)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!r.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!r)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!r.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!r.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let o="/1/clusters/mapping/batch",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!r)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!r.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},browse({indexName:e,browseParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `browse`.");let n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return c.request(n,t)},clearObjects({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},clearRules({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let o="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},clearSynonyms({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let o="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customPost({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let d={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},customPut({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let d={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},deleteApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteBy({indexName:e,deleteByParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!r)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},deleteIndex({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteObject({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},deleteRule({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let a="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},deleteSource({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteSynonym({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let a="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},getApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getAppTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getDictionaryLanguages(e){let a={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return c.request(a,e)},getDictionarySettings(e){let a={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return c.request(a,e)},getLogs({offset:e,length:r,indexName:t,type:o}={},a=void 0){let s="/1/logs",n={},d={};e!==void 0&&(d.offset=e.toString()),r!==void 0&&(d.length=r.toString()),t!==void 0&&(d.indexName=t.toString()),o!==void 0&&(d.type=o.toString());let l={method:"GET",path:s,queryParameters:d,headers:n};return c.request(l,a)},getObject({indexName:e,objectID:r,attributesToRetrieve:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getObject`.");let a="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.attributesToRetrieve=t.toString());let d={method:"GET",path:a,queryParameters:n,headers:s};return c.request(d,o)},getObjects(e,r){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!e.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},getRule({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRule`.");let n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getSettings({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getSources(e){let a={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return c.request(a,e)},getSynonym({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTask({indexName:e,taskID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTopUserIds(e){let a={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return c.request(a,e)},getUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},hasPendingMappings({getClusters:e}={},r=void 0){let t="/1/clusters/mapping/pending",o={},a={};e!==void 0&&(a.getClusters=e.toString());let s={method:"GET",path:t,queryParameters:a,headers:o};return c.request(s,r)},listApiKeys(e){let a={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return c.request(a,e)},listClusters(e){let a={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return c.request(a,e)},listIndices({page:e,hitsPerPage:r}={},t=void 0){let o="/1/indexes",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},listUserIds({page:e,hitsPerPage:r}={},t=void 0){let o="/1/clusters/mapping",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},multipleBatch(e,r){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!e.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return c.request(s,r)},operationIndex({indexName:e,operationIndexParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!r)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!r.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!r.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},partialUpdateObject({indexName:e,objectID:r,attributesToUpdate:t,createIfNotExists:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let s="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.createIfNotExists=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},removeUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},replaceSources({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return c.request(s,r)},restoreApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},saveObject({indexName:e,body:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!r)throw new Error("Parameter `body` is required when calling `saveObject`.");let n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},saveRule({indexName:e,objectID:r,rule:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!t.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");let s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveRules({indexName:e,rules:r,forwardToReplicas:t,clearExistingRules:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!r)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.clearExistingRules=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},saveSynonym({indexName:e,objectID:r,synonymHit:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!t.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!t.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveSynonyms({indexName:e,synonymHit:r,forwardToReplicas:t,replaceExistingSynonyms:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.replaceExistingSynonyms=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},search(e,r){if(e&&Array.isArray(e)&&(e={requests:e.map(({params:d,...l})=>l.type==="facet"?{...l,...d,type:"facet"}:{...l,...d,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!r)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!r.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchForFacetValues({indexName:e,facetName:r,searchForFacetValuesRequest:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!r)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let d={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return c.request(d,o)},searchRules({indexName:e,searchRulesParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSingleIndex({indexName:e,searchParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSynonyms({indexName:e,searchSynonymsParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let n={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchUserIds(e,r){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},setDictionarySettings(e,r){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return c.request(s,r)},setSettings({indexName:e,indexSettings:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!r)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"PUT",path:a,queryParameters:n,headers:s,data:r};return c.request(d,o)},updateApiKey({key:e,apiKey:r},t){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!r)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)}}}function Ks(u,i,p){if(!u||typeof u!="string")throw new Error("`appId` is missing.");if(!i||typeof i!="string")throw new Error("`apiKey` is missing.");return X({appId:u,apiKey:i,timeouts:{connect:$,read:J,write:z},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:T(),requestsCache:T({serializable:!1}),hostsCache:O({caches:[B({key:`${I}-${u}`}),T()]}),...p})}export{I as apiClientVersion,Ks as searchClient};
function G(u,i,p="WithinHeaders"){let m={"x-algolia-api-key":i,"x-algolia-application-id":u};return{headers(){return p==="WithinHeaders"?m:{}},queryParameters(){return p==="WithinQueryParameters"?m:{}}}}function x({func:u,validate:i,aggregator:p,error:m,timeout:h=()=>0}){let P=c=>new Promise((e,r)=>{u(c).then(t=>(p&&p(t),i(t)?e(t):m&&m.validate(t)?r(new Error(m.message(t))):setTimeout(()=>{P(t).then(e).catch(r)},h()))).catch(t=>{r(t)})});return P()}function B(u){let i,p=`algolia-client-js-${u.key}`;function m(){return i===void 0&&(i=u.localStorage||window.localStorage),i}function h(){return JSON.parse(m().getItem(p)||"{}")}function P(e){m().setItem(p,JSON.stringify(e))}function c(){let e=u.timeToLive?u.timeToLive*1e3:null,r=h(),t=Object.fromEntries(Object.entries(r).filter(([,a])=>a.timestamp!==void 0));if(P(t),!e)return;let o=Object.fromEntries(Object.entries(t).filter(([,a])=>{let s=new Date().getTime();return!(a.timestamp+e<s)}));P(o)}return{get(e,r,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(c(),h()[JSON.stringify(e)])).then(o=>Promise.all([o?o.value:r(),o!==void 0])).then(([o,a])=>Promise.all([o,a||t.miss(o)])).then(([o])=>o)},set(e,r){return Promise.resolve().then(()=>{let t=h();return t[JSON.stringify(e)]={timestamp:new Date().getTime(),value:r},m().setItem(p,JSON.stringify(t)),r})},delete(e){return Promise.resolve().then(()=>{let r=h();delete r[JSON.stringify(e)],m().setItem(p,JSON.stringify(r))})},clear(){return Promise.resolve().then(()=>{m().removeItem(p)})}}}function Z(){return{get(u,i,p={miss:()=>Promise.resolve()}){return i().then(h=>Promise.all([h,p.miss(h)])).then(([h])=>h)},set(u,i){return Promise.resolve(i)},delete(u){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(u){let i=[...u.caches],p=i.shift();return p===void 0?Z():{get(m,h,P={miss:()=>Promise.resolve()}){return p.get(m,h,P).catch(()=>O({caches:i}).get(m,h,P))},set(m,h){return p.set(m,h).catch(()=>O({caches:i}).set(m,h))},delete(m){return p.delete(m).catch(()=>O({caches:i}).delete(m))},clear(){return p.clear().catch(()=>O({caches:i}).clear())}}}function T(u={serializable:!0}){let i={};return{get(p,m,h={miss:()=>Promise.resolve()}){let P=JSON.stringify(p);if(P in i)return Promise.resolve(u.serializable?JSON.parse(i[P]):i[P]);let c=m();return c.then(e=>h.miss(e)).then(()=>c)},set(p,m){return i[JSON.stringify(p)]=u.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(p){return delete i[JSON.stringify(p)],Promise.resolve()},clear(){return i={},Promise.resolve()}}}var H=2*60*1e3;function Q(u,i="up"){let p=Date.now();function m(){return i==="up"||Date.now()-p>H}function h(){return i==="timed out"&&Date.now()-p<=H}return{...u,status:i,lastUpdate:p,isUp:m,isTimedOut:h}}var K=class extends Error{name="AlgoliaError";constructor(u,i){super(u),i&&(this.name=i)}},L=class extends K{stackTrace;constructor(u,i,p){super(u,p),this.stackTrace=i}},ee=class extends L{constructor(u){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",u,"RetryError")}},b=class extends L{status;constructor(u,i,p,m="ApiError"){super(u,p,m),this.status=i}},re=class extends K{response;constructor(u,i){super(u,"DeserializationError"),this.response=i}},te=class extends b{error;constructor(u,i,p,m){super(u,i,m,"DetailedApiError"),this.error=p}};function F(u){let i=u;for(let p=u.length-1;p>0;p--){let m=Math.floor(Math.random()*(p+1)),h=u[p];i[p]=u[m],i[m]=h}return i}function se(u,i,p){let m=oe(p),h=`${u.protocol}://${u.url}${u.port?`:${u.port}`:""}/${i.charAt(0)==="/"?i.substring(1):i}`;return m.length&&(h+=`?${m}`),h}function oe(u){return Object.keys(u).filter(i=>u[i]!==void 0).sort().map(i=>`${i}=${encodeURIComponent(Object.prototype.toString.call(u[i])==="[object Array]"?u[i].join(","):u[i]).replaceAll("+","%20")}`).join("&")}function ae(u,i){if(u.method==="GET"||u.data===void 0&&i.data===void 0)return;let p=Array.isArray(u.data)?u.data:{...u.data,...i.data};return JSON.stringify(p)}function ne(u,i,p){let m={Accept:"application/json",...u,...i,...p},h={};return Object.keys(m).forEach(P=>{let c=m[P];h[P.toLowerCase()]=c}),h}function ie(u){try{return JSON.parse(u.content)}catch(i){throw new re(i.message,u)}}function ue({content:u,status:i},p){try{let m=JSON.parse(u);return"error"in m?new te(m.message,i,m.error,p):new b(m.message,i,p)}catch{}return new b(u,i,p)}function ce({isTimedOut:u,status:i}){return!u&&~~i===0}function me({isTimedOut:u,status:i}){return u||ce({isTimedOut:u,status:i})||~~(i/100)!==2&&~~(i/100)!==4}function pe({status:u}){return~~(u/100)===2}function de(u){return u.map(i=>_(i))}function _(u){let i=u.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...u,request:{...u.request,headers:{...u.request.headers,...i}}}}function M({hosts:u,hostsCache:i,baseHeaders:p,baseQueryParameters:m,algoliaAgent:h,timeouts:P,requester:c,requestsCache:e,responsesCache:r}){async function t(s){let n=await Promise.all(s.map(q=>i.get(q,()=>Promise.resolve(Q(q))))),d=n.filter(q=>q.isUp()),l=n.filter(q=>q.isTimedOut()),R=[...d,...l];return{hosts:R.length>0?R:s,getTimeout(q,g){return(l.length===0&&q===0?1:l.length+3+q)*g}}}async function o(s,n,d=!0){let l=[],R=ae(s,n),f=ne(p,s.headers,n.headers),q=s.method==="GET"?{...s.data,...n.data}:{},g={...m,...s.queryParameters,...q};if(h.value&&(g["x-algolia-agent"]=h.value),n&&n.queryParameters)for(let y of Object.keys(n.queryParameters))!n.queryParameters[y]||Object.prototype.toString.call(n.queryParameters[y])==="[object Object]"?g[y]=n.queryParameters[y]:g[y]=n.queryParameters[y].toString();let S=0,v=async(y,A)=>{let E=y.pop();if(E===void 0)throw new ee(de(l));let U={...P,...n.timeouts},C={data:R,headers:f,method:s.method,url:se(E,s.path,g),connectTimeout:A(S,U.connect),responseTimeout:A(S,d?U.read:U.write)},N=D=>{let k={request:C,response:D,host:E,triesLeft:y.length};return l.push(k),k},w=await c.send(C);if(me(w)){let D=N(w);return w.isTimedOut&&S++,console.log("Retryable failure",_(D)),await i.set(E,Q(E,w.isTimedOut?"timed out":"down")),v(y,A)}if(pe(w))return ie(w);throw N(w),ue(w,l)},Y=u.filter(y=>y.accept==="readWrite"||(d?y.accept==="read":y.accept==="write")),j=await t(Y);return v([...j.hosts].reverse(),j.getTimeout)}function a(s,n={}){let d=s.useReadTransporter||s.method==="GET";if(!d)return o(s,n,d);let l=()=>o(s,n);if((n.cacheable||s.cacheable)!==!0)return l();let f={request:s,requestOptions:n,transporter:{queryParameters:m,headers:p}};return r.get(f,()=>e.get(f,()=>e.set(f,l()).then(q=>Promise.all([e.delete(f),q]),q=>Promise.all([e.delete(f),Promise.reject(q)])).then(([q,g])=>g)),{miss:q=>r.set(f,q)})}return{hostsCache:i,requester:c,timeouts:P,algoliaAgent:h,baseHeaders:p,baseQueryParameters:m,hosts:u,request:a,requestsCache:e,responsesCache:r}}function he(u){let i={value:`Algolia for JavaScript (${u})`,add(p){let m=`; ${p.segment}${p.version!==void 0?` (${p.version})`:""}`;return i.value.indexOf(m)===-1&&(i.value=`${i.value}${m}`),i}};return i}function W({algoliaAgents:u,client:i,version:p}){let m=he(p).add({segment:i,version:p});return u.forEach(h=>m.add(h)),m}var $=1e3,J=2e3,z=3e4;function V(){function u(i){return new Promise(p=>{let m=new XMLHttpRequest;m.open(i.method,i.url,!0),Object.keys(i.headers).forEach(e=>m.setRequestHeader(e,i.headers[e]));let h=(e,r)=>setTimeout(()=>{m.abort(),p({status:0,content:r,isTimedOut:!0})},e),P=h(i.connectTimeout,"Connection timeout"),c;m.onreadystatechange=()=>{m.readyState>m.OPENED&&c===void 0&&(clearTimeout(P),c=h(i.responseTimeout,"Socket timeout"))},m.onerror=()=>{m.status===0&&(clearTimeout(P),clearTimeout(c),p({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}))},m.onload=()=>{clearTimeout(P),clearTimeout(c),p({content:m.responseText,status:m.status,isTimedOut:!1})},m.send(i.data)})}return{send:u}}var I="5.5.3";function le(u){return[{url:`${u}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${u}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${u}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:u,apiKey:i,authMode:p,algoliaAgents:m,...h}){let P=G(u,i,p),c=M({hosts:le(u),...h,algoliaAgent:W({algoliaAgents:m,client:"Search",version:I}),baseHeaders:{"content-type":"text/plain",...P.headers(),...h.baseHeaders},baseQueryParameters:{...P.queryParameters(),...h.baseQueryParameters}});return{transporter:c,appId:u,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(e,r){c.algoliaAgent.add({segment:e,version:r})},setClientApiKey({apiKey:e}){!p||p==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=e:c.baseQueryParameters["x-algolia-api-key"]=e},waitForTask({indexName:e,taskID:r,maxRetries:t=50,timeout:o=s=>Math.min(s*200,5e3)},a){let s=0;return x({func:()=>this.getTask({indexName:e,taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>o(s)})},waitForAppTask({taskID:e,maxRetries:r=50,timeout:t=a=>Math.min(a*200,5e3)},o){let a=0;return x({func:()=>this.getAppTask({taskID:e},o),validate:s=>s.status==="published",aggregator:()=>a+=1,error:{validate:()=>a>=r,message:()=>`The maximum number of retries exceeded. (${a}/${r})`},timeout:()=>t(a)})},waitForApiKey({operation:e,key:r,apiKey:t,maxRetries:o=50,timeout:a=n=>Math.min(n*200,5e3)},s){let n=0,d={aggregator:()=>n+=1,error:{validate:()=>n>=o,message:()=>`The maximum number of retries exceeded. (${n}/${o})`},timeout:()=>a(n)};if(e==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return x({...d,func:()=>this.getApiKey({key:r},s),validate:l=>{for(let R of Object.keys(t)){let f=t[R],q=l[R];if(Array.isArray(f)&&Array.isArray(q)){if(f.length!==q.length||f.some((g,S)=>g!==q[S]))return!1}else if(f!==q)return!1}return!0}})}return x({...d,func:()=>this.getApiKey({key:r},s).catch(l=>{if(l.status!==404)throw l}),validate:l=>e==="add"?l!==void 0:l===void 0})},browseObjects({indexName:e,browseParams:r,...t},o){return x({func:a=>this.browse({indexName:e,browseParams:{cursor:a?a.cursor:void 0,...r}},o),validate:a=>a.cursor===void 0,...t})},browseRules({indexName:e,searchRulesParams:r,...t},o){let a={hitsPerPage:1e3,...r};return x({func:s=>this.searchRules({indexName:e,searchRulesParams:{...a,page:s?s.page+1:a.page||0}},o),validate:s=>s.nbHits<a.hitsPerPage,...t})},browseSynonyms({indexName:e,searchSynonymsParams:r,...t},o){let a={page:0,...r,hitsPerPage:1e3};return x({func:s=>{let n=this.searchSynonyms({indexName:e,searchSynonymsParams:{...a,page:a.page}},o);return a.page+=1,n},validate:s=>s.nbHits<a.hitsPerPage,...t})},async chunkedBatch({indexName:e,objects:r,action:t="addObject",waitForTasks:o,batchSize:a=1e3},s){let n=[],d=[],l=r.entries();for(let[R,f]of l)n.push({action:t,body:f}),(n.length===a||R===r.length-1)&&(d.push(await this.batch({indexName:e,batchWriteParams:{requests:n}},s)),n=[]);if(o)for(let R of d)await this.waitForTask({indexName:e,taskID:R.taskID});return d},async saveObjects({indexName:e,objects:r},t){return await this.chunkedBatch({indexName:e,objects:r,action:"addObject"},t)},async deleteObjects({indexName:e,objectIDs:r},t){return await this.chunkedBatch({indexName:e,objects:r.map(o=>({objectID:o})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:e,objects:r,createIfNotExists:t},o){return await this.chunkedBatch({indexName:e,objects:r,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},o)},async replaceAllObjects({indexName:e,objects:r,batchSize:t},o){let a=Math.floor(Math.random()*1e6)+1e5,s=`${e}_tmp_${a}`,n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),d=await this.chunkedBatch({indexName:s,objects:r,waitForTasks:!0,batchSize:t},o);await this.waitForTask({indexName:s,taskID:n.taskID}),n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),await this.waitForTask({indexName:s,taskID:n.taskID});let l=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:e}},o);return await this.waitForTask({indexName:s,taskID:l.taskID}),{copyOperationResponse:n,batchResponses:d,moveOperationResponse:l}},async indexExists({indexName:e}){try{await this.getSettings({indexName:e})}catch(r){if(r instanceof b&&r.status===404)return!1;throw r}return!0},searchForHits(e,r){return this.search(e,r)},searchForFacets(e,r){return this.search(e,r)},addApiKey(e,r){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return c.request(s,r)},addOrUpdateObject({indexName:e,objectID:r,body:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let d={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t};return c.request(d,o)},appendSource(e,r){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!e.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return c.request(s,r)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!r)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!r.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let o="/1/clusters/mapping",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batch({indexName:e,batchWriteParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!r)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!r.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!r)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!r.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!r.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let o="/1/clusters/mapping/batch",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!r)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!r.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},browse({indexName:e,browseParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `browse`.");let n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return c.request(n,t)},clearObjects({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},clearRules({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let o="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},clearSynonyms({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let o="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customPost({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let d={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},customPut({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let d={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},deleteApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteBy({indexName:e,deleteByParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!r)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},deleteIndex({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteObject({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},deleteRule({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let a="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},deleteSource({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteSynonym({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let a="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},getApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getAppTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getDictionaryLanguages(e){let a={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return c.request(a,e)},getDictionarySettings(e){let a={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return c.request(a,e)},getLogs({offset:e,length:r,indexName:t,type:o}={},a=void 0){let s="/1/logs",n={},d={};e!==void 0&&(d.offset=e.toString()),r!==void 0&&(d.length=r.toString()),t!==void 0&&(d.indexName=t.toString()),o!==void 0&&(d.type=o.toString());let l={method:"GET",path:s,queryParameters:d,headers:n};return c.request(l,a)},getObject({indexName:e,objectID:r,attributesToRetrieve:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getObject`.");let a="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.attributesToRetrieve=t.toString());let d={method:"GET",path:a,queryParameters:n,headers:s};return c.request(d,o)},getObjects(e,r){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!e.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},getRule({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRule`.");let n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getSettings({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getSources(e){let a={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return c.request(a,e)},getSynonym({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTask({indexName:e,taskID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTopUserIds(e){let a={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return c.request(a,e)},getUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},hasPendingMappings({getClusters:e}={},r=void 0){let t="/1/clusters/mapping/pending",o={},a={};e!==void 0&&(a.getClusters=e.toString());let s={method:"GET",path:t,queryParameters:a,headers:o};return c.request(s,r)},listApiKeys(e){let a={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return c.request(a,e)},listClusters(e){let a={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return c.request(a,e)},listIndices({page:e,hitsPerPage:r}={},t=void 0){let o="/1/indexes",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},listUserIds({page:e,hitsPerPage:r}={},t=void 0){let o="/1/clusters/mapping",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},multipleBatch(e,r){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!e.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return c.request(s,r)},operationIndex({indexName:e,operationIndexParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!r)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!r.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!r.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},partialUpdateObject({indexName:e,objectID:r,attributesToUpdate:t,createIfNotExists:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let s="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.createIfNotExists=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},removeUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},replaceSources({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return c.request(s,r)},restoreApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},saveObject({indexName:e,body:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!r)throw new Error("Parameter `body` is required when calling `saveObject`.");let n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},saveRule({indexName:e,objectID:r,rule:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!t.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");let s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveRules({indexName:e,rules:r,forwardToReplicas:t,clearExistingRules:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!r)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.clearExistingRules=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},saveSynonym({indexName:e,objectID:r,synonymHit:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!t.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!t.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveSynonyms({indexName:e,synonymHit:r,forwardToReplicas:t,replaceExistingSynonyms:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.replaceExistingSynonyms=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},search(e,r){if(e&&Array.isArray(e)&&(e={requests:e.map(({params:d,...l})=>l.type==="facet"?{...l,...d,type:"facet"}:{...l,...d,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!r)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!r.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchForFacetValues({indexName:e,facetName:r,searchForFacetValuesRequest:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!r)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let d={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return c.request(d,o)},searchRules({indexName:e,searchRulesParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSingleIndex({indexName:e,searchParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSynonyms({indexName:e,searchSynonymsParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let n={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchUserIds(e,r){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},setDictionarySettings(e,r){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return c.request(s,r)},setSettings({indexName:e,indexSettings:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!r)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"PUT",path:a,queryParameters:n,headers:s,data:r};return c.request(d,o)},updateApiKey({key:e,apiKey:r},t){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!r)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)}}}function Ks(u,i,p){if(!u||typeof u!="string")throw new Error("`appId` is missing.");if(!i||typeof i!="string")throw new Error("`apiKey` is missing.");return X({appId:u,apiKey:i,timeouts:{connect:$,read:J,write:z},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:T(),requestsCache:T({serializable:!1}),hostsCache:O({caches:[B({key:`${I}-${u}`}),T()]}),...p})}export{I as apiClientVersion,Ks as searchClient};
//# sourceMappingURL=browser.min.js.map

@@ -7,3 +7,3 @@ (function (global, factory) {

function G(u,i,p="WithinHeaders"){let m={"x-algolia-api-key":i,"x-algolia-application-id":u};return {headers(){return p==="WithinHeaders"?m:{}},queryParameters(){return p==="WithinQueryParameters"?m:{}}}}function x({func:u,validate:i,aggregator:p,error:m,timeout:h=()=>0}){let P=c=>new Promise((e,r)=>{u(c).then(t=>(p&&p(t),i(t)?e(t):m&&m.validate(t)?r(new Error(m.message(t))):setTimeout(()=>{P(t).then(e).catch(r);},h()))).catch(t=>{r(t);});});return P()}function B(u){let i,p=`algolia-client-js-${u.key}`;function m(){return i===void 0&&(i=u.localStorage||window.localStorage),i}function h(){return JSON.parse(m().getItem(p)||"{}")}function P(e){m().setItem(p,JSON.stringify(e));}function c(){let e=u.timeToLive?u.timeToLive*1e3:null,r=h(),t=Object.fromEntries(Object.entries(r).filter(([,a])=>a.timestamp!==void 0));if(P(t),!e)return;let o=Object.fromEntries(Object.entries(t).filter(([,a])=>{let s=new Date().getTime();return !(a.timestamp+e<s)}));P(o);}return {get(e,r,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(c(),h()[JSON.stringify(e)])).then(o=>Promise.all([o?o.value:r(),o!==void 0])).then(([o,a])=>Promise.all([o,a||t.miss(o)])).then(([o])=>o)},set(e,r){return Promise.resolve().then(()=>{let t=h();return t[JSON.stringify(e)]={timestamp:new Date().getTime(),value:r},m().setItem(p,JSON.stringify(t)),r})},delete(e){return Promise.resolve().then(()=>{let r=h();delete r[JSON.stringify(e)],m().setItem(p,JSON.stringify(r));})},clear(){return Promise.resolve().then(()=>{m().removeItem(p);})}}}function Z(){return {get(u,i,p={miss:()=>Promise.resolve()}){return i().then(h=>Promise.all([h,p.miss(h)])).then(([h])=>h)},set(u,i){return Promise.resolve(i)},delete(u){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(u){let i=[...u.caches],p=i.shift();return p===void 0?Z():{get(m,h,P={miss:()=>Promise.resolve()}){return p.get(m,h,P).catch(()=>O({caches:i}).get(m,h,P))},set(m,h){return p.set(m,h).catch(()=>O({caches:i}).set(m,h))},delete(m){return p.delete(m).catch(()=>O({caches:i}).delete(m))},clear(){return p.clear().catch(()=>O({caches:i}).clear())}}}function T(u={serializable:!0}){let i={};return {get(p,m,h={miss:()=>Promise.resolve()}){let P=JSON.stringify(p);if(P in i)return Promise.resolve(u.serializable?JSON.parse(i[P]):i[P]);let c=m();return c.then(e=>h.miss(e)).then(()=>c)},set(p,m){return i[JSON.stringify(p)]=u.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(p){return delete i[JSON.stringify(p)],Promise.resolve()},clear(){return i={},Promise.resolve()}}}var H=2*60*1e3;function Q(u,i="up"){let p=Date.now();function m(){return i==="up"||Date.now()-p>H}function h(){return i==="timed out"&&Date.now()-p<=H}return {...u,status:i,lastUpdate:p,isUp:m,isTimedOut:h}}var K=class extends Error{name="AlgoliaError";constructor(u,i){super(u),i&&(this.name=i);}},L=class extends K{stackTrace;constructor(u,i,p){super(u,p),this.stackTrace=i;}},ee=class extends L{constructor(u){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",u,"RetryError");}},b=class extends L{status;constructor(u,i,p,m="ApiError"){super(u,p,m),this.status=i;}},re=class extends K{response;constructor(u,i){super(u,"DeserializationError"),this.response=i;}},te=class extends b{error;constructor(u,i,p,m){super(u,i,m,"DetailedApiError"),this.error=p;}};function F(u){let i=u;for(let p=u.length-1;p>0;p--){let m=Math.floor(Math.random()*(p+1)),h=u[p];i[p]=u[m],i[m]=h;}return i}function se(u,i,p){let m=oe(p),h=`${u.protocol}://${u.url}${u.port?`:${u.port}`:""}/${i.charAt(0)==="/"?i.substring(1):i}`;return m.length&&(h+=`?${m}`),h}function oe(u){return Object.keys(u).filter(i=>u[i]!==void 0).sort().map(i=>`${i}=${encodeURIComponent(Object.prototype.toString.call(u[i])==="[object Array]"?u[i].join(","):u[i]).replaceAll("+","%20")}`).join("&")}function ae(u,i){if(u.method==="GET"||u.data===void 0&&i.data===void 0)return;let p=Array.isArray(u.data)?u.data:{...u.data,...i.data};return JSON.stringify(p)}function ne(u,i,p){let m={Accept:"application/json",...u,...i,...p},h={};return Object.keys(m).forEach(P=>{let c=m[P];h[P.toLowerCase()]=c;}),h}function ie(u){try{return JSON.parse(u.content)}catch(i){throw new re(i.message,u)}}function ue({content:u,status:i},p){try{let m=JSON.parse(u);return "error"in m?new te(m.message,i,m.error,p):new b(m.message,i,p)}catch{}return new b(u,i,p)}function ce({isTimedOut:u,status:i}){return !u&&~~i===0}function me({isTimedOut:u,status:i}){return u||ce({isTimedOut:u,status:i})||~~(i/100)!==2&&~~(i/100)!==4}function pe({status:u}){return ~~(u/100)===2}function de(u){return u.map(i=>_(i))}function _(u){let i=u.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...u,request:{...u.request,headers:{...u.request.headers,...i}}}}function M({hosts:u,hostsCache:i,baseHeaders:p,baseQueryParameters:m,algoliaAgent:h,timeouts:P,requester:c,requestsCache:e,responsesCache:r}){async function t(s){let n=await Promise.all(s.map(q=>i.get(q,()=>Promise.resolve(Q(q))))),d=n.filter(q=>q.isUp()),l=n.filter(q=>q.isTimedOut()),R=[...d,...l];return {hosts:R.length>0?R:s,getTimeout(q,g){return (l.length===0&&q===0?1:l.length+3+q)*g}}}async function o(s,n,d=!0){let l=[],R=ae(s,n),f=ne(p,s.headers,n.headers),q=s.method==="GET"?{...s.data,...n.data}:{},g={...m,...s.queryParameters,...q};if(h.value&&(g["x-algolia-agent"]=h.value),n&&n.queryParameters)for(let y of Object.keys(n.queryParameters))!n.queryParameters[y]||Object.prototype.toString.call(n.queryParameters[y])==="[object Object]"?g[y]=n.queryParameters[y]:g[y]=n.queryParameters[y].toString();let S=0,v=async(y,A)=>{let E=y.pop();if(E===void 0)throw new ee(de(l));let U={...P,...n.timeouts},C={data:R,headers:f,method:s.method,url:se(E,s.path,g),connectTimeout:A(S,U.connect),responseTimeout:A(S,d?U.read:U.write)},N=D=>{let k={request:C,response:D,host:E,triesLeft:y.length};return l.push(k),k},w=await c.send(C);if(me(w)){let D=N(w);return w.isTimedOut&&S++,console.log("Retryable failure",_(D)),await i.set(E,Q(E,w.isTimedOut?"timed out":"down")),v(y,A)}if(pe(w))return ie(w);throw N(w),ue(w,l)},Y=u.filter(y=>y.accept==="readWrite"||(d?y.accept==="read":y.accept==="write")),j=await t(Y);return v([...j.hosts].reverse(),j.getTimeout)}function a(s,n={}){let d=s.useReadTransporter||s.method==="GET";if(!d)return o(s,n,d);let l=()=>o(s,n);if((n.cacheable||s.cacheable)!==!0)return l();let f={request:s,requestOptions:n,transporter:{queryParameters:m,headers:p}};return r.get(f,()=>e.get(f,()=>e.set(f,l()).then(q=>Promise.all([e.delete(f),q]),q=>Promise.all([e.delete(f),Promise.reject(q)])).then(([q,g])=>g)),{miss:q=>r.set(f,q)})}return {hostsCache:i,requester:c,timeouts:P,algoliaAgent:h,baseHeaders:p,baseQueryParameters:m,hosts:u,request:a,requestsCache:e,responsesCache:r}}function he(u){let i={value:`Algolia for JavaScript (${u})`,add(p){let m=`; ${p.segment}${p.version!==void 0?` (${p.version})`:""}`;return i.value.indexOf(m)===-1&&(i.value=`${i.value}${m}`),i}};return i}function W({algoliaAgents:u,client:i,version:p}){let m=he(p).add({segment:i,version:p});return u.forEach(h=>m.add(h)),m}var $=1e3,J=2e3,z=3e4;function V(){function u(i){return new Promise(p=>{let m=new XMLHttpRequest;m.open(i.method,i.url,!0),Object.keys(i.headers).forEach(e=>m.setRequestHeader(e,i.headers[e]));let h=(e,r)=>setTimeout(()=>{m.abort(),p({status:0,content:r,isTimedOut:!0});},e),P=h(i.connectTimeout,"Connection timeout"),c;m.onreadystatechange=()=>{m.readyState>m.OPENED&&c===void 0&&(clearTimeout(P),c=h(i.responseTimeout,"Socket timeout"));},m.onerror=()=>{m.status===0&&(clearTimeout(P),clearTimeout(c),p({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}));},m.onload=()=>{clearTimeout(P),clearTimeout(c),p({content:m.responseText,status:m.status,isTimedOut:!1});},m.send(i.data);})}return {send:u}}var I="5.5.2";function le(u){return [{url:`${u}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${u}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${u}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:u,apiKey:i,authMode:p,algoliaAgents:m,...h}){let P=G(u,i,p),c=M({hosts:le(u),...h,algoliaAgent:W({algoliaAgents:m,client:"Search",version:I}),baseHeaders:{"content-type":"text/plain",...P.headers(),...h.baseHeaders},baseQueryParameters:{...P.queryParameters(),...h.baseQueryParameters}});return {transporter:c,appId:u,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(e,r){c.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!p||p==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=e:c.baseQueryParameters["x-algolia-api-key"]=e;},waitForTask({indexName:e,taskID:r,maxRetries:t=50,timeout:o=s=>Math.min(s*200,5e3)},a){let s=0;return x({func:()=>this.getTask({indexName:e,taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>o(s)})},waitForAppTask({taskID:e,maxRetries:r=50,timeout:t=a=>Math.min(a*200,5e3)},o){let a=0;return x({func:()=>this.getAppTask({taskID:e},o),validate:s=>s.status==="published",aggregator:()=>a+=1,error:{validate:()=>a>=r,message:()=>`The maximum number of retries exceeded. (${a}/${r})`},timeout:()=>t(a)})},waitForApiKey({operation:e,key:r,apiKey:t,maxRetries:o=50,timeout:a=n=>Math.min(n*200,5e3)},s){let n=0,d={aggregator:()=>n+=1,error:{validate:()=>n>=o,message:()=>`The maximum number of retries exceeded. (${n}/${o})`},timeout:()=>a(n)};if(e==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return x({...d,func:()=>this.getApiKey({key:r},s),validate:l=>{for(let R of Object.keys(t)){let f=t[R],q=l[R];if(Array.isArray(f)&&Array.isArray(q)){if(f.length!==q.length||f.some((g,S)=>g!==q[S]))return !1}else if(f!==q)return !1}return !0}})}return x({...d,func:()=>this.getApiKey({key:r},s).catch(l=>{if(l.status!==404)throw l}),validate:l=>e==="add"?l!==void 0:l===void 0})},browseObjects({indexName:e,browseParams:r,...t},o){return x({func:a=>this.browse({indexName:e,browseParams:{cursor:a?a.cursor:void 0,...r}},o),validate:a=>a.cursor===void 0,...t})},browseRules({indexName:e,searchRulesParams:r,...t},o){let a={hitsPerPage:1e3,...r};return x({func:s=>this.searchRules({indexName:e,searchRulesParams:{...a,page:s?s.page+1:a.page||0}},o),validate:s=>s.nbHits<a.hitsPerPage,...t})},browseSynonyms({indexName:e,searchSynonymsParams:r,...t},o){let a={page:0,...r,hitsPerPage:1e3};return x({func:s=>{let n=this.searchSynonyms({indexName:e,searchSynonymsParams:{...a,page:a.page}},o);return a.page+=1,n},validate:s=>s.nbHits<a.hitsPerPage,...t})},async chunkedBatch({indexName:e,objects:r,action:t="addObject",waitForTasks:o,batchSize:a=1e3},s){let n=[],d=[],l=r.entries();for(let[R,f]of l)n.push({action:t,body:f}),(n.length===a||R===r.length-1)&&(d.push(await this.batch({indexName:e,batchWriteParams:{requests:n}},s)),n=[]);if(o)for(let R of d)await this.waitForTask({indexName:e,taskID:R.taskID});return d},async saveObjects({indexName:e,objects:r},t){return await this.chunkedBatch({indexName:e,objects:r,action:"addObject"},t)},async deleteObjects({indexName:e,objectIDs:r},t){return await this.chunkedBatch({indexName:e,objects:r.map(o=>({objectID:o})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:e,objects:r,createIfNotExists:t},o){return await this.chunkedBatch({indexName:e,objects:r,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},o)},async replaceAllObjects({indexName:e,objects:r,batchSize:t},o){let a=Math.floor(Math.random()*1e6)+1e5,s=`${e}_tmp_${a}`,n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),d=await this.chunkedBatch({indexName:s,objects:r,waitForTasks:!0,batchSize:t},o);await this.waitForTask({indexName:s,taskID:n.taskID}),n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),await this.waitForTask({indexName:s,taskID:n.taskID});let l=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:e}},o);return await this.waitForTask({indexName:s,taskID:l.taskID}),{copyOperationResponse:n,batchResponses:d,moveOperationResponse:l}},async indexExists({indexName:e}){try{await this.getSettings({indexName:e});}catch(r){if(r instanceof b&&r.status===404)return !1;throw r}return !0},searchForHits(e,r){return this.search(e,r)},searchForFacets(e,r){return this.search(e,r)},addApiKey(e,r){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return c.request(s,r)},addOrUpdateObject({indexName:e,objectID:r,body:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let d={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t};return c.request(d,o)},appendSource(e,r){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!e.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return c.request(s,r)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!r)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!r.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let o="/1/clusters/mapping",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batch({indexName:e,batchWriteParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!r)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!r.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!r)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!r.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!r.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let o="/1/clusters/mapping/batch",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!r)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!r.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},browse({indexName:e,browseParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `browse`.");let n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return c.request(n,t)},clearObjects({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},clearRules({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let o="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},clearSynonyms({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let o="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customPost({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let d={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},customPut({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let d={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},deleteApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteBy({indexName:e,deleteByParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!r)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},deleteIndex({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteObject({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},deleteRule({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let a="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},deleteSource({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteSynonym({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let a="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},getApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getAppTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getDictionaryLanguages(e){let a={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return c.request(a,e)},getDictionarySettings(e){let a={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return c.request(a,e)},getLogs({offset:e,length:r,indexName:t,type:o}={},a=void 0){let s="/1/logs",n={},d={};e!==void 0&&(d.offset=e.toString()),r!==void 0&&(d.length=r.toString()),t!==void 0&&(d.indexName=t.toString()),o!==void 0&&(d.type=o.toString());let l={method:"GET",path:s,queryParameters:d,headers:n};return c.request(l,a)},getObject({indexName:e,objectID:r,attributesToRetrieve:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getObject`.");let a="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.attributesToRetrieve=t.toString());let d={method:"GET",path:a,queryParameters:n,headers:s};return c.request(d,o)},getObjects(e,r){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!e.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},getRule({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRule`.");let n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getSettings({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getSources(e){let a={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return c.request(a,e)},getSynonym({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTask({indexName:e,taskID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTopUserIds(e){let a={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return c.request(a,e)},getUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},hasPendingMappings({getClusters:e}={},r=void 0){let t="/1/clusters/mapping/pending",o={},a={};e!==void 0&&(a.getClusters=e.toString());let s={method:"GET",path:t,queryParameters:a,headers:o};return c.request(s,r)},listApiKeys(e){let a={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return c.request(a,e)},listClusters(e){let a={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return c.request(a,e)},listIndices({page:e,hitsPerPage:r}={},t=void 0){let o="/1/indexes",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},listUserIds({page:e,hitsPerPage:r}={},t=void 0){let o="/1/clusters/mapping",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},multipleBatch(e,r){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!e.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return c.request(s,r)},operationIndex({indexName:e,operationIndexParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!r)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!r.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!r.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},partialUpdateObject({indexName:e,objectID:r,attributesToUpdate:t,createIfNotExists:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let s="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.createIfNotExists=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},removeUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},replaceSources({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return c.request(s,r)},restoreApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},saveObject({indexName:e,body:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!r)throw new Error("Parameter `body` is required when calling `saveObject`.");let n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},saveRule({indexName:e,objectID:r,rule:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!t.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");let s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveRules({indexName:e,rules:r,forwardToReplicas:t,clearExistingRules:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!r)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.clearExistingRules=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},saveSynonym({indexName:e,objectID:r,synonymHit:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!t.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!t.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveSynonyms({indexName:e,synonymHit:r,forwardToReplicas:t,replaceExistingSynonyms:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.replaceExistingSynonyms=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},search(e,r){if(e&&Array.isArray(e)&&(e={requests:e.map(({params:d,...l})=>l.type==="facet"?{...l,...d,type:"facet"}:{...l,...d,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!r)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!r.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchForFacetValues({indexName:e,facetName:r,searchForFacetValuesRequest:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!r)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let d={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return c.request(d,o)},searchRules({indexName:e,searchRulesParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSingleIndex({indexName:e,searchParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSynonyms({indexName:e,searchSynonymsParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let n={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchUserIds(e,r){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},setDictionarySettings(e,r){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return c.request(s,r)},setSettings({indexName:e,indexSettings:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!r)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"PUT",path:a,queryParameters:n,headers:s,data:r};return c.request(d,o)},updateApiKey({key:e,apiKey:r},t){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!r)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)}}}function Ks(u,i,p){if(!u||typeof u!="string")throw new Error("`appId` is missing.");if(!i||typeof i!="string")throw new Error("`apiKey` is missing.");return X({appId:u,apiKey:i,timeouts:{connect:$,read:J,write:z},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:T(),requestsCache:T({serializable:!1}),hostsCache:O({caches:[B({key:`${I}-${u}`}),T()]}),...p})}
function G(u,i,p="WithinHeaders"){let m={"x-algolia-api-key":i,"x-algolia-application-id":u};return {headers(){return p==="WithinHeaders"?m:{}},queryParameters(){return p==="WithinQueryParameters"?m:{}}}}function x({func:u,validate:i,aggregator:p,error:m,timeout:h=()=>0}){let P=c=>new Promise((e,r)=>{u(c).then(t=>(p&&p(t),i(t)?e(t):m&&m.validate(t)?r(new Error(m.message(t))):setTimeout(()=>{P(t).then(e).catch(r);},h()))).catch(t=>{r(t);});});return P()}function B(u){let i,p=`algolia-client-js-${u.key}`;function m(){return i===void 0&&(i=u.localStorage||window.localStorage),i}function h(){return JSON.parse(m().getItem(p)||"{}")}function P(e){m().setItem(p,JSON.stringify(e));}function c(){let e=u.timeToLive?u.timeToLive*1e3:null,r=h(),t=Object.fromEntries(Object.entries(r).filter(([,a])=>a.timestamp!==void 0));if(P(t),!e)return;let o=Object.fromEntries(Object.entries(t).filter(([,a])=>{let s=new Date().getTime();return !(a.timestamp+e<s)}));P(o);}return {get(e,r,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(c(),h()[JSON.stringify(e)])).then(o=>Promise.all([o?o.value:r(),o!==void 0])).then(([o,a])=>Promise.all([o,a||t.miss(o)])).then(([o])=>o)},set(e,r){return Promise.resolve().then(()=>{let t=h();return t[JSON.stringify(e)]={timestamp:new Date().getTime(),value:r},m().setItem(p,JSON.stringify(t)),r})},delete(e){return Promise.resolve().then(()=>{let r=h();delete r[JSON.stringify(e)],m().setItem(p,JSON.stringify(r));})},clear(){return Promise.resolve().then(()=>{m().removeItem(p);})}}}function Z(){return {get(u,i,p={miss:()=>Promise.resolve()}){return i().then(h=>Promise.all([h,p.miss(h)])).then(([h])=>h)},set(u,i){return Promise.resolve(i)},delete(u){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(u){let i=[...u.caches],p=i.shift();return p===void 0?Z():{get(m,h,P={miss:()=>Promise.resolve()}){return p.get(m,h,P).catch(()=>O({caches:i}).get(m,h,P))},set(m,h){return p.set(m,h).catch(()=>O({caches:i}).set(m,h))},delete(m){return p.delete(m).catch(()=>O({caches:i}).delete(m))},clear(){return p.clear().catch(()=>O({caches:i}).clear())}}}function T(u={serializable:!0}){let i={};return {get(p,m,h={miss:()=>Promise.resolve()}){let P=JSON.stringify(p);if(P in i)return Promise.resolve(u.serializable?JSON.parse(i[P]):i[P]);let c=m();return c.then(e=>h.miss(e)).then(()=>c)},set(p,m){return i[JSON.stringify(p)]=u.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(p){return delete i[JSON.stringify(p)],Promise.resolve()},clear(){return i={},Promise.resolve()}}}var H=2*60*1e3;function Q(u,i="up"){let p=Date.now();function m(){return i==="up"||Date.now()-p>H}function h(){return i==="timed out"&&Date.now()-p<=H}return {...u,status:i,lastUpdate:p,isUp:m,isTimedOut:h}}var K=class extends Error{name="AlgoliaError";constructor(u,i){super(u),i&&(this.name=i);}},L=class extends K{stackTrace;constructor(u,i,p){super(u,p),this.stackTrace=i;}},ee=class extends L{constructor(u){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",u,"RetryError");}},b=class extends L{status;constructor(u,i,p,m="ApiError"){super(u,p,m),this.status=i;}},re=class extends K{response;constructor(u,i){super(u,"DeserializationError"),this.response=i;}},te=class extends b{error;constructor(u,i,p,m){super(u,i,m,"DetailedApiError"),this.error=p;}};function F(u){let i=u;for(let p=u.length-1;p>0;p--){let m=Math.floor(Math.random()*(p+1)),h=u[p];i[p]=u[m],i[m]=h;}return i}function se(u,i,p){let m=oe(p),h=`${u.protocol}://${u.url}${u.port?`:${u.port}`:""}/${i.charAt(0)==="/"?i.substring(1):i}`;return m.length&&(h+=`?${m}`),h}function oe(u){return Object.keys(u).filter(i=>u[i]!==void 0).sort().map(i=>`${i}=${encodeURIComponent(Object.prototype.toString.call(u[i])==="[object Array]"?u[i].join(","):u[i]).replaceAll("+","%20")}`).join("&")}function ae(u,i){if(u.method==="GET"||u.data===void 0&&i.data===void 0)return;let p=Array.isArray(u.data)?u.data:{...u.data,...i.data};return JSON.stringify(p)}function ne(u,i,p){let m={Accept:"application/json",...u,...i,...p},h={};return Object.keys(m).forEach(P=>{let c=m[P];h[P.toLowerCase()]=c;}),h}function ie(u){try{return JSON.parse(u.content)}catch(i){throw new re(i.message,u)}}function ue({content:u,status:i},p){try{let m=JSON.parse(u);return "error"in m?new te(m.message,i,m.error,p):new b(m.message,i,p)}catch{}return new b(u,i,p)}function ce({isTimedOut:u,status:i}){return !u&&~~i===0}function me({isTimedOut:u,status:i}){return u||ce({isTimedOut:u,status:i})||~~(i/100)!==2&&~~(i/100)!==4}function pe({status:u}){return ~~(u/100)===2}function de(u){return u.map(i=>_(i))}function _(u){let i=u.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...u,request:{...u.request,headers:{...u.request.headers,...i}}}}function M({hosts:u,hostsCache:i,baseHeaders:p,baseQueryParameters:m,algoliaAgent:h,timeouts:P,requester:c,requestsCache:e,responsesCache:r}){async function t(s){let n=await Promise.all(s.map(q=>i.get(q,()=>Promise.resolve(Q(q))))),d=n.filter(q=>q.isUp()),l=n.filter(q=>q.isTimedOut()),R=[...d,...l];return {hosts:R.length>0?R:s,getTimeout(q,g){return (l.length===0&&q===0?1:l.length+3+q)*g}}}async function o(s,n,d=!0){let l=[],R=ae(s,n),f=ne(p,s.headers,n.headers),q=s.method==="GET"?{...s.data,...n.data}:{},g={...m,...s.queryParameters,...q};if(h.value&&(g["x-algolia-agent"]=h.value),n&&n.queryParameters)for(let y of Object.keys(n.queryParameters))!n.queryParameters[y]||Object.prototype.toString.call(n.queryParameters[y])==="[object Object]"?g[y]=n.queryParameters[y]:g[y]=n.queryParameters[y].toString();let S=0,v=async(y,A)=>{let E=y.pop();if(E===void 0)throw new ee(de(l));let U={...P,...n.timeouts},C={data:R,headers:f,method:s.method,url:se(E,s.path,g),connectTimeout:A(S,U.connect),responseTimeout:A(S,d?U.read:U.write)},N=D=>{let k={request:C,response:D,host:E,triesLeft:y.length};return l.push(k),k},w=await c.send(C);if(me(w)){let D=N(w);return w.isTimedOut&&S++,console.log("Retryable failure",_(D)),await i.set(E,Q(E,w.isTimedOut?"timed out":"down")),v(y,A)}if(pe(w))return ie(w);throw N(w),ue(w,l)},Y=u.filter(y=>y.accept==="readWrite"||(d?y.accept==="read":y.accept==="write")),j=await t(Y);return v([...j.hosts].reverse(),j.getTimeout)}function a(s,n={}){let d=s.useReadTransporter||s.method==="GET";if(!d)return o(s,n,d);let l=()=>o(s,n);if((n.cacheable||s.cacheable)!==!0)return l();let f={request:s,requestOptions:n,transporter:{queryParameters:m,headers:p}};return r.get(f,()=>e.get(f,()=>e.set(f,l()).then(q=>Promise.all([e.delete(f),q]),q=>Promise.all([e.delete(f),Promise.reject(q)])).then(([q,g])=>g)),{miss:q=>r.set(f,q)})}return {hostsCache:i,requester:c,timeouts:P,algoliaAgent:h,baseHeaders:p,baseQueryParameters:m,hosts:u,request:a,requestsCache:e,responsesCache:r}}function he(u){let i={value:`Algolia for JavaScript (${u})`,add(p){let m=`; ${p.segment}${p.version!==void 0?` (${p.version})`:""}`;return i.value.indexOf(m)===-1&&(i.value=`${i.value}${m}`),i}};return i}function W({algoliaAgents:u,client:i,version:p}){let m=he(p).add({segment:i,version:p});return u.forEach(h=>m.add(h)),m}var $=1e3,J=2e3,z=3e4;function V(){function u(i){return new Promise(p=>{let m=new XMLHttpRequest;m.open(i.method,i.url,!0),Object.keys(i.headers).forEach(e=>m.setRequestHeader(e,i.headers[e]));let h=(e,r)=>setTimeout(()=>{m.abort(),p({status:0,content:r,isTimedOut:!0});},e),P=h(i.connectTimeout,"Connection timeout"),c;m.onreadystatechange=()=>{m.readyState>m.OPENED&&c===void 0&&(clearTimeout(P),c=h(i.responseTimeout,"Socket timeout"));},m.onerror=()=>{m.status===0&&(clearTimeout(P),clearTimeout(c),p({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}));},m.onload=()=>{clearTimeout(P),clearTimeout(c),p({content:m.responseText,status:m.status,isTimedOut:!1});},m.send(i.data);})}return {send:u}}var I="5.5.3";function le(u){return [{url:`${u}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${u}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${u}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${u}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:u,apiKey:i,authMode:p,algoliaAgents:m,...h}){let P=G(u,i,p),c=M({hosts:le(u),...h,algoliaAgent:W({algoliaAgents:m,client:"Search",version:I}),baseHeaders:{"content-type":"text/plain",...P.headers(),...h.baseHeaders},baseQueryParameters:{...P.queryParameters(),...h.baseQueryParameters}});return {transporter:c,appId:u,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(e,r){c.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!p||p==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=e:c.baseQueryParameters["x-algolia-api-key"]=e;},waitForTask({indexName:e,taskID:r,maxRetries:t=50,timeout:o=s=>Math.min(s*200,5e3)},a){let s=0;return x({func:()=>this.getTask({indexName:e,taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>o(s)})},waitForAppTask({taskID:e,maxRetries:r=50,timeout:t=a=>Math.min(a*200,5e3)},o){let a=0;return x({func:()=>this.getAppTask({taskID:e},o),validate:s=>s.status==="published",aggregator:()=>a+=1,error:{validate:()=>a>=r,message:()=>`The maximum number of retries exceeded. (${a}/${r})`},timeout:()=>t(a)})},waitForApiKey({operation:e,key:r,apiKey:t,maxRetries:o=50,timeout:a=n=>Math.min(n*200,5e3)},s){let n=0,d={aggregator:()=>n+=1,error:{validate:()=>n>=o,message:()=>`The maximum number of retries exceeded. (${n}/${o})`},timeout:()=>a(n)};if(e==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return x({...d,func:()=>this.getApiKey({key:r},s),validate:l=>{for(let R of Object.keys(t)){let f=t[R],q=l[R];if(Array.isArray(f)&&Array.isArray(q)){if(f.length!==q.length||f.some((g,S)=>g!==q[S]))return !1}else if(f!==q)return !1}return !0}})}return x({...d,func:()=>this.getApiKey({key:r},s).catch(l=>{if(l.status!==404)throw l}),validate:l=>e==="add"?l!==void 0:l===void 0})},browseObjects({indexName:e,browseParams:r,...t},o){return x({func:a=>this.browse({indexName:e,browseParams:{cursor:a?a.cursor:void 0,...r}},o),validate:a=>a.cursor===void 0,...t})},browseRules({indexName:e,searchRulesParams:r,...t},o){let a={hitsPerPage:1e3,...r};return x({func:s=>this.searchRules({indexName:e,searchRulesParams:{...a,page:s?s.page+1:a.page||0}},o),validate:s=>s.nbHits<a.hitsPerPage,...t})},browseSynonyms({indexName:e,searchSynonymsParams:r,...t},o){let a={page:0,...r,hitsPerPage:1e3};return x({func:s=>{let n=this.searchSynonyms({indexName:e,searchSynonymsParams:{...a,page:a.page}},o);return a.page+=1,n},validate:s=>s.nbHits<a.hitsPerPage,...t})},async chunkedBatch({indexName:e,objects:r,action:t="addObject",waitForTasks:o,batchSize:a=1e3},s){let n=[],d=[],l=r.entries();for(let[R,f]of l)n.push({action:t,body:f}),(n.length===a||R===r.length-1)&&(d.push(await this.batch({indexName:e,batchWriteParams:{requests:n}},s)),n=[]);if(o)for(let R of d)await this.waitForTask({indexName:e,taskID:R.taskID});return d},async saveObjects({indexName:e,objects:r},t){return await this.chunkedBatch({indexName:e,objects:r,action:"addObject"},t)},async deleteObjects({indexName:e,objectIDs:r},t){return await this.chunkedBatch({indexName:e,objects:r.map(o=>({objectID:o})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:e,objects:r,createIfNotExists:t},o){return await this.chunkedBatch({indexName:e,objects:r,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},o)},async replaceAllObjects({indexName:e,objects:r,batchSize:t},o){let a=Math.floor(Math.random()*1e6)+1e5,s=`${e}_tmp_${a}`,n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),d=await this.chunkedBatch({indexName:s,objects:r,waitForTasks:!0,batchSize:t},o);await this.waitForTask({indexName:s,taskID:n.taskID}),n=await this.operationIndex({indexName:e,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},o),await this.waitForTask({indexName:s,taskID:n.taskID});let l=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:e}},o);return await this.waitForTask({indexName:s,taskID:l.taskID}),{copyOperationResponse:n,batchResponses:d,moveOperationResponse:l}},async indexExists({indexName:e}){try{await this.getSettings({indexName:e});}catch(r){if(r instanceof b&&r.status===404)return !1;throw r}return !0},searchForHits(e,r){return this.search(e,r)},searchForFacets(e,r){return this.search(e,r)},addApiKey(e,r){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return c.request(s,r)},addOrUpdateObject({indexName:e,objectID:r,body:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let d={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t};return c.request(d,o)},appendSource(e,r){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!e.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return c.request(s,r)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!r)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!r.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let o="/1/clusters/mapping",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batch({indexName:e,batchWriteParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!r)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!r.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!r)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!r.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!r.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let o="/1/clusters/mapping/batch",a={},s={};e!==void 0&&(a["X-Algolia-User-ID"]=e.toString());let n={method:"POST",path:o,queryParameters:s,headers:a,data:r};return c.request(n,t)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!r)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!r.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},browse({indexName:e,browseParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `browse`.");let n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return c.request(n,t)},clearObjects({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},clearRules({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let o="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},clearSynonyms({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let o="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),a={},s={};r!==void 0&&(s.forwardToReplicas=r.toString());let n={method:"POST",path:o,queryParameters:s,headers:a};return c.request(n,t)},customDelete({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customGet({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return c.request(n,t)},customPost({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let d={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},customPut({path:e,parameters:r,body:t},o){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let d={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return c.request(d,o)},deleteApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteBy({indexName:e,deleteByParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!r)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},deleteIndex({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteObject({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},deleteRule({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let a="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},deleteSource({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},deleteSynonym({indexName:e,objectID:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let a="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"DELETE",path:a,queryParameters:n,headers:s};return c.request(d,o)},getApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getAppTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getDictionaryLanguages(e){let a={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return c.request(a,e)},getDictionarySettings(e){let a={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return c.request(a,e)},getLogs({offset:e,length:r,indexName:t,type:o}={},a=void 0){let s="/1/logs",n={},d={};e!==void 0&&(d.offset=e.toString()),r!==void 0&&(d.length=r.toString()),t!==void 0&&(d.indexName=t.toString()),o!==void 0&&(d.type=o.toString());let l={method:"GET",path:s,queryParameters:d,headers:n};return c.request(l,a)},getObject({indexName:e,objectID:r,attributesToRetrieve:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getObject`.");let a="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={},n={};t!==void 0&&(n.attributesToRetrieve=t.toString());let d={method:"GET",path:a,queryParameters:n,headers:s};return c.request(d,o)},getObjects(e,r){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!e.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},getRule({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRule`.");let n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getSettings({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},getSources(e){let a={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return c.request(a,e)},getSynonym({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTask({indexName:e,taskID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return c.request(n,t)},getTopUserIds(e){let a={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return c.request(a,e)},getUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},hasPendingMappings({getClusters:e}={},r=void 0){let t="/1/clusters/mapping/pending",o={},a={};e!==void 0&&(a.getClusters=e.toString());let s={method:"GET",path:t,queryParameters:a,headers:o};return c.request(s,r)},listApiKeys(e){let a={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return c.request(a,e)},listClusters(e){let a={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return c.request(a,e)},listIndices({page:e,hitsPerPage:r}={},t=void 0){let o="/1/indexes",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},listUserIds({page:e,hitsPerPage:r}={},t=void 0){let o="/1/clusters/mapping",a={},s={};e!==void 0&&(s.page=e.toString()),r!==void 0&&(s.hitsPerPage=r.toString());let n={method:"GET",path:o,queryParameters:s,headers:a};return c.request(n,t)},multipleBatch(e,r){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!e.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return c.request(s,r)},operationIndex({indexName:e,operationIndexParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!r)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!r.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!r.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},partialUpdateObject({indexName:e,objectID:r,attributesToUpdate:t,createIfNotExists:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let s="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.createIfNotExists=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},removeUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},replaceSources({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return c.request(s,r)},restoreApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return c.request(s,r)},saveObject({indexName:e,body:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!r)throw new Error("Parameter `body` is required when calling `saveObject`.");let n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)},saveRule({indexName:e,objectID:r,rule:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!t.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");let s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveRules({indexName:e,rules:r,forwardToReplicas:t,clearExistingRules:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!r)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.clearExistingRules=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},saveSynonym({indexName:e,objectID:r,synonymHit:t,forwardToReplicas:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!t.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!t.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),n={},d={};o!==void 0&&(d.forwardToReplicas=o.toString());let l={method:"PUT",path:s,queryParameters:d,headers:n,data:t};return c.request(l,a)},saveSynonyms({indexName:e,synonymHit:r,forwardToReplicas:t,replaceExistingSynonyms:o},a){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),n={},d={};t!==void 0&&(d.forwardToReplicas=t.toString()),o!==void 0&&(d.replaceExistingSynonyms=o.toString());let l={method:"POST",path:s,queryParameters:d,headers:n,data:r};return c.request(l,a)},search(e,r){if(e&&Array.isArray(e)&&(e={requests:e.map(({params:d,...l})=>l.type==="facet"?{...l,...d,type:"facet"}:{...l,...d,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!r)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!r.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchForFacetValues({indexName:e,facetName:r,searchForFacetValuesRequest:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!r)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let d={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return c.request(d,o)},searchRules({indexName:e,searchRulesParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSingleIndex({indexName:e,searchParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchSynonyms({indexName:e,searchSynonymsParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let n={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return c.request(n,t)},searchUserIds(e,r){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(s,r)},setDictionarySettings(e,r){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return c.request(s,r)},setSettings({indexName:e,indexSettings:r,forwardToReplicas:t},o){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!r)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),s={},n={};t!==void 0&&(n.forwardToReplicas=t.toString());let d={method:"PUT",path:a,queryParameters:n,headers:s,data:r};return c.request(d,o)},updateApiKey({key:e,apiKey:r},t){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!r)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return c.request(n,t)}}}function Ks(u,i,p){if(!u||typeof u!="string")throw new Error("`appId` is missing.");if(!i||typeof i!="string")throw new Error("`apiKey` is missing.");return X({appId:u,apiKey:i,timeouts:{connect:$,read:J,write:z},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:T(),requestsCache:T({serializable:!1}),hostsCache:O({caches:[B({key:`${I}-${u}`}),T()]}),...p})}

@@ -10,0 +10,0 @@ exports.apiClientVersion = I;

{
"version": "5.5.2",
"version": "5.5.3",
"repository": {

@@ -52,6 +52,6 @@ "type": "git",

"dependencies": {
"@algolia/client-common": "5.5.2",
"@algolia/requester-browser-xhr": "5.5.2",
"@algolia/requester-fetch": "5.5.2",
"@algolia/requester-node-http": "5.5.2"
"@algolia/client-common": "5.5.3",
"@algolia/requester-browser-xhr": "5.5.3",
"@algolia/requester-fetch": "5.5.3",
"@algolia/requester-node-http": "5.5.3"
},

@@ -58,0 +58,0 @@ "devDependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc