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.6.0 to 5.6.1

2

dist/algoliasearch.umd.js

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

function v(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function g(){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=g(),t=Object.fromEntries(Object.entries(e).filter(([,s])=>s.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,s])=>{let n=new Date().getTime();return !(s.timestamp+r<n)}));w(a);}return {get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),g()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,s])=>Promise.all([a,s||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=g();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=g();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{m().removeItem(d);})}}}function de(){return {get(i,u,d={miss:()=>Promise.resolve()}){return u().then(g=>Promise.all([g,d.miss(g)])).then(([g])=>g)},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?de():{get(m,g,w={miss:()=>Promise.resolve()}){return d.get(m,g,w).catch(()=>R({caches:u}).get(m,g,w))},set(m,g){return d.set(m,g).catch(()=>R({caches:u}).set(m,g))},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,g={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=>g.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 C=1e3,A=2e3,b=3e4;function me(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 I(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 k({func:i,validate:u,aggregator:d,error:m,timeout:g=()=>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);},g()))).catch(t=>{e(t);});});return w()}function x({algoliaAgents:i,client:u,version:d}){let m=me(d).add({segment:u,version:d});return i.forEach(g=>m.add(g)),m}function O(){return {debug(i,u){return Promise.resolve()},info(i,u){return Promise.resolve()},error(i,u){return Promise.resolve()}}}var K=2*60*1e3;function J(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>K}function g(){return u==="timed out"&&Date.now()-d<=K}return {...i,status:u,lastUpdate:d,isUp:m,isTimedOut:g}}var V=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u);}},X=class extends V{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u;}},ge=class extends X{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");}},_=class extends X{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u;}},qe=class extends V{response;constructor(i,u){super(i,"DeserializationError"),this.response=u;}},Pe=class extends _{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d;}};function B(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),g=i[d];u[d]=i[m],u[m]=g;}return u}function pe(i,u,d){let m=we(d),g=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(g+=`?${m}`),g}function we(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 fe(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 ye(i,u,d){let m={Accept:"application/json",...i,...u,...d},g={};return Object.keys(m).forEach(w=>{let l=m[w];g[w.toLowerCase()]=l;}),g}function Ee(i){try{return JSON.parse(i.content)}catch(u){throw new qe(u.message,i)}}function Se({content:i,status:u},d){try{let m=JSON.parse(i);return "error"in m?new Pe(m.message,u,m.error,d):new _(m.message,u,d)}catch{}return new _(i,u,d)}function Te({isTimedOut:i,status:u}){return !i&&~~u===0}function Re({isTimedOut:i,status:u}){return i||Te({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function ve({status:i}){return ~~(i/100)===2}function Ce(i){return i.map(u=>Y(u))}function Y(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 U({hosts:i,hostsCache:u,baseHeaders:d,logger:m,baseQueryParameters:g,algoliaAgent:w,timeouts:l,requester:r,requestsCache:e,responsesCache:t}){async function a(o){let c=await Promise.all(o.map(f=>u.get(f,()=>Promise.resolve(J(f))))),h=c.filter(f=>f.isUp()),q=c.filter(f=>f.isTimedOut()),P=[...h,...q];return {hosts:P.length>0?P:o,getTimeout(f,y){return (q.length===0&&f===0?1:q.length+3+f)*y}}}async function s(o,c,h=!0){let q=[],P=fe(o,c),p=ye(d,o.headers,c.headers),f=o.method==="GET"?{...o.data,...c.data}:{},y={...g,...o.queryParameters,...f};if(w.value&&(y["x-algolia-agent"]=w.value),c&&c.queryParameters)for(let T of Object.keys(c.queryParameters))!c.queryParameters[T]||Object.prototype.toString.call(c.queryParameters[T])==="[object Object]"?y[T]=c.queryParameters[T]:y[T]=c.queryParameters[T].toString();let S=0,F=async(T,G)=>{let j=T.pop();if(j===void 0)throw new ge(Ce(q));let L={...l,...c.timeouts},H={data:P,headers:p,method:o.method,url:pe(j,o.path,y),connectTimeout:G(S,L.connect),responseTimeout:G(S,h?L.read:L.write)},M=W=>{let Q={request:H,response:W,host:j,triesLeft:T.length};return q.push(Q),Q},N=await r.send(H);if(Re(N)){let W=M(N);return N.isTimedOut&&S++,m.info("Retryable failure",Y(W)),await u.set(j,J(j,N.isTimedOut?"timed out":"down")),F(T,G)}if(ve(N))return Ee(N);throw M(N),Se(N,q)},le=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),z=await a(le);return F([...z.hosts].reverse(),z.getTimeout)}function n(o,c={}){let h=o.useReadTransporter||o.method==="GET";if(!h)return s(o,c,h);let q=()=>s(o,c);if((c.cacheable||o.cacheable)!==!0)return q();let p={request:o,requestOptions:c,transporter:{queryParameters:g,headers:d}};return t.get(p,()=>e.get(p,()=>e.set(p,q()).then(f=>Promise.all([e.delete(p),f]),f=>Promise.all([e.delete(p),Promise.reject(f)])).then(([f,y])=>y)),{miss:f=>t.set(p,f)})}return {hostsCache:u,requester:r,timeouts:l,logger:m,algoliaAgent:w,baseHeaders:d,baseQueryParameters:g,hosts:i,request:n,requestsCache:e,responsesCache:t}}function D(){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 g=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0});},r),w=g(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=g(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 ee="5.6.0",Z=["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:g,...w}){let l=I(i,u,d),r=U({hosts:Ae(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Abtesting",version:ee}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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:s}={},n=void 0){let o="/2/abtests",c={},h={};e!==void 0&&(h.offset=e.toString()),t!==void 0&&(h.limit=t.toString()),a!==void 0&&(h.indexPrefix=a.toString()),s!==void 0&&(h.indexSuffix=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},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 re(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"||!Z.includes(d)))throw new Error(`\`region\` must be one of the following: ${Z.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ee}-${i}`}),E()]}),...m})}var ae="5.6.0",te=["de","us"];function Ie(i){return [{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Ie(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Analytics",version:ae}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickPositions({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getConversionRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoClickRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getRevenue({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let h="/2/searches/noClicks",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let h="/2/searches/noResults",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",s={},n={};e!==void 0&&(n.index=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let h="/2/countries",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:s,endDate:n,limit:o,offset:c,tags:h},q){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()),s!==void 0&&(f.startDate=s.toString()),n!==void 0&&(f.endDate=n.toString()),o!==void 0&&(f.limit=o.toString()),c!==void 0&&(f.offset=c.toString()),h!==void 0&&(f.tags=h.toString());let y={method:"GET",path:P,queryParameters:f,headers:p};return r.request(y,q)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:s,startDate:n,endDate:o,limit:c,offset:h,tags:q},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()),s!==void 0&&(y.revenueAnalytics=s.toString()),n!==void 0&&(y.startDate=n.toString()),o!==void 0&&(y.endDate=o.toString()),c!==void 0&&(y.limit=c.toString()),h!==void 0&&(y.offset=h.toString()),q!==void 0&&(y.tags=q.toString());let S={method:"GET",path:p,queryParameters:y,headers:f};return r.request(S,P)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:s,endDate:n,orderBy:o,direction:c,limit:h,offset:q,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()),s!==void 0&&(S.startDate=s.toString()),n!==void 0&&(S.endDate=n.toString()),o!==void 0&&(S.orderBy=o.toString()),c!==void 0&&(S.direction=c.toString()),h!==void 0&&(S.limit=h.toString()),q!==void 0&&(S.offset=q.toString()),P!==void 0&&(S.tags=P.toString());let F={method:"GET",path:f,queryParameters:S,headers:y};return r.request(F,p)},getUsersCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)}}}function se(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"||!te.includes(d)))throw new Error(`\`region\` must be one of the following: ${te.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ae}-${i}`}),E()]}),...m})}var oe="5.6.0",ne=["eu","us"];function Oe(i){return [{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Oe(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Personalization",version:oe}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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 n={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(n,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 ie(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"||!ne.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${ne.join(", ")}`);return Ue({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${oe}-${i}`}),E()]}),...m})}var $="5.6.0";function De(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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,...g}){let w=I(i,u,d),l=U({hosts:De(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Search",version:$}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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=n=>Math.min(n*200,5e3)},s){let n=0;return k({func:()=>this.getTask({indexName:r,taskID:e},s),validate:o=>o.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=t,message:()=>`The maximum number of retries exceeded. (${n}/${t})`},timeout:()=>a(n)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=s=>Math.min(s*200,5e3)},a){let s=0;return k({func:()=>this.getAppTask({taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=e,message:()=>`The maximum number of retries exceeded. (${s}/${e})`},timeout:()=>t(s)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:s=o=>Math.min(o*200,5e3)},n){let o=0,c={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>s(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return k({...c,func:()=>this.getApiKey({key:e},n),validate:h=>{for(let q of Object.keys(t)){let P=t[q],p=h[q];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 k({...c,func:()=>this.getApiKey({key:e},n).catch(h=>{if(h.status!==404)throw h}),validate:h=>r==="add"?h!==void 0:h===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return k({func:s=>this.browse({indexName:r,browseParams:{cursor:s?s.cursor:void 0,...e}},a),validate:s=>s.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let s={hitsPerPage:1e3,...e};return k({func:n=>this.searchRules({indexName:r,searchRulesParams:{...s,page:n?n.page+1:s.page||0}},a),validate:n=>n.nbHits<s.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let s={page:0,...e,hitsPerPage:1e3};return k({func:n=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,o},validate:n=>n.nbHits<s.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:s=1e3},n){let o=[],c=[],h=e.entries();for(let[q,P]of h)o.push({action:t,body:P}),(o.length===s||q===e.length-1)&&(c.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},n)),o=[]);if(a)for(let q of c)await this.waitForTask({indexName:r,taskID:q.taskID});return c},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 s=Math.floor(Math.random()*1e6)+1e5,n=`${r}_tmp_${s}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),c=await this.chunkedBatch({indexName:n,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:n,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:n,taskID:o.taskID});let h=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:n,taskID:h.taskID}),{copyOperationResponse:o,batchResponses:c,moveOperationResponse:h}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r});}catch(e){if(e instanceof _&&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 n={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(n,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 c={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(c,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 n={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(n,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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 n={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let n={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 n={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let n={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let n={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let n={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getDictionaryLanguages(r){let s={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(s,r)},getDictionarySettings(r){let s={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(s,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},s=void 0){let n="/1/logs",o={},c={};r!==void 0&&(c.offset=r.toString()),e!==void 0&&(c.length=e.toString()),t!==void 0&&(c.indexName=t.toString()),a!==void 0&&(c.type=a.toString());let h={method:"GET",path:n,queryParameters:c,headers:o};return l.request(h,s)},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 s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let c={method:"GET",path:s,queryParameters:o,headers:n};return l.request(c,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 n={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getSources(r){let s={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(s,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 s={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(s,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let n={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},s={};r!==void 0&&(s.getClusters=r.toString());let n={method:"GET",path:t,queryParameters:s,headers:a};return l.request(n,e)},listApiKeys(r){let s={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(s,r)},listClusters(r){let s={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(s,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};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 n={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(n,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},s){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 n="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.createIfNotExists=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let n={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let n={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(n,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let n={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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},s){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 n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},s){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 n="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.clearExistingRules=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},s){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 n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},s){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 n="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.replaceExistingSynonyms=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:c,...h})=>h.type==="facet"?{...h,...c,type:"facet"}:{...h,...c,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 n={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,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 n={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(n,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 s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"PUT",path:s,queryParameters:o,headers:n,data:e};return l.request(c,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 ce(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:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${$}-${i}`}),E()]}),...d})}var ue="5.6.0";function ke(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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 je({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...g}){let w=I(i,u,d),l=U({hosts:ke(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Recommend",version:ue}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,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 c={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(c,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 c={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(c,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 c={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(c,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 n={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,a)}}}function he(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 je({appId:i,apiKey:u,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ue}-${i}`}),E()]}),...d})}function Tr(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=ce(i,u,d);return {...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(g={})=>he(g.appId||i,g.apiKey||u,g.options),initAnalytics:(g={})=>se(g.appId||i,g.apiKey||u,g.region,g.options),initAbtesting:(g={})=>re(g.appId||i,g.apiKey||u,g.region,g.options),initPersonalization:g=>ie(g.appId||i,g.apiKey||u,g.region,g.options)}}
function v(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function g(){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=g(),t=Object.fromEntries(Object.entries(e).filter(([,s])=>s.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,s])=>{let n=new Date().getTime();return !(s.timestamp+r<n)}));w(a);}return {get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),g()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,s])=>Promise.all([a,s||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=g();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=g();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{m().removeItem(d);})}}}function de(){return {get(i,u,d={miss:()=>Promise.resolve()}){return u().then(g=>Promise.all([g,d.miss(g)])).then(([g])=>g)},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?de():{get(m,g,w={miss:()=>Promise.resolve()}){return d.get(m,g,w).catch(()=>R({caches:u}).get(m,g,w))},set(m,g){return d.set(m,g).catch(()=>R({caches:u}).set(m,g))},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,g={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=>g.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 C=1e3,A=2e3,b=3e4;function me(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 I(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 k({func:i,validate:u,aggregator:d,error:m,timeout:g=()=>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);},g()))).catch(t=>{e(t);});});return w()}function x({algoliaAgents:i,client:u,version:d}){let m=me(d).add({segment:u,version:d});return i.forEach(g=>m.add(g)),m}function O(){return {debug(i,u){return Promise.resolve()},info(i,u){return Promise.resolve()},error(i,u){return Promise.resolve()}}}var K=2*60*1e3;function J(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>K}function g(){return u==="timed out"&&Date.now()-d<=K}return {...i,status:u,lastUpdate:d,isUp:m,isTimedOut:g}}var V=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u);}},X=class extends V{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u;}},ge=class extends X{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");}},_=class extends X{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u;}},qe=class extends V{response;constructor(i,u){super(i,"DeserializationError"),this.response=u;}},Pe=class extends _{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d;}};function B(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),g=i[d];u[d]=i[m],u[m]=g;}return u}function pe(i,u,d){let m=we(d),g=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(g+=`?${m}`),g}function we(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 fe(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 ye(i,u,d){let m={Accept:"application/json",...i,...u,...d},g={};return Object.keys(m).forEach(w=>{let l=m[w];g[w.toLowerCase()]=l;}),g}function Ee(i){try{return JSON.parse(i.content)}catch(u){throw new qe(u.message,i)}}function Se({content:i,status:u},d){try{let m=JSON.parse(i);return "error"in m?new Pe(m.message,u,m.error,d):new _(m.message,u,d)}catch{}return new _(i,u,d)}function Te({isTimedOut:i,status:u}){return !i&&~~u===0}function Re({isTimedOut:i,status:u}){return i||Te({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function ve({status:i}){return ~~(i/100)===2}function Ce(i){return i.map(u=>Y(u))}function Y(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 U({hosts:i,hostsCache:u,baseHeaders:d,logger:m,baseQueryParameters:g,algoliaAgent:w,timeouts:l,requester:r,requestsCache:e,responsesCache:t}){async function a(o){let c=await Promise.all(o.map(f=>u.get(f,()=>Promise.resolve(J(f))))),h=c.filter(f=>f.isUp()),q=c.filter(f=>f.isTimedOut()),P=[...h,...q];return {hosts:P.length>0?P:o,getTimeout(f,y){return (q.length===0&&f===0?1:q.length+3+f)*y}}}async function s(o,c,h=!0){let q=[],P=fe(o,c),p=ye(d,o.headers,c.headers),f=o.method==="GET"?{...o.data,...c.data}:{},y={...g,...o.queryParameters,...f};if(w.value&&(y["x-algolia-agent"]=w.value),c&&c.queryParameters)for(let T of Object.keys(c.queryParameters))!c.queryParameters[T]||Object.prototype.toString.call(c.queryParameters[T])==="[object Object]"?y[T]=c.queryParameters[T]:y[T]=c.queryParameters[T].toString();let S=0,F=async(T,G)=>{let j=T.pop();if(j===void 0)throw new ge(Ce(q));let L={...l,...c.timeouts},H={data:P,headers:p,method:o.method,url:pe(j,o.path,y),connectTimeout:G(S,L.connect),responseTimeout:G(S,h?L.read:L.write)},M=W=>{let Q={request:H,response:W,host:j,triesLeft:T.length};return q.push(Q),Q},N=await r.send(H);if(Re(N)){let W=M(N);return N.isTimedOut&&S++,m.info("Retryable failure",Y(W)),await u.set(j,J(j,N.isTimedOut?"timed out":"down")),F(T,G)}if(ve(N))return Ee(N);throw M(N),Se(N,q)},le=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),z=await a(le);return F([...z.hosts].reverse(),z.getTimeout)}function n(o,c={}){let h=o.useReadTransporter||o.method==="GET";if(!h)return s(o,c,h);let q=()=>s(o,c);if((c.cacheable||o.cacheable)!==!0)return q();let p={request:o,requestOptions:c,transporter:{queryParameters:g,headers:d}};return t.get(p,()=>e.get(p,()=>e.set(p,q()).then(f=>Promise.all([e.delete(p),f]),f=>Promise.all([e.delete(p),Promise.reject(f)])).then(([f,y])=>y)),{miss:f=>t.set(p,f)})}return {hostsCache:u,requester:r,timeouts:l,logger:m,algoliaAgent:w,baseHeaders:d,baseQueryParameters:g,hosts:i,request:n,requestsCache:e,responsesCache:t}}function D(){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 g=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0});},r),w=g(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=g(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 ee="5.6.1",Z=["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:g,...w}){let l=I(i,u,d),r=U({hosts:Ae(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Abtesting",version:ee}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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:s}={},n=void 0){let o="/2/abtests",c={},h={};e!==void 0&&(h.offset=e.toString()),t!==void 0&&(h.limit=t.toString()),a!==void 0&&(h.indexPrefix=a.toString()),s!==void 0&&(h.indexSuffix=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},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 re(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"||!Z.includes(d)))throw new Error(`\`region\` must be one of the following: ${Z.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ee}-${i}`}),E()]}),...m})}var ae="5.6.1",te=["de","us"];function Ie(i){return [{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Ie(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Analytics",version:ae}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickPositions({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getConversionRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoClickRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getRevenue({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let h="/2/searches/noClicks",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let h="/2/searches/noResults",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",s={},n={};e!==void 0&&(n.index=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let h="/2/countries",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:s,endDate:n,limit:o,offset:c,tags:h},q){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()),s!==void 0&&(f.startDate=s.toString()),n!==void 0&&(f.endDate=n.toString()),o!==void 0&&(f.limit=o.toString()),c!==void 0&&(f.offset=c.toString()),h!==void 0&&(f.tags=h.toString());let y={method:"GET",path:P,queryParameters:f,headers:p};return r.request(y,q)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:s,startDate:n,endDate:o,limit:c,offset:h,tags:q},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()),s!==void 0&&(y.revenueAnalytics=s.toString()),n!==void 0&&(y.startDate=n.toString()),o!==void 0&&(y.endDate=o.toString()),c!==void 0&&(y.limit=c.toString()),h!==void 0&&(y.offset=h.toString()),q!==void 0&&(y.tags=q.toString());let S={method:"GET",path:p,queryParameters:y,headers:f};return r.request(S,P)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:s,endDate:n,orderBy:o,direction:c,limit:h,offset:q,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()),s!==void 0&&(S.startDate=s.toString()),n!==void 0&&(S.endDate=n.toString()),o!==void 0&&(S.orderBy=o.toString()),c!==void 0&&(S.direction=c.toString()),h!==void 0&&(S.limit=h.toString()),q!==void 0&&(S.offset=q.toString()),P!==void 0&&(S.tags=P.toString());let F={method:"GET",path:f,queryParameters:S,headers:y};return r.request(F,p)},getUsersCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)}}}function se(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"||!te.includes(d)))throw new Error(`\`region\` must be one of the following: ${te.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ae}-${i}`}),E()]}),...m})}var oe="5.6.1",ne=["eu","us"];function Oe(i){return [{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Oe(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Personalization",version:oe}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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 n={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(n,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 ie(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"||!ne.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${ne.join(", ")}`);return Ue({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${oe}-${i}`}),E()]}),...m})}var $="5.6.1";function De(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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,...g}){let w=I(i,u,d),l=U({hosts:De(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Search",version:$}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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=n=>Math.min(n*200,5e3)},s){let n=0;return k({func:()=>this.getTask({indexName:r,taskID:e},s),validate:o=>o.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=t,message:()=>`The maximum number of retries exceeded. (${n}/${t})`},timeout:()=>a(n)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=s=>Math.min(s*200,5e3)},a){let s=0;return k({func:()=>this.getAppTask({taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=e,message:()=>`The maximum number of retries exceeded. (${s}/${e})`},timeout:()=>t(s)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:s=o=>Math.min(o*200,5e3)},n){let o=0,c={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>s(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return k({...c,func:()=>this.getApiKey({key:e},n),validate:h=>{for(let q of Object.keys(t)){let P=t[q],p=h[q];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 k({...c,func:()=>this.getApiKey({key:e},n).catch(h=>{if(h.status!==404)throw h}),validate:h=>r==="add"?h!==void 0:h===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return k({func:s=>this.browse({indexName:r,browseParams:{cursor:s?s.cursor:void 0,...e}},a),validate:s=>s.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let s={hitsPerPage:1e3,...e};return k({func:n=>this.searchRules({indexName:r,searchRulesParams:{...s,page:n?n.page+1:s.page||0}},a),validate:n=>n.nbHits<s.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let s={page:0,...e,hitsPerPage:1e3};return k({func:n=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,o},validate:n=>n.nbHits<s.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:s=1e3},n){let o=[],c=[],h=e.entries();for(let[q,P]of h)o.push({action:t,body:P}),(o.length===s||q===e.length-1)&&(c.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},n)),o=[]);if(a)for(let q of c)await this.waitForTask({indexName:r,taskID:q.taskID});return c},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 s=Math.floor(Math.random()*1e6)+1e5,n=`${r}_tmp_${s}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),c=await this.chunkedBatch({indexName:n,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:n,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:n,taskID:o.taskID});let h=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:n,taskID:h.taskID}),{copyOperationResponse:o,batchResponses:c,moveOperationResponse:h}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r});}catch(e){if(e instanceof _&&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 n={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(n,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 c={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(c,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 n={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(n,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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 n={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let n={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 n={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let n={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let n={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let n={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getDictionaryLanguages(r){let s={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(s,r)},getDictionarySettings(r){let s={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(s,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},s=void 0){let n="/1/logs",o={},c={};r!==void 0&&(c.offset=r.toString()),e!==void 0&&(c.length=e.toString()),t!==void 0&&(c.indexName=t.toString()),a!==void 0&&(c.type=a.toString());let h={method:"GET",path:n,queryParameters:c,headers:o};return l.request(h,s)},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 s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let c={method:"GET",path:s,queryParameters:o,headers:n};return l.request(c,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 n={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getSources(r){let s={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(s,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 s={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(s,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let n={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},s={};r!==void 0&&(s.getClusters=r.toString());let n={method:"GET",path:t,queryParameters:s,headers:a};return l.request(n,e)},listApiKeys(r){let s={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(s,r)},listClusters(r){let s={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(s,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};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 n={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(n,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},s){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 n="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.createIfNotExists=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let n={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let n={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(n,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let n={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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},s){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 n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},s){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 n="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.clearExistingRules=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},s){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 n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},s){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 n="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.replaceExistingSynonyms=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:c,...h})=>h.type==="facet"?{...h,...c,type:"facet"}:{...h,...c,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 n={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,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 n={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(n,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 s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"PUT",path:s,queryParameters:o,headers:n,data:e};return l.request(c,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 ce(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:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${$}-${i}`}),E()]}),...d})}var ue="5.6.1";function ke(i){return [{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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 je({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...g}){let w=I(i,u,d),l=U({hosts:ke(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Recommend",version:ue}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,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 c={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(c,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 c={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(c,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 c={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(c,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 n={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,a)}}}function he(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 je({appId:i,apiKey:u,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ue}-${i}`}),E()]}),...d})}function Tr(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=ce(i,u,d);return {...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(g={})=>he(g.appId||i,g.apiKey||u,g.options),initAnalytics:(g={})=>se(g.appId||i,g.apiKey||u,g.region,g.options),initAbtesting:(g={})=>re(g.appId||i,g.apiKey||u,g.region,g.options),initPersonalization:g=>ie(g.appId||i,g.apiKey||u,g.region,g.options)}}

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

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

function v(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function g(){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=g(),t=Object.fromEntries(Object.entries(e).filter(([,s])=>s.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,s])=>{let n=new Date().getTime();return!(s.timestamp+r<n)}));w(a)}return{get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),g()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,s])=>Promise.all([a,s||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=g();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=g();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e))})},clear(){return Promise.resolve().then(()=>{m().removeItem(d)})}}}function de(){return{get(i,u,d={miss:()=>Promise.resolve()}){return u().then(g=>Promise.all([g,d.miss(g)])).then(([g])=>g)},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?de():{get(m,g,w={miss:()=>Promise.resolve()}){return d.get(m,g,w).catch(()=>R({caches:u}).get(m,g,w))},set(m,g){return d.set(m,g).catch(()=>R({caches:u}).set(m,g))},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,g={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=>g.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 C=1e3,A=2e3,b=3e4;function me(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 I(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 k({func:i,validate:u,aggregator:d,error:m,timeout:g=()=>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)},g()))).catch(t=>{e(t)})});return w()}function x({algoliaAgents:i,client:u,version:d}){let m=me(d).add({segment:u,version:d});return i.forEach(g=>m.add(g)),m}function O(){return{debug(i,u){return Promise.resolve()},info(i,u){return Promise.resolve()},error(i,u){return Promise.resolve()}}}var K=2*60*1e3;function J(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>K}function g(){return u==="timed out"&&Date.now()-d<=K}return{...i,status:u,lastUpdate:d,isUp:m,isTimedOut:g}}var V=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u)}},X=class extends V{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u}},ge=class extends X{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")}},_=class extends X{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u}},qe=class extends V{response;constructor(i,u){super(i,"DeserializationError"),this.response=u}},Pe=class extends _{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d}};function B(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),g=i[d];u[d]=i[m],u[m]=g}return u}function pe(i,u,d){let m=we(d),g=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(g+=`?${m}`),g}function we(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 fe(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 ye(i,u,d){let m={Accept:"application/json",...i,...u,...d},g={};return Object.keys(m).forEach(w=>{let l=m[w];g[w.toLowerCase()]=l}),g}function Ee(i){try{return JSON.parse(i.content)}catch(u){throw new qe(u.message,i)}}function Se({content:i,status:u},d){try{let m=JSON.parse(i);return"error"in m?new Pe(m.message,u,m.error,d):new _(m.message,u,d)}catch{}return new _(i,u,d)}function Te({isTimedOut:i,status:u}){return!i&&~~u===0}function Re({isTimedOut:i,status:u}){return i||Te({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function ve({status:i}){return~~(i/100)===2}function Ce(i){return i.map(u=>Y(u))}function Y(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 U({hosts:i,hostsCache:u,baseHeaders:d,logger:m,baseQueryParameters:g,algoliaAgent:w,timeouts:l,requester:r,requestsCache:e,responsesCache:t}){async function a(o){let c=await Promise.all(o.map(f=>u.get(f,()=>Promise.resolve(J(f))))),h=c.filter(f=>f.isUp()),q=c.filter(f=>f.isTimedOut()),P=[...h,...q];return{hosts:P.length>0?P:o,getTimeout(f,y){return(q.length===0&&f===0?1:q.length+3+f)*y}}}async function s(o,c,h=!0){let q=[],P=fe(o,c),p=ye(d,o.headers,c.headers),f=o.method==="GET"?{...o.data,...c.data}:{},y={...g,...o.queryParameters,...f};if(w.value&&(y["x-algolia-agent"]=w.value),c&&c.queryParameters)for(let T of Object.keys(c.queryParameters))!c.queryParameters[T]||Object.prototype.toString.call(c.queryParameters[T])==="[object Object]"?y[T]=c.queryParameters[T]:y[T]=c.queryParameters[T].toString();let S=0,F=async(T,G)=>{let j=T.pop();if(j===void 0)throw new ge(Ce(q));let L={...l,...c.timeouts},H={data:P,headers:p,method:o.method,url:pe(j,o.path,y),connectTimeout:G(S,L.connect),responseTimeout:G(S,h?L.read:L.write)},M=W=>{let Q={request:H,response:W,host:j,triesLeft:T.length};return q.push(Q),Q},N=await r.send(H);if(Re(N)){let W=M(N);return N.isTimedOut&&S++,m.info("Retryable failure",Y(W)),await u.set(j,J(j,N.isTimedOut?"timed out":"down")),F(T,G)}if(ve(N))return Ee(N);throw M(N),Se(N,q)},le=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),z=await a(le);return F([...z.hosts].reverse(),z.getTimeout)}function n(o,c={}){let h=o.useReadTransporter||o.method==="GET";if(!h)return s(o,c,h);let q=()=>s(o,c);if((c.cacheable||o.cacheable)!==!0)return q();let p={request:o,requestOptions:c,transporter:{queryParameters:g,headers:d}};return t.get(p,()=>e.get(p,()=>e.set(p,q()).then(f=>Promise.all([e.delete(p),f]),f=>Promise.all([e.delete(p),Promise.reject(f)])).then(([f,y])=>y)),{miss:f=>t.set(p,f)})}return{hostsCache:u,requester:r,timeouts:l,logger:m,algoliaAgent:w,baseHeaders:d,baseQueryParameters:g,hosts:i,request:n,requestsCache:e,responsesCache:t}}function D(){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 g=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0})},r),w=g(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=g(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 ee="5.6.0",Z=["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:g,...w}){let l=I(i,u,d),r=U({hosts:Ae(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Abtesting",version:ee}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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:s}={},n=void 0){let o="/2/abtests",c={},h={};e!==void 0&&(h.offset=e.toString()),t!==void 0&&(h.limit=t.toString()),a!==void 0&&(h.indexPrefix=a.toString()),s!==void 0&&(h.indexSuffix=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},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 re(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"||!Z.includes(d)))throw new Error(`\`region\` must be one of the following: ${Z.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ee}-${i}`}),E()]}),...m})}var ae="5.6.0",te=["de","us"];function Ie(i){return[{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Ie(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Analytics",version:ae}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickPositions({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getConversionRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoClickRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getRevenue({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let h="/2/searches/noClicks",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let h="/2/searches/noResults",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",s={},n={};e!==void 0&&(n.index=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let h="/2/countries",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:s,endDate:n,limit:o,offset:c,tags:h},q){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()),s!==void 0&&(f.startDate=s.toString()),n!==void 0&&(f.endDate=n.toString()),o!==void 0&&(f.limit=o.toString()),c!==void 0&&(f.offset=c.toString()),h!==void 0&&(f.tags=h.toString());let y={method:"GET",path:P,queryParameters:f,headers:p};return r.request(y,q)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:s,startDate:n,endDate:o,limit:c,offset:h,tags:q},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()),s!==void 0&&(y.revenueAnalytics=s.toString()),n!==void 0&&(y.startDate=n.toString()),o!==void 0&&(y.endDate=o.toString()),c!==void 0&&(y.limit=c.toString()),h!==void 0&&(y.offset=h.toString()),q!==void 0&&(y.tags=q.toString());let S={method:"GET",path:p,queryParameters:y,headers:f};return r.request(S,P)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:s,endDate:n,orderBy:o,direction:c,limit:h,offset:q,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()),s!==void 0&&(S.startDate=s.toString()),n!==void 0&&(S.endDate=n.toString()),o!==void 0&&(S.orderBy=o.toString()),c!==void 0&&(S.direction=c.toString()),h!==void 0&&(S.limit=h.toString()),q!==void 0&&(S.offset=q.toString()),P!==void 0&&(S.tags=P.toString());let F={method:"GET",path:f,queryParameters:S,headers:y};return r.request(F,p)},getUsersCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)}}}function se(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"||!te.includes(d)))throw new Error(`\`region\` must be one of the following: ${te.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ae}-${i}`}),E()]}),...m})}var oe="5.6.0",ne=["eu","us"];function Oe(i){return[{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Oe(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Personalization",version:oe}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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 n={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(n,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 ie(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"||!ne.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${ne.join(", ")}`);return Ue({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${oe}-${i}`}),E()]}),...m})}var $="5.6.0";function De(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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,...g}){let w=I(i,u,d),l=U({hosts:De(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Search",version:$}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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=n=>Math.min(n*200,5e3)},s){let n=0;return k({func:()=>this.getTask({indexName:r,taskID:e},s),validate:o=>o.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=t,message:()=>`The maximum number of retries exceeded. (${n}/${t})`},timeout:()=>a(n)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=s=>Math.min(s*200,5e3)},a){let s=0;return k({func:()=>this.getAppTask({taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=e,message:()=>`The maximum number of retries exceeded. (${s}/${e})`},timeout:()=>t(s)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:s=o=>Math.min(o*200,5e3)},n){let o=0,c={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>s(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return k({...c,func:()=>this.getApiKey({key:e},n),validate:h=>{for(let q of Object.keys(t)){let P=t[q],p=h[q];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 k({...c,func:()=>this.getApiKey({key:e},n).catch(h=>{if(h.status!==404)throw h}),validate:h=>r==="add"?h!==void 0:h===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return k({func:s=>this.browse({indexName:r,browseParams:{cursor:s?s.cursor:void 0,...e}},a),validate:s=>s.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let s={hitsPerPage:1e3,...e};return k({func:n=>this.searchRules({indexName:r,searchRulesParams:{...s,page:n?n.page+1:s.page||0}},a),validate:n=>n.nbHits<s.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let s={page:0,...e,hitsPerPage:1e3};return k({func:n=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,o},validate:n=>n.nbHits<s.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:s=1e3},n){let o=[],c=[],h=e.entries();for(let[q,P]of h)o.push({action:t,body:P}),(o.length===s||q===e.length-1)&&(c.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},n)),o=[]);if(a)for(let q of c)await this.waitForTask({indexName:r,taskID:q.taskID});return c},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 s=Math.floor(Math.random()*1e6)+1e5,n=`${r}_tmp_${s}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),c=await this.chunkedBatch({indexName:n,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:n,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:n,taskID:o.taskID});let h=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:n,taskID:h.taskID}),{copyOperationResponse:o,batchResponses:c,moveOperationResponse:h}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r})}catch(e){if(e instanceof _&&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 n={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(n,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 c={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(c,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 n={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(n,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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 n={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let n={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 n={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let n={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let n={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let n={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getDictionaryLanguages(r){let s={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(s,r)},getDictionarySettings(r){let s={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(s,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},s=void 0){let n="/1/logs",o={},c={};r!==void 0&&(c.offset=r.toString()),e!==void 0&&(c.length=e.toString()),t!==void 0&&(c.indexName=t.toString()),a!==void 0&&(c.type=a.toString());let h={method:"GET",path:n,queryParameters:c,headers:o};return l.request(h,s)},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 s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let c={method:"GET",path:s,queryParameters:o,headers:n};return l.request(c,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 n={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getSources(r){let s={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(s,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 s={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(s,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let n={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},s={};r!==void 0&&(s.getClusters=r.toString());let n={method:"GET",path:t,queryParameters:s,headers:a};return l.request(n,e)},listApiKeys(r){let s={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(s,r)},listClusters(r){let s={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(s,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};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 n={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(n,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},s){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 n="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.createIfNotExists=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let n={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let n={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(n,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let n={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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},s){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 n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},s){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 n="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.clearExistingRules=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},s){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 n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},s){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 n="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.replaceExistingSynonyms=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:c,...h})=>h.type==="facet"?{...h,...c,type:"facet"}:{...h,...c,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 n={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,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 n={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(n,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 s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"PUT",path:s,queryParameters:o,headers:n,data:e};return l.request(c,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 ce(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:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${$}-${i}`}),E()]}),...d})}var ue="5.6.0";function ke(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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 je({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...g}){let w=I(i,u,d),l=U({hosts:ke(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Recommend",version:ue}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,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 c={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(c,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 c={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(c,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 c={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(c,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 n={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,a)}}}function he(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 je({appId:i,apiKey:u,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ue}-${i}`}),E()]}),...d})}function Tr(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=ce(i,u,d);return{...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(g={})=>he(g.appId||i,g.apiKey||u,g.options),initAnalytics:(g={})=>se(g.appId||i,g.apiKey||u,g.region,g.options),initAbtesting:(g={})=>re(g.appId||i,g.apiKey||u,g.region,g.options),initPersonalization:g=>ie(g.appId||i,g.apiKey||u,g.region,g.options)}}export{re as abtestingClient,Tr as algoliasearch,se as analyticsClient,$ as apiClientVersion,ie as personalizationClient,he as recommendClient,ce as searchClient};
function v(i){let u,d=`algolia-client-js-${i.key}`;function m(){return u===void 0&&(u=i.localStorage||window.localStorage),u}function g(){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=g(),t=Object.fromEntries(Object.entries(e).filter(([,s])=>s.timestamp!==void 0));if(w(t),!r)return;let a=Object.fromEntries(Object.entries(t).filter(([,s])=>{let n=new Date().getTime();return!(s.timestamp+r<n)}));w(a)}return{get(r,e,t={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(l(),g()[JSON.stringify(r)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,s])=>Promise.all([a,s||t.miss(a)])).then(([a])=>a)},set(r,e){return Promise.resolve().then(()=>{let t=g();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=g();delete e[JSON.stringify(r)],m().setItem(d,JSON.stringify(e))})},clear(){return Promise.resolve().then(()=>{m().removeItem(d)})}}}function de(){return{get(i,u,d={miss:()=>Promise.resolve()}){return u().then(g=>Promise.all([g,d.miss(g)])).then(([g])=>g)},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?de():{get(m,g,w={miss:()=>Promise.resolve()}){return d.get(m,g,w).catch(()=>R({caches:u}).get(m,g,w))},set(m,g){return d.set(m,g).catch(()=>R({caches:u}).set(m,g))},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,g={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=>g.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 C=1e3,A=2e3,b=3e4;function me(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 I(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 k({func:i,validate:u,aggregator:d,error:m,timeout:g=()=>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)},g()))).catch(t=>{e(t)})});return w()}function x({algoliaAgents:i,client:u,version:d}){let m=me(d).add({segment:u,version:d});return i.forEach(g=>m.add(g)),m}function O(){return{debug(i,u){return Promise.resolve()},info(i,u){return Promise.resolve()},error(i,u){return Promise.resolve()}}}var K=2*60*1e3;function J(i,u="up"){let d=Date.now();function m(){return u==="up"||Date.now()-d>K}function g(){return u==="timed out"&&Date.now()-d<=K}return{...i,status:u,lastUpdate:d,isUp:m,isTimedOut:g}}var V=class extends Error{name="AlgoliaError";constructor(i,u){super(i),u&&(this.name=u)}},X=class extends V{stackTrace;constructor(i,u,d){super(i,d),this.stackTrace=u}},ge=class extends X{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")}},_=class extends X{status;constructor(i,u,d,m="ApiError"){super(i,d,m),this.status=u}},qe=class extends V{response;constructor(i,u){super(i,"DeserializationError"),this.response=u}},Pe=class extends _{error;constructor(i,u,d,m){super(i,u,m,"DetailedApiError"),this.error=d}};function B(i){let u=i;for(let d=i.length-1;d>0;d--){let m=Math.floor(Math.random()*(d+1)),g=i[d];u[d]=i[m],u[m]=g}return u}function pe(i,u,d){let m=we(d),g=`${i.protocol}://${i.url}${i.port?`:${i.port}`:""}/${u.charAt(0)==="/"?u.substring(1):u}`;return m.length&&(g+=`?${m}`),g}function we(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 fe(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 ye(i,u,d){let m={Accept:"application/json",...i,...u,...d},g={};return Object.keys(m).forEach(w=>{let l=m[w];g[w.toLowerCase()]=l}),g}function Ee(i){try{return JSON.parse(i.content)}catch(u){throw new qe(u.message,i)}}function Se({content:i,status:u},d){try{let m=JSON.parse(i);return"error"in m?new Pe(m.message,u,m.error,d):new _(m.message,u,d)}catch{}return new _(i,u,d)}function Te({isTimedOut:i,status:u}){return!i&&~~u===0}function Re({isTimedOut:i,status:u}){return i||Te({isTimedOut:i,status:u})||~~(u/100)!==2&&~~(u/100)!==4}function ve({status:i}){return~~(i/100)===2}function Ce(i){return i.map(u=>Y(u))}function Y(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 U({hosts:i,hostsCache:u,baseHeaders:d,logger:m,baseQueryParameters:g,algoliaAgent:w,timeouts:l,requester:r,requestsCache:e,responsesCache:t}){async function a(o){let c=await Promise.all(o.map(f=>u.get(f,()=>Promise.resolve(J(f))))),h=c.filter(f=>f.isUp()),q=c.filter(f=>f.isTimedOut()),P=[...h,...q];return{hosts:P.length>0?P:o,getTimeout(f,y){return(q.length===0&&f===0?1:q.length+3+f)*y}}}async function s(o,c,h=!0){let q=[],P=fe(o,c),p=ye(d,o.headers,c.headers),f=o.method==="GET"?{...o.data,...c.data}:{},y={...g,...o.queryParameters,...f};if(w.value&&(y["x-algolia-agent"]=w.value),c&&c.queryParameters)for(let T of Object.keys(c.queryParameters))!c.queryParameters[T]||Object.prototype.toString.call(c.queryParameters[T])==="[object Object]"?y[T]=c.queryParameters[T]:y[T]=c.queryParameters[T].toString();let S=0,F=async(T,G)=>{let j=T.pop();if(j===void 0)throw new ge(Ce(q));let L={...l,...c.timeouts},H={data:P,headers:p,method:o.method,url:pe(j,o.path,y),connectTimeout:G(S,L.connect),responseTimeout:G(S,h?L.read:L.write)},M=W=>{let Q={request:H,response:W,host:j,triesLeft:T.length};return q.push(Q),Q},N=await r.send(H);if(Re(N)){let W=M(N);return N.isTimedOut&&S++,m.info("Retryable failure",Y(W)),await u.set(j,J(j,N.isTimedOut?"timed out":"down")),F(T,G)}if(ve(N))return Ee(N);throw M(N),Se(N,q)},le=i.filter(T=>T.accept==="readWrite"||(h?T.accept==="read":T.accept==="write")),z=await a(le);return F([...z.hosts].reverse(),z.getTimeout)}function n(o,c={}){let h=o.useReadTransporter||o.method==="GET";if(!h)return s(o,c,h);let q=()=>s(o,c);if((c.cacheable||o.cacheable)!==!0)return q();let p={request:o,requestOptions:c,transporter:{queryParameters:g,headers:d}};return t.get(p,()=>e.get(p,()=>e.set(p,q()).then(f=>Promise.all([e.delete(p),f]),f=>Promise.all([e.delete(p),Promise.reject(f)])).then(([f,y])=>y)),{miss:f=>t.set(p,f)})}return{hostsCache:u,requester:r,timeouts:l,logger:m,algoliaAgent:w,baseHeaders:d,baseQueryParameters:g,hosts:i,request:n,requestsCache:e,responsesCache:t}}function D(){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 g=(r,e)=>setTimeout(()=>{m.abort(),d({status:0,content:e,isTimedOut:!0})},r),w=g(u.connectTimeout,"Connection timeout"),l;m.onreadystatechange=()=>{m.readyState>m.OPENED&&l===void 0&&(clearTimeout(w),l=g(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 ee="5.6.1",Z=["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:g,...w}){let l=I(i,u,d),r=U({hosts:Ae(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Abtesting",version:ee}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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:s}={},n=void 0){let o="/2/abtests",c={},h={};e!==void 0&&(h.offset=e.toString()),t!==void 0&&(h.limit=t.toString()),a!==void 0&&(h.indexPrefix=a.toString()),s!==void 0&&(h.indexSuffix=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},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 re(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"||!Z.includes(d)))throw new Error(`\`region\` must be one of the following: ${Z.join(", ")}`);return be({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ee}-${i}`}),E()]}),...m})}var ae="5.6.1",te=["de","us"];function Ie(i){return[{url:i?"analytics.{region}.algolia.com".replace("{region}",i):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function xe({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Ie(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Analytics",version:ae}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},getAddToCartRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let o="/2/conversions/addToCartRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getAverageClickPosition({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let o="/2/clicks/averageClickPosition",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickPositions({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let o="/2/clicks/positions",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getClickThroughRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let o="/2/clicks/clickThroughRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getConversionRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let o="/2/conversions/conversionRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoClickRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let o="/2/searches/noClickRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getNoResultsRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let o="/2/searches/noResultRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getPurchaseRate({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let o="/2/conversions/purchaseRate",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getRevenue({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let o="/2/conversions/revenue",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let o="/2/searches/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)},getSearchesNoClicks({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let h="/2/searches/noClicks",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getSearchesNoResults({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let h="/2/searches/noResults",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getStatus({index:e},t){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",s={},n={};e!==void 0&&(n.index=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return r.request(o,t)},getTopCountries({index:e,startDate:t,endDate:a,limit:s,offset:n,tags:o},c){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let h="/2/countries",q={},P={};e!==void 0&&(P.index=e.toString()),t!==void 0&&(P.startDate=t.toString()),a!==void 0&&(P.endDate=a.toString()),s!==void 0&&(P.limit=s.toString()),n!==void 0&&(P.offset=n.toString()),o!==void 0&&(P.tags=o.toString());let p={method:"GET",path:h,queryParameters:P,headers:q};return r.request(p,c)},getTopFilterAttributes({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopFilterForAttribute({attribute:e,index:t,search:a,startDate:s,endDate:n,limit:o,offset:c,tags:h},q){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()),s!==void 0&&(f.startDate=s.toString()),n!==void 0&&(f.endDate=n.toString()),o!==void 0&&(f.limit=o.toString()),c!==void 0&&(f.offset=c.toString()),h!==void 0&&(f.tags=h.toString());let y={method:"GET",path:P,queryParameters:f,headers:p};return r.request(y,q)},getTopFiltersNoResults({index:e,search:t,startDate:a,endDate:s,limit:n,offset:o,tags:c},h){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let q="/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()),s!==void 0&&(p.endDate=s.toString()),n!==void 0&&(p.limit=n.toString()),o!==void 0&&(p.offset=o.toString()),c!==void 0&&(p.tags=c.toString());let f={method:"GET",path:q,queryParameters:p,headers:P};return r.request(f,h)},getTopHits({index:e,search:t,clickAnalytics:a,revenueAnalytics:s,startDate:n,endDate:o,limit:c,offset:h,tags:q},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()),s!==void 0&&(y.revenueAnalytics=s.toString()),n!==void 0&&(y.startDate=n.toString()),o!==void 0&&(y.endDate=o.toString()),c!==void 0&&(y.limit=c.toString()),h!==void 0&&(y.offset=h.toString()),q!==void 0&&(y.tags=q.toString());let S={method:"GET",path:p,queryParameters:y,headers:f};return r.request(S,P)},getTopSearches({index:e,clickAnalytics:t,revenueAnalytics:a,startDate:s,endDate:n,orderBy:o,direction:c,limit:h,offset:q,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()),s!==void 0&&(S.startDate=s.toString()),n!==void 0&&(S.endDate=n.toString()),o!==void 0&&(S.orderBy=o.toString()),c!==void 0&&(S.direction=c.toString()),h!==void 0&&(S.limit=h.toString()),q!==void 0&&(S.offset=q.toString()),P!==void 0&&(S.tags=P.toString());let F={method:"GET",path:f,queryParameters:S,headers:y};return r.request(F,p)},getUsersCount({index:e,startDate:t,endDate:a,tags:s},n){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let o="/2/users/count",c={},h={};e!==void 0&&(h.index=e.toString()),t!==void 0&&(h.startDate=t.toString()),a!==void 0&&(h.endDate=a.toString()),s!==void 0&&(h.tags=s.toString());let q={method:"GET",path:o,queryParameters:h,headers:c};return r.request(q,n)}}}function se(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"||!te.includes(d)))throw new Error(`\`region\` must be one of the following: ${te.join(", ")}`);return xe({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ae}-${i}`}),E()]}),...m})}var oe="5.6.1",ne=["eu","us"];function Oe(i){return[{url:"personalization.{region}.algolia.com".replace("{region}",i),accept:"readWrite",protocol:"https"}]}function Ue({appId:i,apiKey:u,authMode:d,algoliaAgents:m,region:g,...w}){let l=I(i,u,d),r=U({hosts:Oe(g),...w,algoliaAgent:x({algoliaAgents:m,client:"Personalization",version:oe}),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 c={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customGet({path:e,parameters:t},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let c={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return r.request(c,a)},customPost({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},customPut({path:e,parameters:t,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:a||{}};return r.request(h,s)},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 n={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(n,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 ie(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"||!ne.includes(d)))throw new Error(`\`region\` is required and must be one of the following: ${ne.join(", ")}`);return Ue({appId:i,apiKey:u,region:d,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${oe}-${i}`}),E()]}),...m})}var $="5.6.1";function De(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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,...g}){let w=I(i,u,d),l=U({hosts:De(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Search",version:$}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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=n=>Math.min(n*200,5e3)},s){let n=0;return k({func:()=>this.getTask({indexName:r,taskID:e},s),validate:o=>o.status==="published",aggregator:()=>n+=1,error:{validate:()=>n>=t,message:()=>`The maximum number of retries exceeded. (${n}/${t})`},timeout:()=>a(n)})},waitForAppTask({taskID:r,maxRetries:e=50,timeout:t=s=>Math.min(s*200,5e3)},a){let s=0;return k({func:()=>this.getAppTask({taskID:r},a),validate:n=>n.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=e,message:()=>`The maximum number of retries exceeded. (${s}/${e})`},timeout:()=>t(s)})},waitForApiKey({operation:r,key:e,apiKey:t,maxRetries:a=50,timeout:s=o=>Math.min(o*200,5e3)},n){let o=0,c={aggregator:()=>o+=1,error:{validate:()=>o>=a,message:()=>`The maximum number of retries exceeded. (${o}/${a})`},timeout:()=>s(o)};if(r==="update"){if(!t)throw new Error("`apiKey` is required when waiting for an `update` operation.");return k({...c,func:()=>this.getApiKey({key:e},n),validate:h=>{for(let q of Object.keys(t)){let P=t[q],p=h[q];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 k({...c,func:()=>this.getApiKey({key:e},n).catch(h=>{if(h.status!==404)throw h}),validate:h=>r==="add"?h!==void 0:h===void 0})},browseObjects({indexName:r,browseParams:e,...t},a){return k({func:s=>this.browse({indexName:r,browseParams:{cursor:s?s.cursor:void 0,...e}},a),validate:s=>s.cursor===void 0,...t})},browseRules({indexName:r,searchRulesParams:e,...t},a){let s={hitsPerPage:1e3,...e};return k({func:n=>this.searchRules({indexName:r,searchRulesParams:{...s,page:n?n.page+1:s.page||0}},a),validate:n=>n.nbHits<s.hitsPerPage,...t})},browseSynonyms({indexName:r,searchSynonymsParams:e,...t},a){let s={page:0,...e,hitsPerPage:1e3};return k({func:n=>{let o=this.searchSynonyms({indexName:r,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,o},validate:n=>n.nbHits<s.hitsPerPage,...t})},async chunkedBatch({indexName:r,objects:e,action:t="addObject",waitForTasks:a,batchSize:s=1e3},n){let o=[],c=[],h=e.entries();for(let[q,P]of h)o.push({action:t,body:P}),(o.length===s||q===e.length-1)&&(c.push(await this.batch({indexName:r,batchWriteParams:{requests:o}},n)),o=[]);if(a)for(let q of c)await this.waitForTask({indexName:r,taskID:q.taskID});return c},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 s=Math.floor(Math.random()*1e6)+1e5,n=`${r}_tmp_${s}`,o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),c=await this.chunkedBatch({indexName:n,objects:e,waitForTasks:!0,batchSize:t},a);await this.waitForTask({indexName:n,taskID:o.taskID}),o=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:n,scope:["settings","rules","synonyms"]}},a),await this.waitForTask({indexName:n,taskID:o.taskID});let h=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:r}},a);return await this.waitForTask({indexName:n,taskID:h.taskID}),{copyOperationResponse:o,batchResponses:c,moveOperationResponse:h}},async indexExists({indexName:r}){try{await this.getSettings({indexName:r})}catch(e){if(e instanceof _&&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 n={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return l.request(n,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 c={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:t};return l.request(c,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 n={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return l.request(n,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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",s={},n={};r!==void 0&&(s["X-Algolia-User-ID"]=r.toString());let o={method:"POST",path:a,queryParameters:n,headers:s,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 n={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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)),s={},n={};e!==void 0&&(n.forwardToReplicas=e.toString());let o={method:"POST",path:a,queryParameters:n,headers:s};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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},deleteApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let n={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 n={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},deleteSource({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let n={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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 s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"DELETE",path:s,queryParameters:o,headers:n};return l.request(c,a)},getApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let n={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getAppTask({taskID:r},e){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let n={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getDictionaryLanguages(r){let s={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return l.request(s,r)},getDictionarySettings(r){let s={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return l.request(s,r)},getLogs({offset:r,length:e,indexName:t,type:a}={},s=void 0){let n="/1/logs",o={},c={};r!==void 0&&(c.offset=r.toString()),e!==void 0&&(c.length=e.toString()),t!==void 0&&(c.indexName=t.toString()),a!==void 0&&(c.type=a.toString());let h={method:"GET",path:n,queryParameters:c,headers:o};return l.request(h,s)},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 s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),n={},o={};t!==void 0&&(o.attributesToRetrieve=t.toString());let c={method:"GET",path:s,queryParameters:o,headers:n};return l.request(c,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 n={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},getSources(r){let s={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return l.request(s,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 s={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return l.request(s,r)},getUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let n={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},hasPendingMappings({getClusters:r}={},e=void 0){let t="/1/clusters/mapping/pending",a={},s={};r!==void 0&&(s.getClusters=r.toString());let n={method:"GET",path:t,queryParameters:s,headers:a};return l.request(n,e)},listApiKeys(r){let s={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return l.request(s,r)},listClusters(r){let s={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return l.request(s,r)},listIndices({page:r,hitsPerPage:e}={},t=void 0){let a="/1/indexes",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};return l.request(o,t)},listUserIds({page:r,hitsPerPage:e}={},t=void 0){let a="/1/clusters/mapping",s={},n={};r!==void 0&&(n.page=r.toString()),e!==void 0&&(n.hitsPerPage=e.toString());let o={method:"GET",path:a,queryParameters:n,headers:s};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 n={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return l.request(n,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},s){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 n="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.createIfNotExists=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},removeUserId({userID:r},e){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let n={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,e)},replaceSources({source:r},e){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let n={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return l.request(n,e)},restoreApiKey({key:r},e){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let n={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return l.request(n,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},s){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 n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveRules({indexName:r,rules:e,forwardToReplicas:t,clearExistingRules:a},s){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 n="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.clearExistingRules=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},saveSynonym({indexName:r,objectID:e,synonymHit:t,forwardToReplicas:a},s){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 n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(e)),o={},c={};a!==void 0&&(c.forwardToReplicas=a.toString());let h={method:"PUT",path:n,queryParameters:c,headers:o,data:t};return l.request(h,s)},saveSynonyms({indexName:r,synonymHit:e,forwardToReplicas:t,replaceExistingSynonyms:a},s){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 n="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),o={},c={};t!==void 0&&(c.forwardToReplicas=t.toString()),a!==void 0&&(c.replaceExistingSynonyms=a.toString());let h={method:"POST",path:n,queryParameters:c,headers:o,data:e};return l.request(h,s)},search(r,e){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:c,...h})=>h.type==="facet"?{...h,...c,type:"facet"}:{...h,...c,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 n={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,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 n={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 n={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return l.request(n,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 s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),n={},o={};t!==void 0&&(o.forwardToReplicas=t.toString());let c={method:"PUT",path:s,queryParameters:o,headers:n,data:e};return l.request(c,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 ce(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:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${$}-${i}`}),E()]}),...d})}var ue="5.6.1";function ke(i){return[{url:`${i}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${i}.algolia.net`,accept:"write",protocol:"https"}].concat(B([{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 je({appId:i,apiKey:u,authMode:d,algoliaAgents:m,...g}){let w=I(i,u,d),l=U({hosts:ke(i),...g,algoliaAgent:x({algoliaAgents:m,client:"Recommend",version:ue}),baseHeaders:{"content-type":"text/plain",...w.headers(),...g.baseHeaders},baseQueryParameters:{...w.queryParameters(),...g.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 c={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,a)},customPut({path:r,parameters:e,body:t},a){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let c={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:e||{},headers:{},data:t||{}};return l.request(c,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 c={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(c,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 c={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(c,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 c={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(c,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 n={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return l.request(n,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 c={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(c,a)}}}function he(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 je({appId:i,apiKey:u,timeouts:{connect:C,read:A,write:b},logger:O(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:!1}),hostsCache:R({caches:[v({key:`${ue}-${i}`}),E()]}),...d})}function Tr(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=ce(i,u,d);return{...m,get _ua(){return m.transporter.algoliaAgent.value},initRecommend:(g={})=>he(g.appId||i,g.apiKey||u,g.options),initAnalytics:(g={})=>se(g.appId||i,g.apiKey||u,g.region,g.options),initAbtesting:(g={})=>re(g.appId||i,g.apiKey||u,g.region,g.options),initPersonalization:g=>ie(g.appId||i,g.apiKey||u,g.region,g.options)}}export{re as abtestingClient,Tr as algoliasearch,se as analyticsClient,$ as apiClientVersion,ie as personalizationClient,he as recommendClient,ce as searchClient};
//# sourceMappingURL=browser.min.js.map

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

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

@@ -18,0 +18,0 @@ return [

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

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

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

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

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

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

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

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

// lite/src/liteClient.ts
import { createAuth, createTransporter, getAlgoliaAgent, shuffle } from "@algolia/client-common";
var apiClientVersion = "5.6.0";
var apiClientVersion = "5.6.1";
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.6.0';
export const apiClientVersion = '5.6.1';

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

{
"version": "5.6.0",
"version": "5.6.1",
"repository": {

@@ -76,14 +76,14 @@ "type": "git",

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

@@ -90,0 +90,0 @@ "@types/node": "22.5.5",

@@ -35,13 +35,18 @@ <p align="center">

To get started, you first need to install algoliasearch (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
### With a package manager
```bash
yarn add algoliasearch
yarn add algoliasearch@5.6.1
# or
npm install algoliasearch
npm install algoliasearch@5.6.1
# or
pnpm add algoliasearch@5.6.1
```
Without a package manager
### Without a package manager

@@ -51,5 +56,11 @@ Add the following JavaScript snippet to the <head> of your website:

```html
<script src="https://cdn.jsdelivr.net/npm/algoliasearch/dist/algoliasearch.umd.min.js"></script>
// for the full client
<script src="https://cdn.jsdelivr.net/npm/algoliasearch@5.6.1/dist/algoliasearch.umd.js"></script>
// for the lite client
<script src="https://cdn.jsdelivr.net/npm/algoliasearch@5.6.1/dist/lite/builds/browser.umd.js"></script>
```
### Usage
You can now import the Algolia API client in your project and play with it.

@@ -68,3 +79,3 @@

For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/)**.
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/search/)**.

@@ -71,0 +82,0 @@ ## ❓ Troubleshooting

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