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

algoliasearch

Package Overview
Dependencies
Maintainers
10
Versions
388
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

algoliasearch - npm Package Compare versions

Comparing version 5.4.3 to 5.5.0

2

dist/algoliasearch.umd.js

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

function v(i,u,d="WithinHeaders"){let m={"x-algolia-api-key":u,"x-algolia-application-id":i};return {headers(){return d==="WithinHeaders"?m:{}},queryParameters(){return d==="WithinQueryParameters"?m:{}}}}function N({func:i,validate:u,aggregator:d,error:m,timeout:q=()=>0}){let w=l=>new Promise((r,e)=>{i(l).then(t=>(d&&d(t),u(t)?r(t):m&&m.validate(t)?e(new Error(m.message(t))):setTimeout(()=>{w(t).then(r).catch(e);},q()))).catch(t=>{e(t);});});return w()}function C(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function q(){return JSON.parse(m().getItem(d)||"{}")}function w(r){m().setItem(d,JSON.stringify(r));}function l(){let r=i.timeToLive?i.timeToLive*1e3:null,e=q(),t=Object.fromEntries(Object.entries(e).filter(([,n])=>n.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,n])=>{let s=new Date().getTime();return !(n.timestamp+r<s)}));w(a);}return {get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),q()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,n])=>Promise.all([a,n||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=q();return t[JSON.stringify(r)]={timestamp:new Date().getTime(),value:e},m().setItem(d,JSON.stringify(t)),e})},delete(r){return Promise.resolve().then(()=>{let e=q();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{m().removeItem(d);})}}}function he(){return {get(i,u,d={miss:()=>Promise.resolve()}){return u().then(q=>Promise.all([q,d.miss(q)])).then(([q])=>q)},set(i,u){return Promise.resolve(u)},delete(i){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(i){let u=[...i.caches],d=u.shift();return d===void 0?he():{get(m,q,w={miss:()=>Promise.resolve()}){return d.get(m,q,w).catch(()=>R({caches:u}).get(m,q,w))},set(m,q){return d.set(m,q).catch(()=>R({caches:u}).set(m,q))},delete(m){return d.delete(m).catch(()=>R({caches:u}).delete(m))},clear(){return d.clear().catch(()=>R({caches:u}).clear())}}}function E(i={serializable:!0}){let u={};return {get(d,m,q={miss:()=>Promise.resolve()}){let w=JSON.stringify(d);if(w in u)return Promise.resolve(i.serializable?JSON.parse(u[w]):u[w]);let l=m();return l.then(r=>q.miss(r)).then(()=>l)},set(d,m){return u[JSON.stringify(d)]=i.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(d){return delete u[JSON.stringify(d)],Promise.resolve()},clear(){return u={},Promise.resolve()}}}var Q=2*60*1e3;function K(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>Q}function q(){return u==="timed out"&&Date.now()-d<=Q}return {...i,status:u,lastUpdate:d,isUp:m,isTimedOut:q}}var J=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u);}},V=class extends J{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u;}},le=class extends V{constructor(i){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.",i,"RetryError");}},j=class extends V{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u;}},de=class extends J{response;constructor(i,u){super(i,"DeserializationError"),this.response=u;}},me=class extends j{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d;}};function F(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),q=i[d];u[d]=i[m],u[m]=q;}return u}function qe(i,u,d){let m=ge(d),q=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(q+=`?${m}`),q}function ge(i){return Object.keys(i).filter(u=>i[u]!==void 0).sort().map(u=>`${u}=${encodeURIComponent(Object.prototype.toString.call(i[u])==="[object Array]"?i[u].join(","):i[u]).replaceAll("+","%20")}`).join("&")}function Pe(i,u){if(i.method==="GET"||i.data===void 0&&u.data===void 0)return;let d=Array.isArray(i.data)?i.data:{...i.data,...u.data};return JSON.stringify(d)}function pe(i,u,d){let m={Accept:"application/json",...i,...u,...d},q={};return Object.keys(m).forEach(w=>{let l=m[w];q[w.toLowerCase()]=l;}),q}function we(i){try{return JSON.parse(i.content)}catch(u){throw new de(u.message,i)}}function fe({content:i,status:u},d){try{let m=JSON.parse(i);return "error"in m?new me(m.message,u,m.error,d):new j(m.message,u,d)}catch{}return new j(i,u,d)}function ye({isTimedOut:i,status:u}){return !i&&~~u===0}function Ee({isTimedOut:i,status:u}){return i||ye({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function Se({status:i}){return ~~(i/100)===2}function Te(i){return i.map(u=>X(u))}function X(i){let u=i.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...i,request:{...i.request,headers:{...i.request.headers,...u}}}}function A({hosts:i,hostsCache:u,baseHeaders:d,baseQueryParameters:m,algoliaAgent:q,timeouts:w,requester:l,requestsCache:r,responsesCache:e}){async function t(s){let o=await Promise.all(s.map(P=>u.get(P,()=>Promise.resolve(K(P))))),h=o.filter(P=>P.isUp()),c=o.filter(P=>P.isTimedOut()),g=[...h,...c];return {hosts:g.length>0?g:s,getTimeout(P,f){return (c.length===0&&P===0?1:c.length+3+P)*f}}}async function a(s,o,h=!0){let c=[],g=Pe(s,o),p=pe(d,s.headers,o.headers),P=s.method==="GET"?{...s.data,...o.data}:{},f={...m,...s.queryParameters,...P};if(q.value&&(f["x-algolia-agent"]=q.value),o&&o.queryParameters)for(let T of Object.keys(o.queryParameters))!o.queryParameters[T]||Object.prototype.toString.call(o.queryParameters[T])==="[object Object]"?f[T]=o.queryParameters[T]:f[T]=o.queryParameters[T].toString();let y=0,S=async(T,B)=>{let k=T.pop();if(k===void 0)throw new le(Te(c));let G={...w,...o.timeouts},z={data:g,headers:p,method:s.method,url:qe(k,s.path,f),connectTimeout:B(y,G.connect),responseTimeout:B(y,h?G.read:G.write)},H=W=>{let M={request:z,response:W,host:k,triesLeft:T.length};return c.push(M),M},D=await l.send(z);if(Ee(D)){let W=H(D);return D.isTimedOut&&y++,console.log("Retryable failure",X(W)),await u.set(k,K(k,D.isTimedOut?"timed out":"down")),S(T,B)}if(Se(D))return we(D);throw H(D),fe(D,c)},_=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),$=await t(_);return S([...$.hosts].reverse(),$.getTimeout)}function n(s,o={}){let h=s.useReadTransporter||s.method==="GET";if(!h)return a(s,o,h);let c=()=>a(s,o);if((o.cacheable||s.cacheable)!==!0)return c();let p={request:s,requestOptions:o,transporter:{queryParameters:m,headers:d}};return e.get(p,()=>r.get(p,()=>r.set(p,c()).then(P=>Promise.all([r.delete(p),P]),P=>Promise.all([r.delete(p),Promise.reject(P)])).then(([P,f])=>f)),{miss:P=>e.set(p,P)})}return {hostsCache:u,requester:l,timeouts:w,algoliaAgent:q,baseHeaders:d,baseQueryParameters:m,hosts:i,request:n,requestsCache:r,responsesCache:e}}function Re(i){let u={value:`Algolia for JavaScript (${i})`,add(d){let m=`; ${d.segment}${d.version!==void 0?` (${d.version})`:""}`;return u.value.indexOf(m)===-1&&(u.value=`${u.value}${m}`),u}};return u}function b({algoliaAgents:i,client:u,version:d}){let m=Re(d).add({segment:u,version:d});return i.forEach(q=>m.add(q)),m}var I=1e3,x=2e3,O=3e4;function U(){function i(u){return new Promise(d=>{let m=new XMLHttpRequest;m.open(u.method,u.url,!0),Object.keys(u.headers).forEach(r=>m.setRequestHeader(r,u.headers[r]));let q=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0});},r),w=q(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=q(u.responseTimeout,"Socket timeout"));},m.onerror=()=>{m.status===0&&(clearTimeout(w),clearTimeout(l),d({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}));},m.onload=()=>{clearTimeout(w),clearTimeout(l),d({content:m.responseText,status:m.status,isTimedOut:!1});},m.send(u.data);})}return {send:i}}var Z="5.4.3",Y=["de","us"];function ve(i){return [{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Ce({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:ve(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Abtesting",version:Z}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return {transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e;},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let o={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let o={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let o={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},listABTests({offset:e,limit:t,indexPrefix:a,indexSuffix:n}={},s=void 0){let o="/2/abtests",h={},c={};e!==void 0&&(c.offset=e.toString()),t!==void 0&&(c.limit=t.toString()),a!==void 0&&(c.indexPrefix=a.toString()),n!==void 0&&(c.indexSuffix=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},scheduleABTest(e,t){if(!e)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!e.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!e.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!e.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!e.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let o={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return r.request(o,t)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let o={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)}}}function ee(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!Y.includes(d)))throw new Error(`\`region\` must be one of the following: ${Y.join(", ")}`);return Ce({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${Z}-${i}`}),E()]}),...m})}var te="5.4.3",re=["de","us"];function Ae(i){return [{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function be({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ae(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Analytics",version:te}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return {transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickPositions({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getConversionRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoClickRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getRevenue({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let c="/2/searches/noClicks",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let c="/2/searches/noResults",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",n={},s={};e!==void 0&&(s.index=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let c="/2/countries",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let g="/2/filters",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:n,endDate:s,limit:o,offset:h,tags:c},g){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!t)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let p="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),P={},f={};t!==void 0&&(f.index=t.toString()),a!==void 0&&(f.search=a.toString()),n!==void 0&&(f.startDate=n.toString()),s!==void 0&&(f.endDate=s.toString()),o!==void 0&&(f.limit=o.toString()),h!==void 0&&(f.offset=h.toString()),c!==void 0&&(f.tags=c.toString());let y={method:"GET",path:p,queryParameters:f,headers:P};return r.request(y,g)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let g="/2/filters/noResults",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:n,startDate:s,endDate:o,limit:h,offset:c,tags:g},p){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");let P="/2/hits",f={},y={};e!==void 0&&(y.index=e.toString()),t!==void 0&&(y.search=t.toString()),a!==void 0&&(y.clickAnalytics=a.toString()),n!==void 0&&(y.revenueAnalytics=n.toString()),s!==void 0&&(y.startDate=s.toString()),o!==void 0&&(y.endDate=o.toString()),h!==void 0&&(y.limit=h.toString()),c!==void 0&&(y.offset=c.toString()),g!==void 0&&(y.tags=g.toString());let S={method:"GET",path:P,queryParameters:y,headers:f};return r.request(S,p)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:n,endDate:s,orderBy:o,direction:h,limit:c,offset:g,tags:p},P){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let f="/2/searches",y={},S={};e!==void 0&&(S.index=e.toString()),t!==void 0&&(S.clickAnalytics=t.toString()),a!==void 0&&(S.revenueAnalytics=a.toString()),n!==void 0&&(S.startDate=n.toString()),s!==void 0&&(S.endDate=s.toString()),o!==void 0&&(S.orderBy=o.toString()),h!==void 0&&(S.direction=h.toString()),c!==void 0&&(S.limit=c.toString()),g!==void 0&&(S.offset=g.toString()),p!==void 0&&(S.tags=p.toString());let _={method:"GET",path:f,queryParameters:S,headers:y};return r.request(_,P)},getUsersCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)}}}function ae(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!re.includes(d)))throw new Error(`\`region\` must be one of the following: ${re.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${te}-${i}`}),E()]}),...m})}var ne="5.4.3",se=["eu","us"];function Ie(i){return [{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ie(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Personalization",version:ne}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return {transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let o={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getPersonalizationStrategy(e){let s={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(s,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let o={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let o={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return r.request(o,t)}}}function oe(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(!d||d&&(typeof d!="string"||!se.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${se.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ne}-${i}`}),E()]}),...m})}var L="5.4.3";function Oe(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:Oe(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Search",version:L}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return {transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e});},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r;},waitForTask({indexName:r,taskID:e,maxRetries:t=50,timeout:a=s=>Math.min(s*200,5e3)},n){let s=0;return N({func:()=>this.getTask({indexName:r,taskID:e},n),validate:o=>o.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>a(s)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=n=>Math.min(n*200,5e3)},a){let n=0;return N({func:()=>this.getAppTask({taskID:r},a),validate:s=>s.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=e,message:()=>`The maximum number of retries exceeded. (${n}/${e})`},timeout:()=>t(n)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:n=o=>Math.min(o*200,5e3)},s){let o=0,h={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>n(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return N({...h,func:()=>this.getApiKey({key:e},s),validate:c=>{for(let g of Object.keys(t)){let p=t[g],P=c[g];if(Array.isArray(p)&&Array.isArray(P)){if(p.length!==P.length||p.some((f,y)=>f!==P[y]))return !1}else if(p!==P)return !1}return !0}})}return N({...h,func:()=>this.getApiKey({key:e},s).catch(c=>{if(c.status!==404)throw c}),validate:c=>r==="add"?c!==void 0:c===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return N({func:n=>this.browse({indexName:r,browseParams:{cursor:n?n.cursor:void 0,...e}},a),validate:n=>n.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let n={hitsPerPage:1e3,...e};return N({func:s=>this.searchRules({indexName:r,searchRulesParams:{...n,page:s?s.page+1:n.page||0}},a),validate:s=>s.nbHits<n.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let n={page:0,...e,hitsPerPage:1e3};return N({func:s=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...n,page:n.page}},a);return n.page+=1,o},validate:s=>s.nbHits<n.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:n=1e3},s){let o=[],h=[],c=e.entries();for(let[g,p]of c)o.push({action:t,body:p}),(o.length===n||g===e.length-1)&&(h.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},s)),o=[]);if(a)for(let g of h)await this.waitForTask({indexName:r,taskID:g.taskID});return h},async saveObjects({indexName:r,objects:e},t){return await this.chunkedBatch({indexName:r,objects:e,action:"addObject"},t)},async deleteObjects({indexName:r,objectIDs:e},t){return await this.chunkedBatch({indexName:r,objects:e.map(a=>({objectID:a})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:r,objects:e,createIfNotExists:t},a){return await this.chunkedBatch({indexName:r,objects:e,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},a)},async replaceAllObjects({indexName:r,objects:e,batchSize:t},a){let n=Math.floor(Math.random()*1e6)+1e5,s=`${r}_tmp_${n}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),h=await this.chunkedBatch({indexName:s,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:s,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:s,taskID:o.taskID});let c=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:s,taskID:c.taskID}),{copyOperationResponse:o,batchResponses:h,moveOperationResponse:c}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r});}catch(e){if(e instanceof j&&e.status===404)return !1;throw e}return !0},searchForHits(r,e){return this.search(r,e)},searchForFacets(r,e){return this.search(r,e)},addApiKey(r,e){if(!r)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(s,e)},addOrUpdateObject({indexName:r,objectID:e,body:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let h={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(h,a)},appendSource(r,e){if(!r)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!r.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(s,e)},assignUserId({xAlgoliaUserID:r,assignUserIdParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!e)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!e.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let a="/1/clusters/mapping",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batch({indexName:r,batchWriteParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!e)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!e.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let o={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},batchAssignUserIds({xAlgoliaUserID:r,batchAssignUserIdsParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!e)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!e.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!e.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let a="/1/clusters/mapping/batch",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batchDictionaryEntries({dictionaryName:r,batchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!e)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!e.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},browse({indexName:r,browseParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `browse`.");let o={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{}};return l.request(o,t)},clearObjects({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},clearRules({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},clearSynonyms({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteBy({indexName:r,deleteByParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!e)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let o={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},deleteIndex({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteObject({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let o={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},deleteRule({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteSynonym({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getDictionaryLanguages(r){let n={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(n,r)},getDictionarySettings(r){let n={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(n,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},n=void 0){let s="/1/logs",o={},h={};r!==void 0&&(h.offset=r.toString()),e!==void 0&&(h.length=e.toString()),t!==void 0&&(h.indexName=t.toString()),a!==void 0&&(h.type=a.toString());let c={method:"GET",path:s,queryParameters:h,headers:o};return l.request(c,n)},getObject({indexName:r,objectID:e,attributesToRetrieve:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getObject`.");let n="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let h={method:"GET",path:n,queryParameters:o,headers:s};return l.request(h,a)},getObjects(r,e){if(!r)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!r.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},getRule({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getRule`.");let o={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getSettings({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getSources(r){let n={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(n,r)},getSynonym({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let o={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTask({indexName:r,taskID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let o={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTopUserIds(r){let n={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(n,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},n={};r!==void 0&&(n.getClusters=r.toString());let s={method:"GET",path:t,queryParameters:n,headers:a};return l.request(s,e)},listApiKeys(r){let n={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(n,r)},listClusters(r){let n={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(n,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},multipleBatch(r,e){if(!r)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!r.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(s,e)},operationIndex({indexName:r,operationIndexParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!e)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!e.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!e.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},partialUpdateObject({indexName:r,objectID:e,attributesToUpdate:t,createIfNotExists:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.createIfNotExists=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(s,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},saveObject({indexName:r,body:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!e)throw new Error("Parameter `body` is required when calling `saveObject`.");let o={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},saveRule({indexName:r,objectID:e,rule:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!e)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.clearExistingRules=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!e)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.replaceExistingSynonyms=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:h,...c})=>c.type==="facet"?{...c,...h,type:"facet"}:{...c,...h,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!r)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!r.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchDictionaryEntries({dictionaryName:r,searchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!e)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!e.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchForFacetValues({indexName:r,facetName:e,searchForFacetValuesRequest:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!e)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let h={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(r)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)},searchRules({indexName:r,searchRulesParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let o={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSingleIndex({indexName:r,searchParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSynonyms({indexName:r,searchSynonymsParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let o={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchUserIds(r,e){if(!r)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!r.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},setDictionarySettings(r,e){if(!r)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!r.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(s,e)},setSettings({indexName:r,indexSettings:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!e)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let n="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"PUT",path:n,queryParameters:o,headers:s,data:e};return l.request(h,a)},updateApiKey({key:r,apiKey:e},t){if(!r)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!e)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let o={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)}}}function ie(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ue({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${L}-${i}`}),E()]}),...d})}var ce="5.4.3";function De(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ne({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:De(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Recommend",version:ce}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return {transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e});},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r;},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let h={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendStatus({indexName:r,model:e,taskID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendations(r,e){if(r&&Array.isArray(r)&&(r={requests:r}),!r)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!r.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let s={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchRecommendRules({indexName:r,model:e,searchRecommendRulesParams:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let h={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)}}}function ue(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ne({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ce}-${i}`}),E()]}),...d})}function Er(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");let m=ie(i,u,d);return {...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(q={})=>ue(q.appId||i,q.apiKey||u,q.options),initAnalytics:(q={})=>ae(q.appId||i,q.apiKey||u,q.region,q.options),initAbtesting:(q={})=>ee(q.appId||i,q.apiKey||u,q.region,q.options),initPersonalization:q=>oe(q.appId||i,q.apiKey||u,q.region,q.options)}}
function v(i,u,d="WithinHeaders"){let m={"x-algolia-api-key":u,"x-algolia-application-id":i};return {headers(){return d==="WithinHeaders"?m:{}},queryParameters(){return d==="WithinQueryParameters"?m:{}}}}function N({func:i,validate:u,aggregator:d,error:m,timeout:q=()=>0}){let w=l=>new Promise((r,e)=>{i(l).then(t=>(d&&d(t),u(t)?r(t):m&&m.validate(t)?e(new Error(m.message(t))):setTimeout(()=>{w(t).then(r).catch(e);},q()))).catch(t=>{e(t);});});return w()}function C(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function q(){return JSON.parse(m().getItem(d)||"{}")}function w(r){m().setItem(d,JSON.stringify(r));}function l(){let r=i.timeToLive?i.timeToLive*1e3:null,e=q(),t=Object.fromEntries(Object.entries(e).filter(([,n])=>n.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,n])=>{let s=new Date().getTime();return !(n.timestamp+r<s)}));w(a);}return {get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),q()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,n])=>Promise.all([a,n||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=q();return t[JSON.stringify(r)]={timestamp:new Date().getTime(),value:e},m().setItem(d,JSON.stringify(t)),e})},delete(r){return Promise.resolve().then(()=>{let e=q();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{m().removeItem(d);})}}}function he(){return {get(i,u,d={miss:()=>Promise.resolve()}){return u().then(q=>Promise.all([q,d.miss(q)])).then(([q])=>q)},set(i,u){return Promise.resolve(u)},delete(i){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(i){let u=[...i.caches],d=u.shift();return d===void 0?he():{get(m,q,w={miss:()=>Promise.resolve()}){return d.get(m,q,w).catch(()=>R({caches:u}).get(m,q,w))},set(m,q){return d.set(m,q).catch(()=>R({caches:u}).set(m,q))},delete(m){return d.delete(m).catch(()=>R({caches:u}).delete(m))},clear(){return d.clear().catch(()=>R({caches:u}).clear())}}}function E(i={serializable:!0}){let u={};return {get(d,m,q={miss:()=>Promise.resolve()}){let w=JSON.stringify(d);if(w in u)return Promise.resolve(i.serializable?JSON.parse(u[w]):u[w]);let l=m();return l.then(r=>q.miss(r)).then(()=>l)},set(d,m){return u[JSON.stringify(d)]=i.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(d){return delete u[JSON.stringify(d)],Promise.resolve()},clear(){return u={},Promise.resolve()}}}var Q=2*60*1e3;function K(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>Q}function q(){return u==="timed out"&&Date.now()-d<=Q}return {...i,status:u,lastUpdate:d,isUp:m,isTimedOut:q}}var J=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u);}},V=class extends J{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u;}},le=class extends V{constructor(i){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.",i,"RetryError");}},j=class extends V{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u;}},de=class extends J{response;constructor(i,u){super(i,"DeserializationError"),this.response=u;}},me=class extends j{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d;}};function F(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),q=i[d];u[d]=i[m],u[m]=q;}return u}function qe(i,u,d){let m=ge(d),q=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(q+=`?${m}`),q}function ge(i){return Object.keys(i).filter(u=>i[u]!==void 0).sort().map(u=>`${u}=${encodeURIComponent(Object.prototype.toString.call(i[u])==="[object Array]"?i[u].join(","):i[u]).replaceAll("+","%20")}`).join("&")}function Pe(i,u){if(i.method==="GET"||i.data===void 0&&u.data===void 0)return;let d=Array.isArray(i.data)?i.data:{...i.data,...u.data};return JSON.stringify(d)}function pe(i,u,d){let m={Accept:"application/json",...i,...u,...d},q={};return Object.keys(m).forEach(w=>{let l=m[w];q[w.toLowerCase()]=l;}),q}function we(i){try{return JSON.parse(i.content)}catch(u){throw new de(u.message,i)}}function fe({content:i,status:u},d){try{let m=JSON.parse(i);return "error"in m?new me(m.message,u,m.error,d):new j(m.message,u,d)}catch{}return new j(i,u,d)}function ye({isTimedOut:i,status:u}){return !i&&~~u===0}function Ee({isTimedOut:i,status:u}){return i||ye({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function Se({status:i}){return ~~(i/100)===2}function Te(i){return i.map(u=>X(u))}function X(i){let u=i.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...i,request:{...i.request,headers:{...i.request.headers,...u}}}}function A({hosts:i,hostsCache:u,baseHeaders:d,baseQueryParameters:m,algoliaAgent:q,timeouts:w,requester:l,requestsCache:r,responsesCache:e}){async function t(s){let o=await Promise.all(s.map(P=>u.get(P,()=>Promise.resolve(K(P))))),h=o.filter(P=>P.isUp()),c=o.filter(P=>P.isTimedOut()),g=[...h,...c];return {hosts:g.length>0?g:s,getTimeout(P,f){return (c.length===0&&P===0?1:c.length+3+P)*f}}}async function a(s,o,h=!0){let c=[],g=Pe(s,o),p=pe(d,s.headers,o.headers),P=s.method==="GET"?{...s.data,...o.data}:{},f={...m,...s.queryParameters,...P};if(q.value&&(f["x-algolia-agent"]=q.value),o&&o.queryParameters)for(let T of Object.keys(o.queryParameters))!o.queryParameters[T]||Object.prototype.toString.call(o.queryParameters[T])==="[object Object]"?f[T]=o.queryParameters[T]:f[T]=o.queryParameters[T].toString();let y=0,S=async(T,B)=>{let k=T.pop();if(k===void 0)throw new le(Te(c));let G={...w,...o.timeouts},z={data:g,headers:p,method:s.method,url:qe(k,s.path,f),connectTimeout:B(y,G.connect),responseTimeout:B(y,h?G.read:G.write)},H=W=>{let M={request:z,response:W,host:k,triesLeft:T.length};return c.push(M),M},D=await l.send(z);if(Ee(D)){let W=H(D);return D.isTimedOut&&y++,console.log("Retryable failure",X(W)),await u.set(k,K(k,D.isTimedOut?"timed out":"down")),S(T,B)}if(Se(D))return we(D);throw H(D),fe(D,c)},_=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),$=await t(_);return S([...$.hosts].reverse(),$.getTimeout)}function n(s,o={}){let h=s.useReadTransporter||s.method==="GET";if(!h)return a(s,o,h);let c=()=>a(s,o);if((o.cacheable||s.cacheable)!==!0)return c();let p={request:s,requestOptions:o,transporter:{queryParameters:m,headers:d}};return e.get(p,()=>r.get(p,()=>r.set(p,c()).then(P=>Promise.all([r.delete(p),P]),P=>Promise.all([r.delete(p),Promise.reject(P)])).then(([P,f])=>f)),{miss:P=>e.set(p,P)})}return {hostsCache:u,requester:l,timeouts:w,algoliaAgent:q,baseHeaders:d,baseQueryParameters:m,hosts:i,request:n,requestsCache:r,responsesCache:e}}function Re(i){let u={value:`Algolia for JavaScript (${i})`,add(d){let m=`; ${d.segment}${d.version!==void 0?` (${d.version})`:""}`;return u.value.indexOf(m)===-1&&(u.value=`${u.value}${m}`),u}};return u}function b({algoliaAgents:i,client:u,version:d}){let m=Re(d).add({segment:u,version:d});return i.forEach(q=>m.add(q)),m}var I=1e3,x=2e3,O=3e4;function U(){function i(u){return new Promise(d=>{let m=new XMLHttpRequest;m.open(u.method,u.url,!0),Object.keys(u.headers).forEach(r=>m.setRequestHeader(r,u.headers[r]));let q=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0});},r),w=q(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=q(u.responseTimeout,"Socket timeout"));},m.onerror=()=>{m.status===0&&(clearTimeout(w),clearTimeout(l),d({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}));},m.onload=()=>{clearTimeout(w),clearTimeout(l),d({content:m.responseText,status:m.status,isTimedOut:!1});},m.send(u.data);})}return {send:i}}var Z="5.5.0",Y=["de","us"];function ve(i){return [{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Ce({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:ve(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Abtesting",version:Z}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return {transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e;},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let o={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let o={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let o={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},listABTests({offset:e,limit:t,indexPrefix:a,indexSuffix:n}={},s=void 0){let o="/2/abtests",h={},c={};e!==void 0&&(c.offset=e.toString()),t!==void 0&&(c.limit=t.toString()),a!==void 0&&(c.indexPrefix=a.toString()),n!==void 0&&(c.indexSuffix=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},scheduleABTest(e,t){if(!e)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!e.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!e.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!e.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!e.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let o={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return r.request(o,t)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let o={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)}}}function ee(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!Y.includes(d)))throw new Error(`\`region\` must be one of the following: ${Y.join(", ")}`);return Ce({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${Z}-${i}`}),E()]}),...m})}var te="5.5.0",re=["de","us"];function Ae(i){return [{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function be({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ae(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Analytics",version:te}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return {transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickPositions({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getConversionRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoClickRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getRevenue({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let c="/2/searches/noClicks",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let c="/2/searches/noResults",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",n={},s={};e!==void 0&&(s.index=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let c="/2/countries",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let g="/2/filters",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:n,endDate:s,limit:o,offset:h,tags:c},g){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!t)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let p="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),P={},f={};t!==void 0&&(f.index=t.toString()),a!==void 0&&(f.search=a.toString()),n!==void 0&&(f.startDate=n.toString()),s!==void 0&&(f.endDate=s.toString()),o!==void 0&&(f.limit=o.toString()),h!==void 0&&(f.offset=h.toString()),c!==void 0&&(f.tags=c.toString());let y={method:"GET",path:p,queryParameters:f,headers:P};return r.request(y,g)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let g="/2/filters/noResults",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:n,startDate:s,endDate:o,limit:h,offset:c,tags:g},p){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");let P="/2/hits",f={},y={};e!==void 0&&(y.index=e.toString()),t!==void 0&&(y.search=t.toString()),a!==void 0&&(y.clickAnalytics=a.toString()),n!==void 0&&(y.revenueAnalytics=n.toString()),s!==void 0&&(y.startDate=s.toString()),o!==void 0&&(y.endDate=o.toString()),h!==void 0&&(y.limit=h.toString()),c!==void 0&&(y.offset=c.toString()),g!==void 0&&(y.tags=g.toString());let S={method:"GET",path:P,queryParameters:y,headers:f};return r.request(S,p)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:n,endDate:s,orderBy:o,direction:h,limit:c,offset:g,tags:p},P){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let f="/2/searches",y={},S={};e!==void 0&&(S.index=e.toString()),t!==void 0&&(S.clickAnalytics=t.toString()),a!==void 0&&(S.revenueAnalytics=a.toString()),n!==void 0&&(S.startDate=n.toString()),s!==void 0&&(S.endDate=s.toString()),o!==void 0&&(S.orderBy=o.toString()),h!==void 0&&(S.direction=h.toString()),c!==void 0&&(S.limit=c.toString()),g!==void 0&&(S.offset=g.toString()),p!==void 0&&(S.tags=p.toString());let _={method:"GET",path:f,queryParameters:S,headers:y};return r.request(_,P)},getUsersCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)}}}function ae(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!re.includes(d)))throw new Error(`\`region\` must be one of the following: ${re.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${te}-${i}`}),E()]}),...m})}var ne="5.5.0",se=["eu","us"];function Ie(i){return [{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ie(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Personalization",version:ne}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return {transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t});},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let o={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getPersonalizationStrategy(e){let s={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(s,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let o={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let o={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return r.request(o,t)}}}function oe(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(!d||d&&(typeof d!="string"||!se.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${se.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ne}-${i}`}),E()]}),...m})}var L="5.5.0";function Oe(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:Oe(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Search",version:L}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return {transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e});},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r;},waitForTask({indexName:r,taskID:e,maxRetries:t=50,timeout:a=s=>Math.min(s*200,5e3)},n){let s=0;return N({func:()=>this.getTask({indexName:r,taskID:e},n),validate:o=>o.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>a(s)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=n=>Math.min(n*200,5e3)},a){let n=0;return N({func:()=>this.getAppTask({taskID:r},a),validate:s=>s.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=e,message:()=>`The maximum number of retries exceeded. (${n}/${e})`},timeout:()=>t(n)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:n=o=>Math.min(o*200,5e3)},s){let o=0,h={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>n(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return N({...h,func:()=>this.getApiKey({key:e},s),validate:c=>{for(let g of Object.keys(t)){let p=t[g],P=c[g];if(Array.isArray(p)&&Array.isArray(P)){if(p.length!==P.length||p.some((f,y)=>f!==P[y]))return !1}else if(p!==P)return !1}return !0}})}return N({...h,func:()=>this.getApiKey({key:e},s).catch(c=>{if(c.status!==404)throw c}),validate:c=>r==="add"?c!==void 0:c===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return N({func:n=>this.browse({indexName:r,browseParams:{cursor:n?n.cursor:void 0,...e}},a),validate:n=>n.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let n={hitsPerPage:1e3,...e};return N({func:s=>this.searchRules({indexName:r,searchRulesParams:{...n,page:s?s.page+1:n.page||0}},a),validate:s=>s.nbHits<n.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let n={page:0,...e,hitsPerPage:1e3};return N({func:s=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...n,page:n.page}},a);return n.page+=1,o},validate:s=>s.nbHits<n.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:n=1e3},s){let o=[],h=[],c=e.entries();for(let[g,p]of c)o.push({action:t,body:p}),(o.length===n||g===e.length-1)&&(h.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},s)),o=[]);if(a)for(let g of h)await this.waitForTask({indexName:r,taskID:g.taskID});return h},async saveObjects({indexName:r,objects:e},t){return await this.chunkedBatch({indexName:r,objects:e,action:"addObject"},t)},async deleteObjects({indexName:r,objectIDs:e},t){return await this.chunkedBatch({indexName:r,objects:e.map(a=>({objectID:a})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:r,objects:e,createIfNotExists:t},a){return await this.chunkedBatch({indexName:r,objects:e,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},a)},async replaceAllObjects({indexName:r,objects:e,batchSize:t},a){let n=Math.floor(Math.random()*1e6)+1e5,s=`${r}_tmp_${n}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),h=await this.chunkedBatch({indexName:s,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:s,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:s,taskID:o.taskID});let c=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:s,taskID:c.taskID}),{copyOperationResponse:o,batchResponses:h,moveOperationResponse:c}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r});}catch(e){if(e instanceof j&&e.status===404)return !1;throw e}return !0},searchForHits(r,e){return this.search(r,e)},searchForFacets(r,e){return this.search(r,e)},addApiKey(r,e){if(!r)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(s,e)},addOrUpdateObject({indexName:r,objectID:e,body:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let h={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(h,a)},appendSource(r,e){if(!r)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!r.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(s,e)},assignUserId({xAlgoliaUserID:r,assignUserIdParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!e)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!e.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let a="/1/clusters/mapping",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batch({indexName:r,batchWriteParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!e)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!e.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let o={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},batchAssignUserIds({xAlgoliaUserID:r,batchAssignUserIdsParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!e)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!e.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!e.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let a="/1/clusters/mapping/batch",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batchDictionaryEntries({dictionaryName:r,batchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!e)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!e.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},browse({indexName:r,browseParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `browse`.");let o={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{}};return l.request(o,t)},clearObjects({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},clearRules({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},clearSynonyms({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteBy({indexName:r,deleteByParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!e)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let o={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},deleteIndex({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteObject({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let o={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},deleteRule({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteSynonym({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getDictionaryLanguages(r){let n={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(n,r)},getDictionarySettings(r){let n={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(n,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},n=void 0){let s="/1/logs",o={},h={};r!==void 0&&(h.offset=r.toString()),e!==void 0&&(h.length=e.toString()),t!==void 0&&(h.indexName=t.toString()),a!==void 0&&(h.type=a.toString());let c={method:"GET",path:s,queryParameters:h,headers:o};return l.request(c,n)},getObject({indexName:r,objectID:e,attributesToRetrieve:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getObject`.");let n="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let h={method:"GET",path:n,queryParameters:o,headers:s};return l.request(h,a)},getObjects(r,e){if(!r)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!r.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},getRule({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getRule`.");let o={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getSettings({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getSources(r){let n={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(n,r)},getSynonym({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let o={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTask({indexName:r,taskID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let o={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTopUserIds(r){let n={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(n,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},n={};r!==void 0&&(n.getClusters=r.toString());let s={method:"GET",path:t,queryParameters:n,headers:a};return l.request(s,e)},listApiKeys(r){let n={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(n,r)},listClusters(r){let n={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(n,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},multipleBatch(r,e){if(!r)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!r.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(s,e)},operationIndex({indexName:r,operationIndexParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!e)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!e.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!e.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},partialUpdateObject({indexName:r,objectID:e,attributesToUpdate:t,createIfNotExists:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.createIfNotExists=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(s,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},saveObject({indexName:r,body:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!e)throw new Error("Parameter `body` is required when calling `saveObject`.");let o={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},saveRule({indexName:r,objectID:e,rule:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!e)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.clearExistingRules=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!e)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.replaceExistingSynonyms=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:h,...c})=>c.type==="facet"?{...c,...h,type:"facet"}:{...c,...h,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!r)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!r.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchDictionaryEntries({dictionaryName:r,searchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!e)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!e.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchForFacetValues({indexName:r,facetName:e,searchForFacetValuesRequest:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!e)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let h={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(r)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)},searchRules({indexName:r,searchRulesParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let o={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSingleIndex({indexName:r,searchParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSynonyms({indexName:r,searchSynonymsParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let o={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchUserIds(r,e){if(!r)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!r.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},setDictionarySettings(r,e){if(!r)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!r.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(s,e)},setSettings({indexName:r,indexSettings:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!e)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let n="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"PUT",path:n,queryParameters:o,headers:s,data:e};return l.request(h,a)},updateApiKey({key:r,apiKey:e},t){if(!r)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!e)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let o={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)}}}function ie(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ue({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${L}-${i}`}),E()]}),...d})}var ce="5.5.0";function De(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ne({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:De(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Recommend",version:ce}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return {transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e});},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r;},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let h={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendStatus({indexName:r,model:e,taskID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendations(r,e){if(r&&Array.isArray(r)&&(r={requests:r}),!r)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!r.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let s={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchRecommendRules({indexName:r,model:e,searchRecommendRulesParams:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let h={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)}}}function ue(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ne({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ce}-${i}`}),E()]}),...d})}function Er(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");let m=ie(i,u,d);return {...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(q={})=>ue(q.appId||i,q.apiKey||u,q.options),initAnalytics:(q={})=>ae(q.appId||i,q.apiKey||u,q.region,q.options),initAbtesting:(q={})=>ee(q.appId||i,q.apiKey||u,q.region,q.options),initPersonalization:q=>oe(q.appId||i,q.apiKey||u,q.region,q.options)}}

@@ -10,0 +10,0 @@ exports.abtestingClient = ee;

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

function v(i,u,d="WithinHeaders"){let m={"x-algolia-api-key":u,"x-algolia-application-id":i};return{headers(){return d==="WithinHeaders"?m:{}},queryParameters(){return d==="WithinQueryParameters"?m:{}}}}function N({func:i,validate:u,aggregator:d,error:m,timeout:q=()=>0}){let w=l=>new Promise((r,e)=>{i(l).then(t=>(d&&d(t),u(t)?r(t):m&&m.validate(t)?e(new Error(m.message(t))):setTimeout(()=>{w(t).then(r).catch(e)},q()))).catch(t=>{e(t)})});return w()}function C(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function q(){return JSON.parse(m().getItem(d)||"{}")}function w(r){m().setItem(d,JSON.stringify(r))}function l(){let r=i.timeToLive?i.timeToLive*1e3:null,e=q(),t=Object.fromEntries(Object.entries(e).filter(([,n])=>n.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,n])=>{let s=new Date().getTime();return!(n.timestamp+r<s)}));w(a)}return{get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),q()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,n])=>Promise.all([a,n||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=q();return t[JSON.stringify(r)]={timestamp:new Date().getTime(),value:e},m().setItem(d,JSON.stringify(t)),e})},delete(r){return Promise.resolve().then(()=>{let e=q();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e))})},clear(){return Promise.resolve().then(()=>{m().removeItem(d)})}}}function he(){return{get(i,u,d={miss:()=>Promise.resolve()}){return u().then(q=>Promise.all([q,d.miss(q)])).then(([q])=>q)},set(i,u){return Promise.resolve(u)},delete(i){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(i){let u=[...i.caches],d=u.shift();return d===void 0?he():{get(m,q,w={miss:()=>Promise.resolve()}){return d.get(m,q,w).catch(()=>R({caches:u}).get(m,q,w))},set(m,q){return d.set(m,q).catch(()=>R({caches:u}).set(m,q))},delete(m){return d.delete(m).catch(()=>R({caches:u}).delete(m))},clear(){return d.clear().catch(()=>R({caches:u}).clear())}}}function E(i={serializable:!0}){let u={};return{get(d,m,q={miss:()=>Promise.resolve()}){let w=JSON.stringify(d);if(w in u)return Promise.resolve(i.serializable?JSON.parse(u[w]):u[w]);let l=m();return l.then(r=>q.miss(r)).then(()=>l)},set(d,m){return u[JSON.stringify(d)]=i.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(d){return delete u[JSON.stringify(d)],Promise.resolve()},clear(){return u={},Promise.resolve()}}}var Q=2*60*1e3;function K(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>Q}function q(){return u==="timed out"&&Date.now()-d<=Q}return{...i,status:u,lastUpdate:d,isUp:m,isTimedOut:q}}var J=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u)}},V=class extends J{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u}},le=class extends V{constructor(i){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.",i,"RetryError")}},j=class extends V{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u}},de=class extends J{response;constructor(i,u){super(i,"DeserializationError"),this.response=u}},me=class extends j{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d}};function F(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),q=i[d];u[d]=i[m],u[m]=q}return u}function qe(i,u,d){let m=ge(d),q=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(q+=`?${m}`),q}function ge(i){return Object.keys(i).filter(u=>i[u]!==void 0).sort().map(u=>`${u}=${encodeURIComponent(Object.prototype.toString.call(i[u])==="[object Array]"?i[u].join(","):i[u]).replaceAll("+","%20")}`).join("&")}function Pe(i,u){if(i.method==="GET"||i.data===void 0&&u.data===void 0)return;let d=Array.isArray(i.data)?i.data:{...i.data,...u.data};return JSON.stringify(d)}function pe(i,u,d){let m={Accept:"application/json",...i,...u,...d},q={};return Object.keys(m).forEach(w=>{let l=m[w];q[w.toLowerCase()]=l}),q}function we(i){try{return JSON.parse(i.content)}catch(u){throw new de(u.message,i)}}function fe({content:i,status:u},d){try{let m=JSON.parse(i);return"error"in m?new me(m.message,u,m.error,d):new j(m.message,u,d)}catch{}return new j(i,u,d)}function ye({isTimedOut:i,status:u}){return!i&&~~u===0}function Ee({isTimedOut:i,status:u}){return i||ye({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function Se({status:i}){return~~(i/100)===2}function Te(i){return i.map(u=>X(u))}function X(i){let u=i.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...i,request:{...i.request,headers:{...i.request.headers,...u}}}}function A({hosts:i,hostsCache:u,baseHeaders:d,baseQueryParameters:m,algoliaAgent:q,timeouts:w,requester:l,requestsCache:r,responsesCache:e}){async function t(s){let o=await Promise.all(s.map(P=>u.get(P,()=>Promise.resolve(K(P))))),h=o.filter(P=>P.isUp()),c=o.filter(P=>P.isTimedOut()),g=[...h,...c];return{hosts:g.length>0?g:s,getTimeout(P,f){return(c.length===0&&P===0?1:c.length+3+P)*f}}}async function a(s,o,h=!0){let c=[],g=Pe(s,o),p=pe(d,s.headers,o.headers),P=s.method==="GET"?{...s.data,...o.data}:{},f={...m,...s.queryParameters,...P};if(q.value&&(f["x-algolia-agent"]=q.value),o&&o.queryParameters)for(let T of Object.keys(o.queryParameters))!o.queryParameters[T]||Object.prototype.toString.call(o.queryParameters[T])==="[object Object]"?f[T]=o.queryParameters[T]:f[T]=o.queryParameters[T].toString();let y=0,S=async(T,B)=>{let k=T.pop();if(k===void 0)throw new le(Te(c));let G={...w,...o.timeouts},z={data:g,headers:p,method:s.method,url:qe(k,s.path,f),connectTimeout:B(y,G.connect),responseTimeout:B(y,h?G.read:G.write)},H=W=>{let M={request:z,response:W,host:k,triesLeft:T.length};return c.push(M),M},D=await l.send(z);if(Ee(D)){let W=H(D);return D.isTimedOut&&y++,console.log("Retryable failure",X(W)),await u.set(k,K(k,D.isTimedOut?"timed out":"down")),S(T,B)}if(Se(D))return we(D);throw H(D),fe(D,c)},_=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),$=await t(_);return S([...$.hosts].reverse(),$.getTimeout)}function n(s,o={}){let h=s.useReadTransporter||s.method==="GET";if(!h)return a(s,o,h);let c=()=>a(s,o);if((o.cacheable||s.cacheable)!==!0)return c();let p={request:s,requestOptions:o,transporter:{queryParameters:m,headers:d}};return e.get(p,()=>r.get(p,()=>r.set(p,c()).then(P=>Promise.all([r.delete(p),P]),P=>Promise.all([r.delete(p),Promise.reject(P)])).then(([P,f])=>f)),{miss:P=>e.set(p,P)})}return{hostsCache:u,requester:l,timeouts:w,algoliaAgent:q,baseHeaders:d,baseQueryParameters:m,hosts:i,request:n,requestsCache:r,responsesCache:e}}function Re(i){let u={value:`Algolia for JavaScript (${i})`,add(d){let m=`; ${d.segment}${d.version!==void 0?` (${d.version})`:""}`;return u.value.indexOf(m)===-1&&(u.value=`${u.value}${m}`),u}};return u}function b({algoliaAgents:i,client:u,version:d}){let m=Re(d).add({segment:u,version:d});return i.forEach(q=>m.add(q)),m}var I=1e3,x=2e3,O=3e4;function U(){function i(u){return new Promise(d=>{let m=new XMLHttpRequest;m.open(u.method,u.url,!0),Object.keys(u.headers).forEach(r=>m.setRequestHeader(r,u.headers[r]));let q=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0})},r),w=q(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=q(u.responseTimeout,"Socket timeout"))},m.onerror=()=>{m.status===0&&(clearTimeout(w),clearTimeout(l),d({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}))},m.onload=()=>{clearTimeout(w),clearTimeout(l),d({content:m.responseText,status:m.status,isTimedOut:!1})},m.send(u.data)})}return{send:i}}var Z="5.4.3",Y=["de","us"];function ve(i){return[{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Ce({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:ve(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Abtesting",version:Z}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return{transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let o={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let o={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let o={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},listABTests({offset:e,limit:t,indexPrefix:a,indexSuffix:n}={},s=void 0){let o="/2/abtests",h={},c={};e!==void 0&&(c.offset=e.toString()),t!==void 0&&(c.limit=t.toString()),a!==void 0&&(c.indexPrefix=a.toString()),n!==void 0&&(c.indexSuffix=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},scheduleABTest(e,t){if(!e)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!e.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!e.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!e.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!e.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let o={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return r.request(o,t)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let o={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)}}}function ee(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!Y.includes(d)))throw new Error(`\`region\` must be one of the following: ${Y.join(", ")}`);return Ce({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${Z}-${i}`}),E()]}),...m})}var te="5.4.3",re=["de","us"];function Ae(i){return[{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function be({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ae(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Analytics",version:te}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return{transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickPositions({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getConversionRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoClickRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getRevenue({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let c="/2/searches/noClicks",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let c="/2/searches/noResults",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",n={},s={};e!==void 0&&(s.index=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let c="/2/countries",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let g="/2/filters",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:n,endDate:s,limit:o,offset:h,tags:c},g){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!t)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let p="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),P={},f={};t!==void 0&&(f.index=t.toString()),a!==void 0&&(f.search=a.toString()),n!==void 0&&(f.startDate=n.toString()),s!==void 0&&(f.endDate=s.toString()),o!==void 0&&(f.limit=o.toString()),h!==void 0&&(f.offset=h.toString()),c!==void 0&&(f.tags=c.toString());let y={method:"GET",path:p,queryParameters:f,headers:P};return r.request(y,g)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let g="/2/filters/noResults",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:n,startDate:s,endDate:o,limit:h,offset:c,tags:g},p){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");let P="/2/hits",f={},y={};e!==void 0&&(y.index=e.toString()),t!==void 0&&(y.search=t.toString()),a!==void 0&&(y.clickAnalytics=a.toString()),n!==void 0&&(y.revenueAnalytics=n.toString()),s!==void 0&&(y.startDate=s.toString()),o!==void 0&&(y.endDate=o.toString()),h!==void 0&&(y.limit=h.toString()),c!==void 0&&(y.offset=c.toString()),g!==void 0&&(y.tags=g.toString());let S={method:"GET",path:P,queryParameters:y,headers:f};return r.request(S,p)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:n,endDate:s,orderBy:o,direction:h,limit:c,offset:g,tags:p},P){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let f="/2/searches",y={},S={};e!==void 0&&(S.index=e.toString()),t!==void 0&&(S.clickAnalytics=t.toString()),a!==void 0&&(S.revenueAnalytics=a.toString()),n!==void 0&&(S.startDate=n.toString()),s!==void 0&&(S.endDate=s.toString()),o!==void 0&&(S.orderBy=o.toString()),h!==void 0&&(S.direction=h.toString()),c!==void 0&&(S.limit=c.toString()),g!==void 0&&(S.offset=g.toString()),p!==void 0&&(S.tags=p.toString());let _={method:"GET",path:f,queryParameters:S,headers:y};return r.request(_,P)},getUsersCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)}}}function ae(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!re.includes(d)))throw new Error(`\`region\` must be one of the following: ${re.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${te}-${i}`}),E()]}),...m})}var ne="5.4.3",se=["eu","us"];function Ie(i){return[{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ie(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Personalization",version:ne}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return{transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let o={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getPersonalizationStrategy(e){let s={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(s,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let o={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let o={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return r.request(o,t)}}}function oe(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(!d||d&&(typeof d!="string"||!se.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${se.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ne}-${i}`}),E()]}),...m})}var L="5.4.3";function Oe(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:Oe(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Search",version:L}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return{transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e})},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r},waitForTask({indexName:r,taskID:e,maxRetries:t=50,timeout:a=s=>Math.min(s*200,5e3)},n){let s=0;return N({func:()=>this.getTask({indexName:r,taskID:e},n),validate:o=>o.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>a(s)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=n=>Math.min(n*200,5e3)},a){let n=0;return N({func:()=>this.getAppTask({taskID:r},a),validate:s=>s.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=e,message:()=>`The maximum number of retries exceeded. (${n}/${e})`},timeout:()=>t(n)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:n=o=>Math.min(o*200,5e3)},s){let o=0,h={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>n(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return N({...h,func:()=>this.getApiKey({key:e},s),validate:c=>{for(let g of Object.keys(t)){let p=t[g],P=c[g];if(Array.isArray(p)&&Array.isArray(P)){if(p.length!==P.length||p.some((f,y)=>f!==P[y]))return!1}else if(p!==P)return!1}return!0}})}return N({...h,func:()=>this.getApiKey({key:e},s).catch(c=>{if(c.status!==404)throw c}),validate:c=>r==="add"?c!==void 0:c===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return N({func:n=>this.browse({indexName:r,browseParams:{cursor:n?n.cursor:void 0,...e}},a),validate:n=>n.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let n={hitsPerPage:1e3,...e};return N({func:s=>this.searchRules({indexName:r,searchRulesParams:{...n,page:s?s.page+1:n.page||0}},a),validate:s=>s.nbHits<n.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let n={page:0,...e,hitsPerPage:1e3};return N({func:s=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...n,page:n.page}},a);return n.page+=1,o},validate:s=>s.nbHits<n.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:n=1e3},s){let o=[],h=[],c=e.entries();for(let[g,p]of c)o.push({action:t,body:p}),(o.length===n||g===e.length-1)&&(h.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},s)),o=[]);if(a)for(let g of h)await this.waitForTask({indexName:r,taskID:g.taskID});return h},async saveObjects({indexName:r,objects:e},t){return await this.chunkedBatch({indexName:r,objects:e,action:"addObject"},t)},async deleteObjects({indexName:r,objectIDs:e},t){return await this.chunkedBatch({indexName:r,objects:e.map(a=>({objectID:a})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:r,objects:e,createIfNotExists:t},a){return await this.chunkedBatch({indexName:r,objects:e,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},a)},async replaceAllObjects({indexName:r,objects:e,batchSize:t},a){let n=Math.floor(Math.random()*1e6)+1e5,s=`${r}_tmp_${n}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),h=await this.chunkedBatch({indexName:s,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:s,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:s,taskID:o.taskID});let c=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:s,taskID:c.taskID}),{copyOperationResponse:o,batchResponses:h,moveOperationResponse:c}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r})}catch(e){if(e instanceof j&&e.status===404)return!1;throw e}return!0},searchForHits(r,e){return this.search(r,e)},searchForFacets(r,e){return this.search(r,e)},addApiKey(r,e){if(!r)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(s,e)},addOrUpdateObject({indexName:r,objectID:e,body:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let h={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(h,a)},appendSource(r,e){if(!r)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!r.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(s,e)},assignUserId({xAlgoliaUserID:r,assignUserIdParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!e)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!e.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let a="/1/clusters/mapping",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batch({indexName:r,batchWriteParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!e)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!e.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let o={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},batchAssignUserIds({xAlgoliaUserID:r,batchAssignUserIdsParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!e)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!e.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!e.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let a="/1/clusters/mapping/batch",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batchDictionaryEntries({dictionaryName:r,batchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!e)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!e.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},browse({indexName:r,browseParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `browse`.");let o={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{}};return l.request(o,t)},clearObjects({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},clearRules({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},clearSynonyms({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteBy({indexName:r,deleteByParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!e)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let o={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},deleteIndex({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteObject({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let o={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},deleteRule({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteSynonym({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getDictionaryLanguages(r){let n={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(n,r)},getDictionarySettings(r){let n={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(n,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},n=void 0){let s="/1/logs",o={},h={};r!==void 0&&(h.offset=r.toString()),e!==void 0&&(h.length=e.toString()),t!==void 0&&(h.indexName=t.toString()),a!==void 0&&(h.type=a.toString());let c={method:"GET",path:s,queryParameters:h,headers:o};return l.request(c,n)},getObject({indexName:r,objectID:e,attributesToRetrieve:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getObject`.");let n="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let h={method:"GET",path:n,queryParameters:o,headers:s};return l.request(h,a)},getObjects(r,e){if(!r)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!r.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},getRule({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getRule`.");let o={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getSettings({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getSources(r){let n={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(n,r)},getSynonym({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let o={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTask({indexName:r,taskID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let o={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTopUserIds(r){let n={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(n,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},n={};r!==void 0&&(n.getClusters=r.toString());let s={method:"GET",path:t,queryParameters:n,headers:a};return l.request(s,e)},listApiKeys(r){let n={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(n,r)},listClusters(r){let n={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(n,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},multipleBatch(r,e){if(!r)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!r.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(s,e)},operationIndex({indexName:r,operationIndexParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!e)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!e.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!e.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},partialUpdateObject({indexName:r,objectID:e,attributesToUpdate:t,createIfNotExists:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.createIfNotExists=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(s,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},saveObject({indexName:r,body:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!e)throw new Error("Parameter `body` is required when calling `saveObject`.");let o={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},saveRule({indexName:r,objectID:e,rule:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!e)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.clearExistingRules=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!e)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.replaceExistingSynonyms=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:h,...c})=>c.type==="facet"?{...c,...h,type:"facet"}:{...c,...h,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!r)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!r.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchDictionaryEntries({dictionaryName:r,searchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!e)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!e.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchForFacetValues({indexName:r,facetName:e,searchForFacetValuesRequest:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!e)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let h={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(r)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)},searchRules({indexName:r,searchRulesParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let o={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSingleIndex({indexName:r,searchParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSynonyms({indexName:r,searchSynonymsParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let o={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchUserIds(r,e){if(!r)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!r.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},setDictionarySettings(r,e){if(!r)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!r.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(s,e)},setSettings({indexName:r,indexSettings:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!e)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let n="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"PUT",path:n,queryParameters:o,headers:s,data:e};return l.request(h,a)},updateApiKey({key:r,apiKey:e},t){if(!r)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!e)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let o={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)}}}function ie(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ue({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${L}-${i}`}),E()]}),...d})}var ce="5.4.3";function De(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ne({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:De(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Recommend",version:ce}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return{transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e})},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let h={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendStatus({indexName:r,model:e,taskID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendations(r,e){if(r&&Array.isArray(r)&&(r={requests:r}),!r)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!r.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let s={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchRecommendRules({indexName:r,model:e,searchRecommendRulesParams:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let h={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)}}}function ue(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ne({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ce}-${i}`}),E()]}),...d})}function Er(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");let m=ie(i,u,d);return{...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(q={})=>ue(q.appId||i,q.apiKey||u,q.options),initAnalytics:(q={})=>ae(q.appId||i,q.apiKey||u,q.region,q.options),initAbtesting:(q={})=>ee(q.appId||i,q.apiKey||u,q.region,q.options),initPersonalization:q=>oe(q.appId||i,q.apiKey||u,q.region,q.options)}}export{ee as abtestingClient,Er as algoliasearch,ae as analyticsClient,L as apiClientVersion,oe as personalizationClient,ue as recommendClient,ie as searchClient};
function v(i,u,d="WithinHeaders"){let m={"x-algolia-api-key":u,"x-algolia-application-id":i};return{headers(){return d==="WithinHeaders"?m:{}},queryParameters(){return d==="WithinQueryParameters"?m:{}}}}function N({func:i,validate:u,aggregator:d,error:m,timeout:q=()=>0}){let w=l=>new Promise((r,e)=>{i(l).then(t=>(d&&d(t),u(t)?r(t):m&&m.validate(t)?e(new Error(m.message(t))):setTimeout(()=>{w(t).then(r).catch(e)},q()))).catch(t=>{e(t)})});return w()}function C(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function q(){return JSON.parse(m().getItem(d)||"{}")}function w(r){m().setItem(d,JSON.stringify(r))}function l(){let r=i.timeToLive?i.timeToLive*1e3:null,e=q(),t=Object.fromEntries(Object.entries(e).filter(([,n])=>n.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,n])=>{let s=new Date().getTime();return!(n.timestamp+r<s)}));w(a)}return{get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),q()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,n])=>Promise.all([a,n||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=q();return t[JSON.stringify(r)]={timestamp:new Date().getTime(),value:e},m().setItem(d,JSON.stringify(t)),e})},delete(r){return Promise.resolve().then(()=>{let e=q();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e))})},clear(){return Promise.resolve().then(()=>{m().removeItem(d)})}}}function he(){return{get(i,u,d={miss:()=>Promise.resolve()}){return u().then(q=>Promise.all([q,d.miss(q)])).then(([q])=>q)},set(i,u){return Promise.resolve(u)},delete(i){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(i){let u=[...i.caches],d=u.shift();return d===void 0?he():{get(m,q,w={miss:()=>Promise.resolve()}){return d.get(m,q,w).catch(()=>R({caches:u}).get(m,q,w))},set(m,q){return d.set(m,q).catch(()=>R({caches:u}).set(m,q))},delete(m){return d.delete(m).catch(()=>R({caches:u}).delete(m))},clear(){return d.clear().catch(()=>R({caches:u}).clear())}}}function E(i={serializable:!0}){let u={};return{get(d,m,q={miss:()=>Promise.resolve()}){let w=JSON.stringify(d);if(w in u)return Promise.resolve(i.serializable?JSON.parse(u[w]):u[w]);let l=m();return l.then(r=>q.miss(r)).then(()=>l)},set(d,m){return u[JSON.stringify(d)]=i.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(d){return delete u[JSON.stringify(d)],Promise.resolve()},clear(){return u={},Promise.resolve()}}}var Q=2*60*1e3;function K(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>Q}function q(){return u==="timed out"&&Date.now()-d<=Q}return{...i,status:u,lastUpdate:d,isUp:m,isTimedOut:q}}var J=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u)}},V=class extends J{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u}},le=class extends V{constructor(i){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.",i,"RetryError")}},j=class extends V{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u}},de=class extends J{response;constructor(i,u){super(i,"DeserializationError"),this.response=u}},me=class extends j{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d}};function F(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),q=i[d];u[d]=i[m],u[m]=q}return u}function qe(i,u,d){let m=ge(d),q=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(q+=`?${m}`),q}function ge(i){return Object.keys(i).filter(u=>i[u]!==void 0).sort().map(u=>`${u}=${encodeURIComponent(Object.prototype.toString.call(i[u])==="[object Array]"?i[u].join(","):i[u]).replaceAll("+","%20")}`).join("&")}function Pe(i,u){if(i.method==="GET"||i.data===void 0&&u.data===void 0)return;let d=Array.isArray(i.data)?i.data:{...i.data,...u.data};return JSON.stringify(d)}function pe(i,u,d){let m={Accept:"application/json",...i,...u,...d},q={};return Object.keys(m).forEach(w=>{let l=m[w];q[w.toLowerCase()]=l}),q}function we(i){try{return JSON.parse(i.content)}catch(u){throw new de(u.message,i)}}function fe({content:i,status:u},d){try{let m=JSON.parse(i);return"error"in m?new me(m.message,u,m.error,d):new j(m.message,u,d)}catch{}return new j(i,u,d)}function ye({isTimedOut:i,status:u}){return!i&&~~u===0}function Ee({isTimedOut:i,status:u}){return i||ye({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function Se({status:i}){return~~(i/100)===2}function Te(i){return i.map(u=>X(u))}function X(i){let u=i.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...i,request:{...i.request,headers:{...i.request.headers,...u}}}}function A({hosts:i,hostsCache:u,baseHeaders:d,baseQueryParameters:m,algoliaAgent:q,timeouts:w,requester:l,requestsCache:r,responsesCache:e}){async function t(s){let o=await Promise.all(s.map(P=>u.get(P,()=>Promise.resolve(K(P))))),h=o.filter(P=>P.isUp()),c=o.filter(P=>P.isTimedOut()),g=[...h,...c];return{hosts:g.length>0?g:s,getTimeout(P,f){return(c.length===0&&P===0?1:c.length+3+P)*f}}}async function a(s,o,h=!0){let c=[],g=Pe(s,o),p=pe(d,s.headers,o.headers),P=s.method==="GET"?{...s.data,...o.data}:{},f={...m,...s.queryParameters,...P};if(q.value&&(f["x-algolia-agent"]=q.value),o&&o.queryParameters)for(let T of Object.keys(o.queryParameters))!o.queryParameters[T]||Object.prototype.toString.call(o.queryParameters[T])==="[object Object]"?f[T]=o.queryParameters[T]:f[T]=o.queryParameters[T].toString();let y=0,S=async(T,B)=>{let k=T.pop();if(k===void 0)throw new le(Te(c));let G={...w,...o.timeouts},z={data:g,headers:p,method:s.method,url:qe(k,s.path,f),connectTimeout:B(y,G.connect),responseTimeout:B(y,h?G.read:G.write)},H=W=>{let M={request:z,response:W,host:k,triesLeft:T.length};return c.push(M),M},D=await l.send(z);if(Ee(D)){let W=H(D);return D.isTimedOut&&y++,console.log("Retryable failure",X(W)),await u.set(k,K(k,D.isTimedOut?"timed out":"down")),S(T,B)}if(Se(D))return we(D);throw H(D),fe(D,c)},_=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),$=await t(_);return S([...$.hosts].reverse(),$.getTimeout)}function n(s,o={}){let h=s.useReadTransporter||s.method==="GET";if(!h)return a(s,o,h);let c=()=>a(s,o);if((o.cacheable||s.cacheable)!==!0)return c();let p={request:s,requestOptions:o,transporter:{queryParameters:m,headers:d}};return e.get(p,()=>r.get(p,()=>r.set(p,c()).then(P=>Promise.all([r.delete(p),P]),P=>Promise.all([r.delete(p),Promise.reject(P)])).then(([P,f])=>f)),{miss:P=>e.set(p,P)})}return{hostsCache:u,requester:l,timeouts:w,algoliaAgent:q,baseHeaders:d,baseQueryParameters:m,hosts:i,request:n,requestsCache:r,responsesCache:e}}function Re(i){let u={value:`Algolia for JavaScript (${i})`,add(d){let m=`; ${d.segment}${d.version!==void 0?` (${d.version})`:""}`;return u.value.indexOf(m)===-1&&(u.value=`${u.value}${m}`),u}};return u}function b({algoliaAgents:i,client:u,version:d}){let m=Re(d).add({segment:u,version:d});return i.forEach(q=>m.add(q)),m}var I=1e3,x=2e3,O=3e4;function U(){function i(u){return new Promise(d=>{let m=new XMLHttpRequest;m.open(u.method,u.url,!0),Object.keys(u.headers).forEach(r=>m.setRequestHeader(r,u.headers[r]));let q=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0})},r),w=q(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=q(u.responseTimeout,"Socket timeout"))},m.onerror=()=>{m.status===0&&(clearTimeout(w),clearTimeout(l),d({content:m.responseText||"Network request failed",status:m.status,isTimedOut:!1}))},m.onload=()=>{clearTimeout(w),clearTimeout(l),d({content:m.responseText,status:m.status,isTimedOut:!1})},m.send(u.data)})}return{send:i}}var Z="5.5.0",Y=["de","us"];function ve(i){return[{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Ce({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:ve(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Abtesting",version:Z}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return{transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let o={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return r.request(o,t)},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let o={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let o={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},listABTests({offset:e,limit:t,indexPrefix:a,indexSuffix:n}={},s=void 0){let o="/2/abtests",h={},c={};e!==void 0&&(c.offset=e.toString()),t!==void 0&&(c.limit=t.toString()),a!==void 0&&(c.indexPrefix=a.toString()),n!==void 0&&(c.indexSuffix=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},scheduleABTest(e,t){if(!e)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!e.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!e.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!e.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!e.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let o={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:e};return r.request(o,t)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let o={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)}}}function ee(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!Y.includes(d)))throw new Error(`\`region\` must be one of the following: ${Y.join(", ")}`);return Ce({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${Z}-${i}`}),E()]}),...m})}var te="5.5.0",re=["de","us"];function Ae(i){return[{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function be({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ae(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Analytics",version:te}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return{transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickPositions({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getConversionRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoClickRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getRevenue({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let c="/2/searches/noClicks",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let c="/2/searches/noResults",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",n={},s={};e!==void 0&&(s.index=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:n,offset:s,tags:o},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let c="/2/countries",g={},p={};e!==void 0&&(p.index=e.toString()),t!==void 0&&(p.startDate=t.toString()),a!==void 0&&(p.endDate=a.toString()),n!==void 0&&(p.limit=n.toString()),s!==void 0&&(p.offset=s.toString()),o!==void 0&&(p.tags=o.toString());let P={method:"GET",path:c,queryParameters:p,headers:g};return r.request(P,h)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let g="/2/filters",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:n,endDate:s,limit:o,offset:h,tags:c},g){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!t)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let p="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),P={},f={};t!==void 0&&(f.index=t.toString()),a!==void 0&&(f.search=a.toString()),n!==void 0&&(f.startDate=n.toString()),s!==void 0&&(f.endDate=s.toString()),o!==void 0&&(f.limit=o.toString()),h!==void 0&&(f.offset=h.toString()),c!==void 0&&(f.tags=c.toString());let y={method:"GET",path:p,queryParameters:f,headers:P};return r.request(y,g)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:n,limit:s,offset:o,tags:h},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let g="/2/filters/noResults",p={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.search=t.toString()),a!==void 0&&(P.startDate=a.toString()),n!==void 0&&(P.endDate=n.toString()),s!==void 0&&(P.limit=s.toString()),o!==void 0&&(P.offset=o.toString()),h!==void 0&&(P.tags=h.toString());let f={method:"GET",path:g,queryParameters:P,headers:p};return r.request(f,c)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:n,startDate:s,endDate:o,limit:h,offset:c,tags:g},p){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");let P="/2/hits",f={},y={};e!==void 0&&(y.index=e.toString()),t!==void 0&&(y.search=t.toString()),a!==void 0&&(y.clickAnalytics=a.toString()),n!==void 0&&(y.revenueAnalytics=n.toString()),s!==void 0&&(y.startDate=s.toString()),o!==void 0&&(y.endDate=o.toString()),h!==void 0&&(y.limit=h.toString()),c!==void 0&&(y.offset=c.toString()),g!==void 0&&(y.tags=g.toString());let S={method:"GET",path:P,queryParameters:y,headers:f};return r.request(S,p)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:n,endDate:s,orderBy:o,direction:h,limit:c,offset:g,tags:p},P){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let f="/2/searches",y={},S={};e!==void 0&&(S.index=e.toString()),t!==void 0&&(S.clickAnalytics=t.toString()),a!==void 0&&(S.revenueAnalytics=a.toString()),n!==void 0&&(S.startDate=n.toString()),s!==void 0&&(S.endDate=s.toString()),o!==void 0&&(S.orderBy=o.toString()),h!==void 0&&(S.direction=h.toString()),c!==void 0&&(S.limit=c.toString()),g!==void 0&&(S.offset=g.toString()),p!==void 0&&(S.tags=p.toString());let _={method:"GET",path:f,queryParameters:S,headers:y};return r.request(_,P)},getUsersCount({index:e,startDate:t,endDate:a,tags:n},s){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",h={},c={};e!==void 0&&(c.index=e.toString()),t!==void 0&&(c.startDate=t.toString()),a!==void 0&&(c.endDate=a.toString()),n!==void 0&&(c.tags=n.toString());let g={method:"GET",path:o,queryParameters:c,headers:h};return r.request(g,s)}}}function ae(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(d&&(typeof d!="string"||!re.includes(d)))throw new Error(`\`region\` must be one of the following: ${re.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${te}-${i}`}),E()]}),...m})}var ne="5.5.0",se=["eu","us"];function Ie(i){return[{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:q,...w}){let l=v(i,u,d),r=A({hosts:Ie(q),...w,algoliaAgent:b({algoliaAgents:m,client:"Personalization",version:ne}),baseHeaders:{"content-type":"text/plain",...l.headers(),...w.baseHeaders},baseQueryParameters:{...l.queryParameters(),...w.baseQueryParameters}});return{transporter:r,appId:i,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(e,t){r.algoliaAgent.add({segment:e,version:t})},setClientApiKey({apiKey:e}){!d||d==="WithinHeaders"?r.baseHeaders["x-algolia-api-key"]=e:r.baseQueryParameters["x-algolia-api-key"]=e},customDelete({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let h={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let h={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(h,a)},customPost({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let c={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},customPut({path:e,parameters:t,body:a},n){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(c,n)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let o={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},getPersonalizationStrategy(e){let s={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(s,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let o={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r.request(o,t)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let o={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return r.request(o,t)}}}function oe(i,u,d,m){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");if(!d||d&&(typeof d!="string"||!se.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${se.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ne}-${i}`}),E()]}),...m})}var L="5.5.0";function Oe(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:Oe(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Search",version:L}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return{transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e})},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r},waitForTask({indexName:r,taskID:e,maxRetries:t=50,timeout:a=s=>Math.min(s*200,5e3)},n){let s=0;return N({func:()=>this.getTask({indexName:r,taskID:e},n),validate:o=>o.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=t,message:()=>`The maximum number of retries exceeded. (${s}/${t})`},timeout:()=>a(s)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=n=>Math.min(n*200,5e3)},a){let n=0;return N({func:()=>this.getAppTask({taskID:r},a),validate:s=>s.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=e,message:()=>`The maximum number of retries exceeded. (${n}/${e})`},timeout:()=>t(n)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:n=o=>Math.min(o*200,5e3)},s){let o=0,h={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>n(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return N({...h,func:()=>this.getApiKey({key:e},s),validate:c=>{for(let g of Object.keys(t)){let p=t[g],P=c[g];if(Array.isArray(p)&&Array.isArray(P)){if(p.length!==P.length||p.some((f,y)=>f!==P[y]))return!1}else if(p!==P)return!1}return!0}})}return N({...h,func:()=>this.getApiKey({key:e},s).catch(c=>{if(c.status!==404)throw c}),validate:c=>r==="add"?c!==void 0:c===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return N({func:n=>this.browse({indexName:r,browseParams:{cursor:n?n.cursor:void 0,...e}},a),validate:n=>n.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let n={hitsPerPage:1e3,...e};return N({func:s=>this.searchRules({indexName:r,searchRulesParams:{...n,page:s?s.page+1:n.page||0}},a),validate:s=>s.nbHits<n.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let n={page:0,...e,hitsPerPage:1e3};return N({func:s=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...n,page:n.page}},a);return n.page+=1,o},validate:s=>s.nbHits<n.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:n=1e3},s){let o=[],h=[],c=e.entries();for(let[g,p]of c)o.push({action:t,body:p}),(o.length===n||g===e.length-1)&&(h.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},s)),o=[]);if(a)for(let g of h)await this.waitForTask({indexName:r,taskID:g.taskID});return h},async saveObjects({indexName:r,objects:e},t){return await this.chunkedBatch({indexName:r,objects:e,action:"addObject"},t)},async deleteObjects({indexName:r,objectIDs:e},t){return await this.chunkedBatch({indexName:r,objects:e.map(a=>({objectID:a})),action:"deleteObject"},t)},async partialUpdateObjects({indexName:r,objects:e,createIfNotExists:t},a){return await this.chunkedBatch({indexName:r,objects:e,action:t?"partialUpdateObject":"partialUpdateObjectNoCreate"},a)},async replaceAllObjects({indexName:r,objects:e,batchSize:t},a){let n=Math.floor(Math.random()*1e6)+1e5,s=`${r}_tmp_${n}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),h=await this.chunkedBatch({indexName:s,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:s,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:s,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:s,taskID:o.taskID});let c=await this.operationIndex({indexName:s,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:s,taskID:c.taskID}),{copyOperationResponse:o,batchResponses:h,moveOperationResponse:c}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r})}catch(e){if(e instanceof j&&e.status===404)return!1;throw e}return!0},searchForHits(r,e){return this.search(r,e)},searchForFacets(r,e){return this.search(r,e)},addApiKey(r,e){if(!r)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let s={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(s,e)},addOrUpdateObject({indexName:r,objectID:e,body:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let h={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(h,a)},appendSource(r,e){if(!r)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!r.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let s={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(s,e)},assignUserId({xAlgoliaUserID:r,assignUserIdParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!e)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!e.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let a="/1/clusters/mapping",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batch({indexName:r,batchWriteParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!e)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!e.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let o={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},batchAssignUserIds({xAlgoliaUserID:r,batchAssignUserIdsParams:e},t){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!e)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!e.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!e.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let a="/1/clusters/mapping/batch",n={},s={};r!==void 0&&(n["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:s,headers:n,data:e};return l.request(o,t)},batchDictionaryEntries({dictionaryName:r,batchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!e)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!e.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},browse({indexName:r,browseParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `browse`.");let o={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{}};return l.request(o,t)},clearObjects({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let s={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},clearRules({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},clearSynonyms({indexName:r,forwardToReplicas:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(r)),n={},s={};e!==void 0&&(s.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:s,headers:n};return l.request(o,t)},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let s={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteBy({indexName:r,deleteByParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!e)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let o={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},deleteIndex({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let s={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteObject({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let o={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},deleteRule({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let s={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},deleteSynonym({indexName:r,objectID:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"DELETE",path:n,queryParameters:o,headers:s};return l.request(h,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let s={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let s={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getDictionaryLanguages(r){let n={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(n,r)},getDictionarySettings(r){let n={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(n,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},n=void 0){let s="/1/logs",o={},h={};r!==void 0&&(h.offset=r.toString()),e!==void 0&&(h.length=e.toString()),t!==void 0&&(h.indexName=t.toString()),a!==void 0&&(h.type=a.toString());let c={method:"GET",path:s,queryParameters:h,headers:o};return l.request(c,n)},getObject({indexName:r,objectID:e,attributesToRetrieve:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getObject`.");let n="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),s={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let h={method:"GET",path:n,queryParameters:o,headers:s};return l.request(h,a)},getObjects(r,e){if(!r)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!r.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let s={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},getRule({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getRule`.");let o={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getSettings({indexName:r},e){if(!r)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let s={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},getSources(r){let n={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(n,r)},getSynonym({indexName:r,objectID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let o={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTask({indexName:r,taskID:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let o={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return l.request(o,t)},getTopUserIds(r){let n={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(n,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let s={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},n={};r!==void 0&&(n.getClusters=r.toString());let s={method:"GET",path:t,queryParameters:n,headers:a};return l.request(s,e)},listApiKeys(r){let n={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(n,r)},listClusters(r){let n={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(n,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",n={},s={};r!==void 0&&(s.page=r.toString()),e!==void 0&&(s.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:s,headers:n};return l.request(o,t)},multipleBatch(r,e){if(!r)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!r.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let s={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(s,e)},operationIndex({indexName:r,operationIndexParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!e)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!e.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!e.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},partialUpdateObject({indexName:r,objectID:e,attributesToUpdate:t,createIfNotExists:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.createIfNotExists=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let s={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let s={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(s,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let s={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(s,e)},saveObject({indexName:r,body:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!e)throw new Error("Parameter `body` is required when calling `saveObject`.");let o={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)},saveRule({indexName:r,objectID:e,rule:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!e)throw new Error("Parameter `rules` is required when calling `saveRules`.");let s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.clearExistingRules=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!e)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(r)).replace("{objectID}",encodeURIComponent(e)),o={},h={};a!==void 0&&(h.forwardToReplicas=a.toString());let c={method:"PUT",path:s,queryParameters:h,headers:o,data:t};return l.request(c,n)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},n){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!e)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},h={};t!==void 0&&(h.forwardToReplicas=t.toString()),a!==void 0&&(h.replaceExistingSynonyms=a.toString());let c={method:"POST",path:s,queryParameters:h,headers:o,data:e};return l.request(c,n)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:h,...c})=>c.type==="facet"?{...c,...h,type:"facet"}:{...c,...h,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!r)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!r.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let s={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchDictionaryEntries({dictionaryName:r,searchDictionaryEntriesParams:e},t){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!e)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!e.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let o={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchForFacetValues({indexName:r,facetName:e,searchForFacetValuesRequest:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!e)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let h={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(r)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)},searchRules({indexName:r,searchRulesParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let o={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSingleIndex({indexName:r,searchParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let o={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchSynonyms({indexName:r,searchSynonymsParams:e},t){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let o={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e||{},useReadTransporter:!0,cacheable:!0};return l.request(o,t)},searchUserIds(r,e){if(!r)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!r.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let s={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},setDictionarySettings(r,e){if(!r)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!r.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let s={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(s,e)},setSettings({indexName:r,indexSettings:e,forwardToReplicas:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!e)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let n="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),s={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let h={method:"PUT",path:n,queryParameters:o,headers:s,data:e};return l.request(h,a)},updateApiKey({key:r,apiKey:e},t){if(!r)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!e)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let o={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{},data:e};return l.request(o,t)}}}function ie(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ue({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${L}-${i}`}),E()]}),...d})}var ce="5.5.0";function De(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${i}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${i}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Ne({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...q}){let w=v(i,u,d),l=A({hosts:De(i),...q,algoliaAgent:b({algoliaAgents:m,client:"Recommend",version:ce}),baseHeaders:{"content-type":"text/plain",...w.headers(),...q.baseHeaders},baseQueryParameters:{...w.queryParameters(),...q.baseQueryParameters}});return{transporter:l,appId:i,clearCache(){return Promise.all([l.requestsCache.clear(),l.responsesCache.clear()]).then(()=>{})},get _ua(){return l.algoliaAgent.value},addAlgoliaAgent(r,e){l.algoliaAgent.add({segment:r,version:e})},setClientApiKey({apiKey:r}){!d||d==="WithinHeaders"?l.baseHeaders["x-algolia-api-key"]=r:l.baseQueryParameters["x-algolia-api-key"]=r},customDelete({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let o={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customGet({path:r,parameters:e},t){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let o={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{}};return l.request(o,t)},customPost({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(h,a)},deleteRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let h={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendRule({indexName:r,model:e,objectID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!t)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendStatus({indexName:r,model:e,taskID:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!t)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let h={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return l.request(h,a)},getRecommendations(r,e){if(r&&Array.isArray(r)&&(r={requests:r}),!r)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!r.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let s={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(s,e)},searchRecommendRules({indexName:r,model:e,searchRecommendRulesParams:t},a){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let h={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return l.request(h,a)}}}function ue(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");return Ne({appId:i,apiKey:u,timeouts:{connect:I,read:x,write:O},requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[C({key:`${ce}-${i}`}),E()]}),...d})}function Er(i,u,d){if(!i||typeof i!="string")throw new Error("`appId` is missing.");if(!u||typeof u!="string")throw new Error("`apiKey` is missing.");let m=ie(i,u,d);return{...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(q={})=>ue(q.appId||i,q.apiKey||u,q.options),initAnalytics:(q={})=>ae(q.appId||i,q.apiKey||u,q.region,q.options),initAbtesting:(q={})=>ee(q.appId||i,q.apiKey||u,q.region,q.options),initPersonalization:q=>oe(q.appId||i,q.apiKey||u,q.region,q.options)}}export{ee as abtestingClient,Er as algoliasearch,ae as analyticsClient,L as apiClientVersion,oe as personalizationClient,ue as recommendClient,ie as searchClient};
//# sourceMappingURL=browser.min.js.map

@@ -14,3 +14,3 @@ // lite/builds/browser.ts

import { createAuth, createTransporter, getAlgoliaAgent, shuffle } from "@algolia/client-common";
var apiClientVersion = "5.4.3";
var apiClientVersion = "5.5.0";
function getDefaultHosts(appId) {

@@ -17,0 +17,0 @@ return [

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

function $(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function k(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function s(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a))}function i(){let a=r.timeToLive?r.timeToLive*1e3:null,n=s(),f=Object.fromEntries(Object.entries(n).filter(([,g])=>g.timestamp!==void 0));if(l(f),!a)return;let p=Object.fromEntries(Object.entries(f).filter(([,g])=>{let c=new Date().getTime();return!(g.timestamp+a<c)}));l(p)}return{get(a,n,f={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),s()[JSON.stringify(a)])).then(p=>Promise.all([p?p.value:n(),p!==void 0])).then(([p,g])=>Promise.all([p,g||f.miss(p)])).then(([p])=>p)},set(a,n){return Promise.resolve().then(()=>{let f=s();return f[JSON.stringify(a)]={timestamp:new Date().getTime(),value:n},t().setItem(o,JSON.stringify(f)),n})},delete(a){return Promise.resolve().then(()=>{let n=s();delete n[JSON.stringify(a)],t().setItem(o,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function Y(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(s=>Promise.all([s,o.miss(s)])).then(([s])=>s)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(r){let e=[...r.caches],o=e.shift();return o===void 0?Y():{get(t,s,l={miss:()=>Promise.resolve()}){return o.get(t,s,l).catch(()=>E({caches:e}).get(t,s,l))},set(t,s){return o.set(t,s).catch(()=>E({caches:e}).set(t,s))},delete(t){return o.delete(t).catch(()=>E({caches:e}).delete(t))},clear(){return o.clear().catch(()=>E({caches:e}).clear())}}}function w(r={serializable:!0}){let e={};return{get(o,t,s={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let i=t();return i.then(a=>s.miss(a)).then(()=>i)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var F=2*60*1e3;function W(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>F}function s(){return e==="timed out"&&Date.now()-o<=F}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:s}}var M=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}},H=class extends M{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},Z=class extends H{constructor(r){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.",r,"RetryError")}},C=class extends H{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},ee=class extends M{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},re=class extends C{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function I(r){let e=r;for(let o=r.length-1;o>0;o--){let t=Math.floor(Math.random()*(o+1)),s=r[o];e[o]=r[t],e[t]=s}return e}function te(r,e,o){let t=oe(o),s=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(s+=`?${t}`),s}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replaceAll("+","%20")}`).join("&")}function ae(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function se(r,e,o){let t={Accept:"application/json",...r,...e,...o},s={};return Object.keys(t).forEach(l=>{let i=t[l];s[l.toLowerCase()]=i}),s}function ne(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new re(t.message,e,t.error,o):new C(t.message,e,o)}catch{}return new C(r,e,o)}function ce({isTimedOut:r,status:e}){return!r&&~~e===0}function me({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return~~(r/100)===2}function ue(r){return r.map(e=>j(e))}function j(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function J({hosts:r,hostsCache:e,baseHeaders:o,baseQueryParameters:t,algoliaAgent:s,timeouts:l,requester:i,requestsCache:a,responsesCache:n}){async function f(c){let m=await Promise.all(c.map(u=>e.get(u,()=>Promise.resolve(W(u))))),x=m.filter(u=>u.isUp()),d=m.filter(u=>u.isTimedOut()),R=[...x,...d];return{hosts:R.length>0?R:c,getTimeout(u,P){return(d.length===0&&u===0?1:d.length+3+u)*P}}}async function p(c,m,x=!0){let d=[],R=ae(c,m),y=se(o,c.headers,m.headers),u=c.method==="GET"?{...c.data,...m.data}:{},P={...t,...c.queryParameters,...u};if(s.value&&(P["x-algolia-agent"]=s.value),m&&m.queryParameters)for(let h of Object.keys(m.queryParameters))!m.queryParameters[h]||Object.prototype.toString.call(m.queryParameters[h])==="[object Object]"?P[h]=m.queryParameters[h]:P[h]=m.queryParameters[h].toString();let v=0,N=async(h,O)=>{let S=h.pop();if(S===void 0)throw new Z(ue(d));let b={...l,...m.timeouts},L={data:R,headers:y,method:c.method,url:te(S,c.path,P),connectTimeout:O(v,b.connect),responseTimeout:O(v,x?b.read:b.write)},D=q=>{let U={request:L,response:q,host:S,triesLeft:h.length};return d.push(U),U},T=await i.send(L);if(me(T)){let q=D(T);return T.isTimedOut&&v++,console.log("Retryable failure",j(q)),await e.set(S,W(S,T.isTimedOut?"timed out":"down")),N(h,O)}if(le(T))return ne(T);throw D(T),ie(T,d)},K=r.filter(h=>h.accept==="readWrite"||(x?h.accept==="read":h.accept==="write")),_=await f(K);return N([..._.hosts].reverse(),_.getTimeout)}function g(c,m={}){let x=c.useReadTransporter||c.method==="GET";if(!x)return p(c,m,x);let d=()=>p(c,m);if((m.cacheable||c.cacheable)!==!0)return d();let y={request:c,requestOptions:m,transporter:{queryParameters:t,headers:o}};return n.get(y,()=>a.get(y,()=>a.set(y,d()).then(u=>Promise.all([a.delete(y),u]),u=>Promise.all([a.delete(y),Promise.reject(u)])).then(([u,P])=>P)),{miss:u=>n.set(y,u)})}return{hostsCache:e,requester:i,timeouts:l,algoliaAgent:s,baseHeaders:o,baseQueryParameters:t,hosts:r,request:g,requestsCache:a,responsesCache:n}}function pe(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function z({algoliaAgents:r,client:e,version:o}){let t=pe(o).add({segment:e,version:o});return r.forEach(s=>t.add(s)),t}var G=1e3,Q=2e3,B=3e4;function V(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let s=(a,n)=>setTimeout(()=>{t.abort(),o({status:0,content:n,isTimedOut:!0})},a),l=s(e.connectTimeout,"Connection timeout"),i;t.onreadystatechange=()=>{t.readyState>t.OPENED&&i===void 0&&(clearTimeout(l),i=s(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(i),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(i),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}var A="5.4.3";function fe(r){return[{url:`${r}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${r}.algolia.net`,accept:"write",protocol:"https"}].concat(I([{url:`${r}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,...s}){let l=$(r,e,o),i=J({hosts:fe(r),...s,algoliaAgent:z({algoliaAgents:t,client:"Lite",version:A}),baseHeaders:{"content-type":"text/plain",...l.headers(),...s.baseHeaders},baseQueryParameters:{...l.queryParameters(),...s.baseQueryParameters}});return{transporter:i,appId:r,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(a,n){i.algoliaAgent.add({segment:a,version:n})},setClientApiKey({apiKey:a}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=a:i.baseQueryParameters["x-algolia-api-key"]=a},searchForHits(a,n){return this.search(a,n)},searchForFacets(a,n){return this.search(a,n)},customPost({path:a,parameters:n,body:f},p){if(!a)throw new Error("Parameter `path` is required when calling `customPost`.");let x={method:"POST",path:"/{path}".replace("{path}",a),queryParameters:n||{},headers:{},data:f||{}};return i.request(x,p)},getRecommendations(a,n){if(a&&Array.isArray(a)&&(a={requests:a}),!a)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!a.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let c={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)},search(a,n){if(a&&Array.isArray(a)&&(a={requests:a.map(({params:x,...d})=>d.type==="facet"?{...d,...x,type:"facet"}:{...d,...x,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!a)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!a.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let c={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)}}}function Ut(r,e,o){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:r,apiKey:e,timeouts:{connect:G,read:Q,write:B},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:w(),requestsCache:w({serializable:!1}),hostsCache:E({caches:[k({key:`${A}-${r}`}),w()]}),...o})}export{A as apiClientVersion,Ut as liteClient};
function $(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function k(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function s(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a))}function i(){let a=r.timeToLive?r.timeToLive*1e3:null,n=s(),f=Object.fromEntries(Object.entries(n).filter(([,g])=>g.timestamp!==void 0));if(l(f),!a)return;let p=Object.fromEntries(Object.entries(f).filter(([,g])=>{let c=new Date().getTime();return!(g.timestamp+a<c)}));l(p)}return{get(a,n,f={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),s()[JSON.stringify(a)])).then(p=>Promise.all([p?p.value:n(),p!==void 0])).then(([p,g])=>Promise.all([p,g||f.miss(p)])).then(([p])=>p)},set(a,n){return Promise.resolve().then(()=>{let f=s();return f[JSON.stringify(a)]={timestamp:new Date().getTime(),value:n},t().setItem(o,JSON.stringify(f)),n})},delete(a){return Promise.resolve().then(()=>{let n=s();delete n[JSON.stringify(a)],t().setItem(o,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function Y(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(s=>Promise.all([s,o.miss(s)])).then(([s])=>s)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(r){let e=[...r.caches],o=e.shift();return o===void 0?Y():{get(t,s,l={miss:()=>Promise.resolve()}){return o.get(t,s,l).catch(()=>E({caches:e}).get(t,s,l))},set(t,s){return o.set(t,s).catch(()=>E({caches:e}).set(t,s))},delete(t){return o.delete(t).catch(()=>E({caches:e}).delete(t))},clear(){return o.clear().catch(()=>E({caches:e}).clear())}}}function w(r={serializable:!0}){let e={};return{get(o,t,s={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let i=t();return i.then(a=>s.miss(a)).then(()=>i)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var F=2*60*1e3;function W(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>F}function s(){return e==="timed out"&&Date.now()-o<=F}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:s}}var M=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}},H=class extends M{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},Z=class extends H{constructor(r){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.",r,"RetryError")}},C=class extends H{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},ee=class extends M{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},re=class extends C{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function I(r){let e=r;for(let o=r.length-1;o>0;o--){let t=Math.floor(Math.random()*(o+1)),s=r[o];e[o]=r[t],e[t]=s}return e}function te(r,e,o){let t=oe(o),s=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(s+=`?${t}`),s}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replaceAll("+","%20")}`).join("&")}function ae(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function se(r,e,o){let t={Accept:"application/json",...r,...e,...o},s={};return Object.keys(t).forEach(l=>{let i=t[l];s[l.toLowerCase()]=i}),s}function ne(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new re(t.message,e,t.error,o):new C(t.message,e,o)}catch{}return new C(r,e,o)}function ce({isTimedOut:r,status:e}){return!r&&~~e===0}function me({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return~~(r/100)===2}function ue(r){return r.map(e=>j(e))}function j(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function J({hosts:r,hostsCache:e,baseHeaders:o,baseQueryParameters:t,algoliaAgent:s,timeouts:l,requester:i,requestsCache:a,responsesCache:n}){async function f(c){let m=await Promise.all(c.map(u=>e.get(u,()=>Promise.resolve(W(u))))),x=m.filter(u=>u.isUp()),d=m.filter(u=>u.isTimedOut()),R=[...x,...d];return{hosts:R.length>0?R:c,getTimeout(u,P){return(d.length===0&&u===0?1:d.length+3+u)*P}}}async function p(c,m,x=!0){let d=[],R=ae(c,m),y=se(o,c.headers,m.headers),u=c.method==="GET"?{...c.data,...m.data}:{},P={...t,...c.queryParameters,...u};if(s.value&&(P["x-algolia-agent"]=s.value),m&&m.queryParameters)for(let h of Object.keys(m.queryParameters))!m.queryParameters[h]||Object.prototype.toString.call(m.queryParameters[h])==="[object Object]"?P[h]=m.queryParameters[h]:P[h]=m.queryParameters[h].toString();let v=0,N=async(h,O)=>{let S=h.pop();if(S===void 0)throw new Z(ue(d));let b={...l,...m.timeouts},L={data:R,headers:y,method:c.method,url:te(S,c.path,P),connectTimeout:O(v,b.connect),responseTimeout:O(v,x?b.read:b.write)},D=q=>{let U={request:L,response:q,host:S,triesLeft:h.length};return d.push(U),U},T=await i.send(L);if(me(T)){let q=D(T);return T.isTimedOut&&v++,console.log("Retryable failure",j(q)),await e.set(S,W(S,T.isTimedOut?"timed out":"down")),N(h,O)}if(le(T))return ne(T);throw D(T),ie(T,d)},K=r.filter(h=>h.accept==="readWrite"||(x?h.accept==="read":h.accept==="write")),_=await f(K);return N([..._.hosts].reverse(),_.getTimeout)}function g(c,m={}){let x=c.useReadTransporter||c.method==="GET";if(!x)return p(c,m,x);let d=()=>p(c,m);if((m.cacheable||c.cacheable)!==!0)return d();let y={request:c,requestOptions:m,transporter:{queryParameters:t,headers:o}};return n.get(y,()=>a.get(y,()=>a.set(y,d()).then(u=>Promise.all([a.delete(y),u]),u=>Promise.all([a.delete(y),Promise.reject(u)])).then(([u,P])=>P)),{miss:u=>n.set(y,u)})}return{hostsCache:e,requester:i,timeouts:l,algoliaAgent:s,baseHeaders:o,baseQueryParameters:t,hosts:r,request:g,requestsCache:a,responsesCache:n}}function pe(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function z({algoliaAgents:r,client:e,version:o}){let t=pe(o).add({segment:e,version:o});return r.forEach(s=>t.add(s)),t}var G=1e3,Q=2e3,B=3e4;function V(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let s=(a,n)=>setTimeout(()=>{t.abort(),o({status:0,content:n,isTimedOut:!0})},a),l=s(e.connectTimeout,"Connection timeout"),i;t.onreadystatechange=()=>{t.readyState>t.OPENED&&i===void 0&&(clearTimeout(l),i=s(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(i),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(i),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}var A="5.5.0";function fe(r){return[{url:`${r}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${r}.algolia.net`,accept:"write",protocol:"https"}].concat(I([{url:`${r}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,...s}){let l=$(r,e,o),i=J({hosts:fe(r),...s,algoliaAgent:z({algoliaAgents:t,client:"Lite",version:A}),baseHeaders:{"content-type":"text/plain",...l.headers(),...s.baseHeaders},baseQueryParameters:{...l.queryParameters(),...s.baseQueryParameters}});return{transporter:i,appId:r,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(a,n){i.algoliaAgent.add({segment:a,version:n})},setClientApiKey({apiKey:a}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=a:i.baseQueryParameters["x-algolia-api-key"]=a},searchForHits(a,n){return this.search(a,n)},searchForFacets(a,n){return this.search(a,n)},customPost({path:a,parameters:n,body:f},p){if(!a)throw new Error("Parameter `path` is required when calling `customPost`.");let x={method:"POST",path:"/{path}".replace("{path}",a),queryParameters:n||{},headers:{},data:f||{}};return i.request(x,p)},getRecommendations(a,n){if(a&&Array.isArray(a)&&(a={requests:a}),!a)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!a.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let c={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)},search(a,n){if(a&&Array.isArray(a)&&(a={requests:a.map(({params:x,...d})=>d.type==="facet"?{...d,...x,type:"facet"}:{...d,...x,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!a)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!a.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let c={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)}}}function Ut(r,e,o){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:r,apiKey:e,timeouts:{connect:G,read:Q,write:B},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:w(),requestsCache:w({serializable:!1}),hostsCache:E({caches:[k({key:`${A}-${r}`}),w()]}),...o})}export{A as apiClientVersion,Ut as liteClient};
//# sourceMappingURL=browser.min.js.map

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

function $(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return {headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function k(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function s(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a));}function i(){let a=r.timeToLive?r.timeToLive*1e3:null,n=s(),f=Object.fromEntries(Object.entries(n).filter(([,g])=>g.timestamp!==void 0));if(l(f),!a)return;let p=Object.fromEntries(Object.entries(f).filter(([,g])=>{let c=new Date().getTime();return !(g.timestamp+a<c)}));l(p);}return {get(a,n,f={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),s()[JSON.stringify(a)])).then(p=>Promise.all([p?p.value:n(),p!==void 0])).then(([p,g])=>Promise.all([p,g||f.miss(p)])).then(([p])=>p)},set(a,n){return Promise.resolve().then(()=>{let f=s();return f[JSON.stringify(a)]={timestamp:new Date().getTime(),value:n},t().setItem(o,JSON.stringify(f)),n})},delete(a){return Promise.resolve().then(()=>{let n=s();delete n[JSON.stringify(a)],t().setItem(o,JSON.stringify(n));})},clear(){return Promise.resolve().then(()=>{t().removeItem(o);})}}}function Y(){return {get(r,e,o={miss:()=>Promise.resolve()}){return e().then(s=>Promise.all([s,o.miss(s)])).then(([s])=>s)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(r){let e=[...r.caches],o=e.shift();return o===void 0?Y():{get(t,s,l={miss:()=>Promise.resolve()}){return o.get(t,s,l).catch(()=>E({caches:e}).get(t,s,l))},set(t,s){return o.set(t,s).catch(()=>E({caches:e}).set(t,s))},delete(t){return o.delete(t).catch(()=>E({caches:e}).delete(t))},clear(){return o.clear().catch(()=>E({caches:e}).clear())}}}function w(r={serializable:!0}){let e={};return {get(o,t,s={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let i=t();return i.then(a=>s.miss(a)).then(()=>i)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var F=2*60*1e3;function W(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>F}function s(){return e==="timed out"&&Date.now()-o<=F}return {...r,status:e,lastUpdate:o,isUp:t,isTimedOut:s}}var M=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e);}},H=class extends M{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e;}},Z=class extends H{constructor(r){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.",r,"RetryError");}},C=class extends H{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e;}},ee=class extends M{response;constructor(r,e){super(r,"DeserializationError"),this.response=e;}},re=class extends C{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o;}};function I(r){let e=r;for(let o=r.length-1;o>0;o--){let t=Math.floor(Math.random()*(o+1)),s=r[o];e[o]=r[t],e[t]=s;}return e}function te(r,e,o){let t=oe(o),s=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(s+=`?${t}`),s}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replaceAll("+","%20")}`).join("&")}function ae(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function se(r,e,o){let t={Accept:"application/json",...r,...e,...o},s={};return Object.keys(t).forEach(l=>{let i=t[l];s[l.toLowerCase()]=i;}),s}function ne(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return "error"in t?new re(t.message,e,t.error,o):new C(t.message,e,o)}catch{}return new C(r,e,o)}function ce({isTimedOut:r,status:e}){return !r&&~~e===0}function me({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return ~~(r/100)===2}function ue(r){return r.map(e=>j(e))}function j(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function J({hosts:r,hostsCache:e,baseHeaders:o,baseQueryParameters:t,algoliaAgent:s,timeouts:l,requester:i,requestsCache:a,responsesCache:n}){async function f(c){let m=await Promise.all(c.map(u=>e.get(u,()=>Promise.resolve(W(u))))),x=m.filter(u=>u.isUp()),d=m.filter(u=>u.isTimedOut()),R=[...x,...d];return {hosts:R.length>0?R:c,getTimeout(u,P){return (d.length===0&&u===0?1:d.length+3+u)*P}}}async function p(c,m,x=!0){let d=[],R=ae(c,m),y=se(o,c.headers,m.headers),u=c.method==="GET"?{...c.data,...m.data}:{},P={...t,...c.queryParameters,...u};if(s.value&&(P["x-algolia-agent"]=s.value),m&&m.queryParameters)for(let h of Object.keys(m.queryParameters))!m.queryParameters[h]||Object.prototype.toString.call(m.queryParameters[h])==="[object Object]"?P[h]=m.queryParameters[h]:P[h]=m.queryParameters[h].toString();let v=0,N=async(h,O)=>{let S=h.pop();if(S===void 0)throw new Z(ue(d));let b={...l,...m.timeouts},L={data:R,headers:y,method:c.method,url:te(S,c.path,P),connectTimeout:O(v,b.connect),responseTimeout:O(v,x?b.read:b.write)},D=q=>{let U={request:L,response:q,host:S,triesLeft:h.length};return d.push(U),U},T=await i.send(L);if(me(T)){let q=D(T);return T.isTimedOut&&v++,console.log("Retryable failure",j(q)),await e.set(S,W(S,T.isTimedOut?"timed out":"down")),N(h,O)}if(le(T))return ne(T);throw D(T),ie(T,d)},K=r.filter(h=>h.accept==="readWrite"||(x?h.accept==="read":h.accept==="write")),_=await f(K);return N([..._.hosts].reverse(),_.getTimeout)}function g(c,m={}){let x=c.useReadTransporter||c.method==="GET";if(!x)return p(c,m,x);let d=()=>p(c,m);if((m.cacheable||c.cacheable)!==!0)return d();let y={request:c,requestOptions:m,transporter:{queryParameters:t,headers:o}};return n.get(y,()=>a.get(y,()=>a.set(y,d()).then(u=>Promise.all([a.delete(y),u]),u=>Promise.all([a.delete(y),Promise.reject(u)])).then(([u,P])=>P)),{miss:u=>n.set(y,u)})}return {hostsCache:e,requester:i,timeouts:l,algoliaAgent:s,baseHeaders:o,baseQueryParameters:t,hosts:r,request:g,requestsCache:a,responsesCache:n}}function pe(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function z({algoliaAgents:r,client:e,version:o}){let t=pe(o).add({segment:e,version:o});return r.forEach(s=>t.add(s)),t}var G=1e3,Q=2e3,B=3e4;function V(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let s=(a,n)=>setTimeout(()=>{t.abort(),o({status:0,content:n,isTimedOut:!0});},a),l=s(e.connectTimeout,"Connection timeout"),i;t.onreadystatechange=()=>{t.readyState>t.OPENED&&i===void 0&&(clearTimeout(l),i=s(e.responseTimeout,"Socket timeout"));},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(i),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}));},t.onload=()=>{clearTimeout(l),clearTimeout(i),o({content:t.responseText,status:t.status,isTimedOut:!1});},t.send(e.data);})}return {send:r}}var A="5.4.3";function fe(r){return [{url:`${r}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${r}.algolia.net`,accept:"write",protocol:"https"}].concat(I([{url:`${r}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,...s}){let l=$(r,e,o),i=J({hosts:fe(r),...s,algoliaAgent:z({algoliaAgents:t,client:"Lite",version:A}),baseHeaders:{"content-type":"text/plain",...l.headers(),...s.baseHeaders},baseQueryParameters:{...l.queryParameters(),...s.baseQueryParameters}});return {transporter:i,appId:r,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(a,n){i.algoliaAgent.add({segment:a,version:n});},setClientApiKey({apiKey:a}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=a:i.baseQueryParameters["x-algolia-api-key"]=a;},searchForHits(a,n){return this.search(a,n)},searchForFacets(a,n){return this.search(a,n)},customPost({path:a,parameters:n,body:f},p){if(!a)throw new Error("Parameter `path` is required when calling `customPost`.");let x={method:"POST",path:"/{path}".replace("{path}",a),queryParameters:n||{},headers:{},data:f||{}};return i.request(x,p)},getRecommendations(a,n){if(a&&Array.isArray(a)&&(a={requests:a}),!a)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!a.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let c={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)},search(a,n){if(a&&Array.isArray(a)&&(a={requests:a.map(({params:x,...d})=>d.type==="facet"?{...d,...x,type:"facet"}:{...d,...x,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!a)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!a.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let c={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)}}}function Ut(r,e,o){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:r,apiKey:e,timeouts:{connect:G,read:Q,write:B},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:w(),requestsCache:w({serializable:!1}),hostsCache:E({caches:[k({key:`${A}-${r}`}),w()]}),...o})}
function $(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return {headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function k(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function s(){return JSON.parse(t().getItem(o)||"{}")}function l(a){t().setItem(o,JSON.stringify(a));}function i(){let a=r.timeToLive?r.timeToLive*1e3:null,n=s(),f=Object.fromEntries(Object.entries(n).filter(([,g])=>g.timestamp!==void 0));if(l(f),!a)return;let p=Object.fromEntries(Object.entries(f).filter(([,g])=>{let c=new Date().getTime();return !(g.timestamp+a<c)}));l(p);}return {get(a,n,f={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),s()[JSON.stringify(a)])).then(p=>Promise.all([p?p.value:n(),p!==void 0])).then(([p,g])=>Promise.all([p,g||f.miss(p)])).then(([p])=>p)},set(a,n){return Promise.resolve().then(()=>{let f=s();return f[JSON.stringify(a)]={timestamp:new Date().getTime(),value:n},t().setItem(o,JSON.stringify(f)),n})},delete(a){return Promise.resolve().then(()=>{let n=s();delete n[JSON.stringify(a)],t().setItem(o,JSON.stringify(n));})},clear(){return Promise.resolve().then(()=>{t().removeItem(o);})}}}function Y(){return {get(r,e,o={miss:()=>Promise.resolve()}){return e().then(s=>Promise.all([s,o.miss(s)])).then(([s])=>s)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(r){let e=[...r.caches],o=e.shift();return o===void 0?Y():{get(t,s,l={miss:()=>Promise.resolve()}){return o.get(t,s,l).catch(()=>E({caches:e}).get(t,s,l))},set(t,s){return o.set(t,s).catch(()=>E({caches:e}).set(t,s))},delete(t){return o.delete(t).catch(()=>E({caches:e}).delete(t))},clear(){return o.clear().catch(()=>E({caches:e}).clear())}}}function w(r={serializable:!0}){let e={};return {get(o,t,s={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let i=t();return i.then(a=>s.miss(a)).then(()=>i)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var F=2*60*1e3;function W(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>F}function s(){return e==="timed out"&&Date.now()-o<=F}return {...r,status:e,lastUpdate:o,isUp:t,isTimedOut:s}}var M=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e);}},H=class extends M{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e;}},Z=class extends H{constructor(r){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.",r,"RetryError");}},C=class extends H{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e;}},ee=class extends M{response;constructor(r,e){super(r,"DeserializationError"),this.response=e;}},re=class extends C{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o;}};function I(r){let e=r;for(let o=r.length-1;o>0;o--){let t=Math.floor(Math.random()*(o+1)),s=r[o];e[o]=r[t],e[t]=s;}return e}function te(r,e,o){let t=oe(o),s=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(s+=`?${t}`),s}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replaceAll("+","%20")}`).join("&")}function ae(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function se(r,e,o){let t={Accept:"application/json",...r,...e,...o},s={};return Object.keys(t).forEach(l=>{let i=t[l];s[l.toLowerCase()]=i;}),s}function ne(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return "error"in t?new re(t.message,e,t.error,o):new C(t.message,e,o)}catch{}return new C(r,e,o)}function ce({isTimedOut:r,status:e}){return !r&&~~e===0}function me({isTimedOut:r,status:e}){return r||ce({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:r}){return ~~(r/100)===2}function ue(r){return r.map(e=>j(e))}function j(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function J({hosts:r,hostsCache:e,baseHeaders:o,baseQueryParameters:t,algoliaAgent:s,timeouts:l,requester:i,requestsCache:a,responsesCache:n}){async function f(c){let m=await Promise.all(c.map(u=>e.get(u,()=>Promise.resolve(W(u))))),x=m.filter(u=>u.isUp()),d=m.filter(u=>u.isTimedOut()),R=[...x,...d];return {hosts:R.length>0?R:c,getTimeout(u,P){return (d.length===0&&u===0?1:d.length+3+u)*P}}}async function p(c,m,x=!0){let d=[],R=ae(c,m),y=se(o,c.headers,m.headers),u=c.method==="GET"?{...c.data,...m.data}:{},P={...t,...c.queryParameters,...u};if(s.value&&(P["x-algolia-agent"]=s.value),m&&m.queryParameters)for(let h of Object.keys(m.queryParameters))!m.queryParameters[h]||Object.prototype.toString.call(m.queryParameters[h])==="[object Object]"?P[h]=m.queryParameters[h]:P[h]=m.queryParameters[h].toString();let v=0,N=async(h,O)=>{let S=h.pop();if(S===void 0)throw new Z(ue(d));let b={...l,...m.timeouts},L={data:R,headers:y,method:c.method,url:te(S,c.path,P),connectTimeout:O(v,b.connect),responseTimeout:O(v,x?b.read:b.write)},D=q=>{let U={request:L,response:q,host:S,triesLeft:h.length};return d.push(U),U},T=await i.send(L);if(me(T)){let q=D(T);return T.isTimedOut&&v++,console.log("Retryable failure",j(q)),await e.set(S,W(S,T.isTimedOut?"timed out":"down")),N(h,O)}if(le(T))return ne(T);throw D(T),ie(T,d)},K=r.filter(h=>h.accept==="readWrite"||(x?h.accept==="read":h.accept==="write")),_=await f(K);return N([..._.hosts].reverse(),_.getTimeout)}function g(c,m={}){let x=c.useReadTransporter||c.method==="GET";if(!x)return p(c,m,x);let d=()=>p(c,m);if((m.cacheable||c.cacheable)!==!0)return d();let y={request:c,requestOptions:m,transporter:{queryParameters:t,headers:o}};return n.get(y,()=>a.get(y,()=>a.set(y,d()).then(u=>Promise.all([a.delete(y),u]),u=>Promise.all([a.delete(y),Promise.reject(u)])).then(([u,P])=>P)),{miss:u=>n.set(y,u)})}return {hostsCache:e,requester:i,timeouts:l,algoliaAgent:s,baseHeaders:o,baseQueryParameters:t,hosts:r,request:g,requestsCache:a,responsesCache:n}}function pe(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function z({algoliaAgents:r,client:e,version:o}){let t=pe(o).add({segment:e,version:o});return r.forEach(s=>t.add(s)),t}var G=1e3,Q=2e3,B=3e4;function V(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let s=(a,n)=>setTimeout(()=>{t.abort(),o({status:0,content:n,isTimedOut:!0});},a),l=s(e.connectTimeout,"Connection timeout"),i;t.onreadystatechange=()=>{t.readyState>t.OPENED&&i===void 0&&(clearTimeout(l),i=s(e.responseTimeout,"Socket timeout"));},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(i),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}));},t.onload=()=>{clearTimeout(l),clearTimeout(i),o({content:t.responseText,status:t.status,isTimedOut:!1});},t.send(e.data);})}return {send:r}}var A="5.5.0";function fe(r){return [{url:`${r}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${r}.algolia.net`,accept:"write",protocol:"https"}].concat(I([{url:`${r}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${r}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,...s}){let l=$(r,e,o),i=J({hosts:fe(r),...s,algoliaAgent:z({algoliaAgents:t,client:"Lite",version:A}),baseHeaders:{"content-type":"text/plain",...l.headers(),...s.baseHeaders},baseQueryParameters:{...l.queryParameters(),...s.baseQueryParameters}});return {transporter:i,appId:r,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(a,n){i.algoliaAgent.add({segment:a,version:n});},setClientApiKey({apiKey:a}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=a:i.baseQueryParameters["x-algolia-api-key"]=a;},searchForHits(a,n){return this.search(a,n)},searchForFacets(a,n){return this.search(a,n)},customPost({path:a,parameters:n,body:f},p){if(!a)throw new Error("Parameter `path` is required when calling `customPost`.");let x={method:"POST",path:"/{path}".replace("{path}",a),queryParameters:n||{},headers:{},data:f||{}};return i.request(x,p)},getRecommendations(a,n){if(a&&Array.isArray(a)&&(a={requests:a}),!a)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!a.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let c={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)},search(a,n){if(a&&Array.isArray(a)&&(a={requests:a.map(({params:x,...d})=>d.type==="facet"?{...d,...x,type:"facet"}:{...d,...x,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!a)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!a.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let c={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return i.request(c,n)}}}function Ut(r,e,o){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:r,apiKey:e,timeouts:{connect:G,read:Q,write:B},requester:V(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:w(),requestsCache:w({serializable:!1}),hostsCache:E({caches:[k({key:`${A}-${r}`}),w()]}),...o})}

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

@@ -13,3 +13,3 @@ // lite/builds/node.ts

import { createAuth, createTransporter, getAlgoliaAgent, shuffle } from "@algolia/client-common";
var apiClientVersion = "5.4.3";
var apiClientVersion = "5.5.0";
function getDefaultHosts(appId) {

@@ -16,0 +16,0 @@ return [

// lite/src/liteClient.ts
import { createAuth, createTransporter, getAlgoliaAgent, shuffle } from "@algolia/client-common";
var apiClientVersion = "5.4.3";
var apiClientVersion = "5.5.0";
function getDefaultHosts(appId) {

@@ -5,0 +5,0 @@ return [

@@ -25,3 +25,3 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

export const apiClientVersion = '5.4.3';
export const apiClientVersion = '5.5.0';

@@ -28,0 +28,0 @@ function getDefaultHosts(appId: string): Host[] {

{
"version": "5.4.3",
"version": "5.5.0",
"repository": {

@@ -62,2 +62,3 @@ "type": "git",

"unpkg": "./dist/algoliasearch.umd.js",
"react-native": "./dist/browser.js",
"files": [

@@ -73,14 +74,14 @@ "dist",

"dependencies": {
"@algolia/client-abtesting": "5.4.3",
"@algolia/client-analytics": "5.4.3",
"@algolia/client-common": "5.4.3",
"@algolia/client-personalization": "5.4.3",
"@algolia/client-search": "5.4.3",
"@algolia/recommend": "5.4.3",
"@algolia/requester-browser-xhr": "5.4.3",
"@algolia/requester-fetch": "5.4.3",
"@algolia/requester-node-http": "5.4.3"
"@algolia/client-abtesting": "5.5.0",
"@algolia/client-analytics": "5.5.0",
"@algolia/client-common": "5.5.0",
"@algolia/client-personalization": "5.5.0",
"@algolia/client-search": "5.5.0",
"@algolia/recommend": "5.5.0",
"@algolia/requester-browser-xhr": "5.5.0",
"@algolia/requester-fetch": "5.5.0",
"@algolia/requester-node-http": "5.5.0"
},
"devDependencies": {
"@algolia/requester-testing": "5.4.3",
"@algolia/requester-testing": "5.5.0",
"@arethetypeswrong/cli": "0.16.2",

@@ -87,0 +88,0 @@ "@types/node": "22.5.5",

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 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 not supported yet

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