algoliasearch 5.2.4-beta.4 → 5.2.4-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builds/browser.ts +1 -1
- package/builds/models.ts +5 -5
- package/builds/node.ts +1 -1
- package/dist/algoliasearch.umd.js +3 -3
- package/dist/browser.js +1 -299
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/node.cjs +10 -234
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +1 -299
- package/dist/node.js.map +1 -1
- package/package.json +9 -9
package/dist/browser.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function ot(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function it(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function ct(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function D(t){let e=[...t.caches],s=e.shift();return s===void 0?ct():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>D({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>D({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>D({caches:e}).delete(a))},clear(){return s.clear().catch(()=>D({caches:e}).clear())}}}function ce(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var Oe=2*60*1e3;function Ie(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>Oe}function d(){return e==="timed out"&&Date.now()-s<=Oe}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function _(t,e,s){return(e=lt(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ut(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lt(t){var e=ut(t,"string");return typeof e=="symbol"?e:e+""}var Y=class extends Error{constructor(e,s){super(e),_(this,"name","AlgoliaError"),s&&(this.name=s)}},V=class extends Y{constructor(e,s,a){super(e,a),_(this,"stackTrace",void 0),this.stackTrace=s}},ue=class extends V{constructor(e){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.",e,"RetryError")}},k=class extends V{constructor(e,s,a,d="ApiError"){super(e,a,d),_(this,"status",void 0),this.status=s}},le=class extends Y{constructor(e,s){super(e,"DeserializationError"),_(this,"response",void 0),this.response=s}},de=class extends k{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),_(this,"error",void 0),this.error=a}};function dt(t,e,s){let a=ht(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function ht(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function mt(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function ft(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function gt(t){try{return JSON.parse(t.content)}catch(e){throw new le(e.message,t)}}function pt({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new de(a.message,e,a.error,s):new k(a.message,e,s)}catch{}return new k(t,e,s)}function Pt({isTimedOut:t,status:e}){return!t&&~~e===0}function yt({isTimedOut:t,status:e}){return t||Pt({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function wt({status:t}){return~~(t/100)===2}function qt(t){return t.map(e=>Ne(e))}function Ne(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Tt({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(Ie(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=mt(i,u),P=ft(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let E=0,b=async(w,R)=>{let S=w.pop();if(S===void 0)throw new ue(qt(h));let v={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:dt(S,i.path,q),connectTimeout:R(E,v.connect),responseTimeout:R(E,f?v.read:v.write)},x=A=>{let N={request:I,response:A,host:S,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(yt(T)){let A=x(T);return T.isTimedOut&&E++,console.log("Retryable failure",Ne(A)),await e.set(S,Ie(S,T.isTimedOut?"timed out":"down")),b(w,R)}if(wt(T))return gt(T);throw x(T),pt(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function Et(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function St({algoliaAgents:t,client:e,version:s}){let a=Et(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var bt=1e3,Rt=2e3,vt=3e4;function At(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var Ce="5.2.4",xe=["de","us"];function Ot(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function It({appId:t,apiKey:e,authMode:s,algoliaAgents:a,region:d,...g}){let m=ot(t,e,s),r=Tt({hosts:Ot(d),...g,algoliaAgent:St({algoliaAgents:a,client:"Abtesting",version:Ce}),baseHeaders:{"content-type":"text/plain",...m.headers(),...g.baseHeaders},baseQueryParameters:{...m.queryParameters(),...g.baseQueryParameters}});return{transporter:r,appId:t,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(n,o){r.algoliaAgent.add({segment:n,version:o})},addABTests(n,o){if(!n)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!n.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!n.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!n.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let u={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:n};return r.request(u,o)},customDelete({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customDelete`.");let f={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customGet({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customGet`.");let f={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customPost({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},customPut({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},deleteABTest({id:n},o){if(!n)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let u={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},getABTest({id:n},o){if(!n)throw new Error("Parameter `id` is required when calling `getABTest`.");let u={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},listABTests({offset:n,limit:o,indexPrefix:c,indexSuffix:l}={},i=void 0){let u="/2/abtests",f={},h={};n!==void 0&&(h.offset=n.toString()),o!==void 0&&(h.limit=o.toString()),c!==void 0&&(h.indexPrefix=c.toString()),l!==void 0&&(h.indexSuffix=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},scheduleABTest(n,o){if(!n)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!n.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!n.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!n.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!n.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let u={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:n};return r.request(u,o)},stopABTest({id:n},o){if(!n)throw new Error("Parameter `id` is required when calling `stopABTest`.");let u={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)}}}function Ue(t,e,s,a){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!xe.includes(s)))throw new Error(`\`region\` must be one of the following: ${xe.join(", ")}`);return It({appId:t,apiKey:e,region:s,timeouts:{connect:bt,read:Rt,write:vt},requester:At(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:ce(),requestsCache:ce({serializable:!1}),hostsCache:D({caches:[it({key:`${Ce}-${t}`}),ce()]}),...a})}function xt(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function Nt(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function Ct(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function $(t){let e=[...t.caches],s=e.shift();return s===void 0?Ct():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>$({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>$({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>$({caches:e}).delete(a))},clear(){return s.clear().catch(()=>$({caches:e}).clear())}}}function he(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var je=2*60*1e3;function De(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>je}function d(){return e==="timed out"&&Date.now()-s<=je}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function L(t,e,s){return(e=jt(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Ut(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jt(t){var e=Ut(t,"string");return typeof e=="symbol"?e:e+""}var Z=class extends Error{constructor(e,s){super(e),L(this,"name","AlgoliaError"),s&&(this.name=s)}},ee=class extends Z{constructor(e,s,a){super(e,a),L(this,"stackTrace",void 0),this.stackTrace=s}},me=class extends ee{constructor(e){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.",e,"RetryError")}},J=class extends ee{constructor(e,s,a,d="ApiError"){super(e,a,d),L(this,"status",void 0),this.status=s}},fe=class extends Z{constructor(e,s){super(e,"DeserializationError"),L(this,"response",void 0),this.response=s}},ge=class extends J{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),L(this,"error",void 0),this.error=a}};function Dt(t,e,s){let a=kt(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function kt(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function _t(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function $t(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function Jt(t){try{return JSON.parse(t.content)}catch(e){throw new fe(e.message,t)}}function Lt({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new ge(a.message,e,a.error,s):new J(a.message,e,s)}catch{}return new J(t,e,s)}function Wt({isTimedOut:t,status:e}){return!t&&~~e===0}function zt({isTimedOut:t,status:e}){return t||Wt({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function Gt({status:t}){return~~(t/100)===2}function Bt(t){return t.map(e=>_e(e))}function _e(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Ft({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(De(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=_t(i,u),P=$t(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let E=0,b=async(w,R)=>{let S=w.pop();if(S===void 0)throw new me(Bt(h));let v={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:Dt(S,i.path,q),connectTimeout:R(E,v.connect),responseTimeout:R(E,f?v.read:v.write)},x=A=>{let N={request:I,response:A,host:S,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(zt(T)){let A=x(T);return T.isTimedOut&&E++,console.log("Retryable failure",_e(A)),await e.set(S,De(S,T.isTimedOut?"timed out":"down")),b(w,R)}if(Gt(T))return Jt(T);throw x(T),Lt(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function Mt(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function Ht({algoliaAgents:t,client:e,version:s}){let a=Mt(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var Qt=1e3,Kt=2e3,Xt=3e4;function Yt(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var $e="5.2.4",ke=["de","us"];function Vt(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Zt({appId:t,apiKey:e,authMode:s,algoliaAgents:a,region:d,...g}){let m=xt(t,e,s),r=Ft({hosts:Vt(d),...g,algoliaAgent:Ht({algoliaAgents:a,client:"Analytics",version:$e}),baseHeaders:{"content-type":"text/plain",...m.headers(),...g.baseHeaders},baseQueryParameters:{...m.queryParameters(),...g.baseQueryParameters}});return{transporter:r,appId:t,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(n,o){r.algoliaAgent.add({segment:n,version:o})},customDelete({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customDelete`.");let f={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customGet({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customGet`.");let f={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customPost({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},customPut({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},getAddToCartRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let u="/2/conversions/addToCartRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getAverageClickPosition({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let u="/2/clicks/averageClickPosition",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getClickPositions({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let u="/2/clicks/positions",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getClickThroughRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let u="/2/clicks/clickThroughRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getConversionRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let u="/2/conversions/conversionRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getNoClickRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let u="/2/searches/noClickRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getNoResultsRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let u="/2/searches/noResultRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getPurchaseRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let u="/2/conversions/purchaseRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getRevenue({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getRevenue`.");let u="/2/conversions/revenue",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getSearchesCount({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let u="/2/searches/count",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getSearchesNoClicks({index:n,startDate:o,endDate:c,limit:l,offset:i,tags:u},f){if(!n)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let h="/2/searches/noClicks",y={},P={};n!==void 0&&(P.index=n.toString()),o!==void 0&&(P.startDate=o.toString()),c!==void 0&&(P.endDate=c.toString()),l!==void 0&&(P.limit=l.toString()),i!==void 0&&(P.offset=i.toString()),u!==void 0&&(P.tags=u.toString());let p={method:"GET",path:h,queryParameters:P,headers:y};return r.request(p,f)},getSearchesNoResults({index:n,startDate:o,endDate:c,limit:l,offset:i,tags:u},f){if(!n)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let h="/2/searches/noResults",y={},P={};n!==void 0&&(P.index=n.toString()),o!==void 0&&(P.startDate=o.toString()),c!==void 0&&(P.endDate=c.toString()),l!==void 0&&(P.limit=l.toString()),i!==void 0&&(P.offset=i.toString()),u!==void 0&&(P.tags=u.toString());let p={method:"GET",path:h,queryParameters:P,headers:y};return r.request(p,f)},getStatus({index:n},o){if(!n)throw new Error("Parameter `index` is required when calling `getStatus`.");let c="/2/status",l={},i={};n!==void 0&&(i.index=n.toString());let u={method:"GET",path:c,queryParameters:i,headers:l};return r.request(u,o)},getTopCountries({index:n,startDate:o,endDate:c,limit:l,offset:i,tags:u},f){if(!n)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let h="/2/countries",y={},P={};n!==void 0&&(P.index=n.toString()),o!==void 0&&(P.startDate=o.toString()),c!==void 0&&(P.endDate=c.toString()),l!==void 0&&(P.limit=l.toString()),i!==void 0&&(P.offset=i.toString()),u!==void 0&&(P.tags=u.toString());let p={method:"GET",path:h,queryParameters:P,headers:y};return r.request(p,f)},getTopFilterAttributes({index:n,search:o,startDate:c,endDate:l,limit:i,offset:u,tags:f},h){if(!n)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let y="/2/filters",P={},p={};n!==void 0&&(p.index=n.toString()),o!==void 0&&(p.search=o.toString()),c!==void 0&&(p.startDate=c.toString()),l!==void 0&&(p.endDate=l.toString()),i!==void 0&&(p.limit=i.toString()),u!==void 0&&(p.offset=u.toString()),f!==void 0&&(p.tags=f.toString());let q={method:"GET",path:y,queryParameters:p,headers:P};return r.request(q,h)},getTopFilterForAttribute({attribute:n,index:o,search:c,startDate:l,endDate:i,limit:u,offset:f,tags:h},y){if(!n)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!o)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let P="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(n)),p={},q={};o!==void 0&&(q.index=o.toString()),c!==void 0&&(q.search=c.toString()),l!==void 0&&(q.startDate=l.toString()),i!==void 0&&(q.endDate=i.toString()),u!==void 0&&(q.limit=u.toString()),f!==void 0&&(q.offset=f.toString()),h!==void 0&&(q.tags=h.toString());let E={method:"GET",path:P,queryParameters:q,headers:p};return r.request(E,y)},getTopFiltersNoResults({index:n,search:o,startDate:c,endDate:l,limit:i,offset:u,tags:f},h){if(!n)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let y="/2/filters/noResults",P={},p={};n!==void 0&&(p.index=n.toString()),o!==void 0&&(p.search=o.toString()),c!==void 0&&(p.startDate=c.toString()),l!==void 0&&(p.endDate=l.toString()),i!==void 0&&(p.limit=i.toString()),u!==void 0&&(p.offset=u.toString()),f!==void 0&&(p.tags=f.toString());let q={method:"GET",path:y,queryParameters:p,headers:P};return r.request(q,h)},getTopHits({index:n,search:o,clickAnalytics:c,revenueAnalytics:l,startDate:i,endDate:u,limit:f,offset:h,tags:y},P){if(!n)throw new Error("Parameter `index` is required when calling `getTopHits`.");let p="/2/hits",q={},E={};n!==void 0&&(E.index=n.toString()),o!==void 0&&(E.search=o.toString()),c!==void 0&&(E.clickAnalytics=c.toString()),l!==void 0&&(E.revenueAnalytics=l.toString()),i!==void 0&&(E.startDate=i.toString()),u!==void 0&&(E.endDate=u.toString()),f!==void 0&&(E.limit=f.toString()),h!==void 0&&(E.offset=h.toString()),y!==void 0&&(E.tags=y.toString());let b={method:"GET",path:p,queryParameters:E,headers:q};return r.request(b,P)},getTopSearches({index:n,clickAnalytics:o,revenueAnalytics:c,startDate:l,endDate:i,orderBy:u,direction:f,limit:h,offset:y,tags:P},p){if(!n)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let q="/2/searches",E={},b={};n!==void 0&&(b.index=n.toString()),o!==void 0&&(b.clickAnalytics=o.toString()),c!==void 0&&(b.revenueAnalytics=c.toString()),l!==void 0&&(b.startDate=l.toString()),i!==void 0&&(b.endDate=i.toString()),u!==void 0&&(b.orderBy=u.toString()),f!==void 0&&(b.direction=f.toString()),h!==void 0&&(b.limit=h.toString()),y!==void 0&&(b.offset=y.toString()),P!==void 0&&(b.tags=P.toString());let C={method:"GET",path:q,queryParameters:b,headers:E};return r.request(C,p)},getUsersCount({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let u="/2/users/count",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)}}}function Je(t,e,s,a){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!ke.includes(s)))throw new Error(`\`region\` must be one of the following: ${ke.join(", ")}`);return Zt({appId:t,apiKey:e,region:s,timeouts:{connect:Qt,read:Kt,write:Xt},requester:Yt(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:he(),requestsCache:he({serializable:!1}),hostsCache:$({caches:[Nt({key:`${$e}-${t}`}),he()]}),...a})}function Le(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function er(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function j(t){let e=[...t.caches],s=e.shift();return s===void 0?er():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>j({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>j({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>j({caches:e}).delete(a))},clear(){return s.clear().catch(()=>j({caches:e}).clear())}}}function te(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var bn=2*60*1e3;var We=1e3,ze=2e3,Ge=3e4;function tr(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function rr(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function nr(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function W(t){let e=[...t.caches],s=e.shift();return s===void 0?nr():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>W({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>W({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>W({caches:e}).delete(a))},clear(){return s.clear().catch(()=>W({caches:e}).clear())}}}function pe(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var Be=2*60*1e3;function Fe(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>Be}function d(){return e==="timed out"&&Date.now()-s<=Be}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function G(t,e,s){return(e=sr(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ar(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sr(t){var e=ar(t,"string");return typeof e=="symbol"?e:e+""}var re=class extends Error{constructor(e,s){super(e),G(this,"name","AlgoliaError"),s&&(this.name=s)}},ne=class extends re{constructor(e,s,a){super(e,a),G(this,"stackTrace",void 0),this.stackTrace=s}},Pe=class extends ne{constructor(e){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.",e,"RetryError")}},z=class extends ne{constructor(e,s,a,d="ApiError"){super(e,a,d),G(this,"status",void 0),this.status=s}},ye=class extends re{constructor(e,s){super(e,"DeserializationError"),G(this,"response",void 0),this.response=s}},we=class extends z{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),G(this,"error",void 0),this.error=a}};function or(t,e,s){let a=ir(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function ir(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function cr(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function ur(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function lr(t){try{return JSON.parse(t.content)}catch(e){throw new ye(e.message,t)}}function dr({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new we(a.message,e,a.error,s):new z(a.message,e,s)}catch{}return new z(t,e,s)}function hr({isTimedOut:t,status:e}){return!t&&~~e===0}function mr({isTimedOut:t,status:e}){return t||hr({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function fr({status:t}){return~~(t/100)===2}function gr(t){return t.map(e=>He(e))}function He(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function pr({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(Fe(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=cr(i,u),P=ur(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let E=0,b=async(w,R)=>{let S=w.pop();if(S===void 0)throw new Pe(gr(h));let v={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:or(S,i.path,q),connectTimeout:R(E,v.connect),responseTimeout:R(E,f?v.read:v.write)},x=A=>{let N={request:I,response:A,host:S,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(mr(T)){let A=x(T);return T.isTimedOut&&E++,console.log("Retryable failure",He(A)),await e.set(S,Fe(S,T.isTimedOut?"timed out":"down")),b(w,R)}if(fr(T))return lr(T);throw x(T),dr(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function Pr(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function yr({algoliaAgents:t,client:e,version:s}){let a=Pr(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var wr=1e3,qr=2e3,Tr=3e4;function Er(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var Qe="5.2.4",Me=["eu","us"];function Sr(t){return[{url:"personalization.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function br({appId:t,apiKey:e,authMode:s,algoliaAgents:a,region:d,...g}){let m=tr(t,e,s),r=pr({hosts:Sr(d),...g,algoliaAgent:yr({algoliaAgents:a,client:"Personalization",version:Qe}),baseHeaders:{"content-type":"text/plain",...m.headers(),...g.baseHeaders},baseQueryParameters:{...m.queryParameters(),...g.baseQueryParameters}});return{transporter:r,appId:t,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(n,o){r.algoliaAgent.add({segment:n,version:o})},customDelete({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customDelete`.");let f={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customGet({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customGet`.");let f={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customPost({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},customPut({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},deleteUserProfile({userToken:n},o){if(!n)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let u={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},getPersonalizationStrategy(n){let i={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(i,n)},getUserTokenProfile({userToken:n},o){if(!n)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let u={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},setPersonalizationStrategy(n,o){if(!n)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!n.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!n.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!n.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let u={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:n};return r.request(u,o)}}}function Ke(t,e,s,a){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!s||s&&(typeof s!="string"||!Me.includes(s)))throw new Error(`\`region\` is required and must be one of the following: ${Me.join(", ")}`);return br({appId:t,apiKey:e,region:s,timeouts:{connect:wr,read:qr,write:Tr},requester:Er(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:pe(),requestsCache:pe({serializable:!1}),hostsCache:W({caches:[rr({key:`${Qe}-${t}`}),pe()]}),...a})}function Rr(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function U({func:t,validate:e,aggregator:s,error:a,timeout:d=()=>0}){let g=m=>new Promise((r,n)=>{t(m).then(o=>(s&&s(o),e(o)?r(o):a&&a.validate(o)?n(new Error(a.message(o))):setTimeout(()=>{g(o).then(r).catch(n)},d()))).catch(o=>{n(o)})});return g()}function vr(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function Ar(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function B(t){let e=[...t.caches],s=e.shift();return s===void 0?Ar():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>B({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>B({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>B({caches:e}).delete(a))},clear(){return s.clear().catch(()=>B({caches:e}).clear())}}}function qe(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var Xe=2*60*1e3;function Ye(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>Xe}function d(){return e==="timed out"&&Date.now()-s<=Xe}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function M(t,e,s){return(e=Ir(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Or(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ir(t){var e=Or(t,"string");return typeof e=="symbol"?e:e+""}var ae=class extends Error{constructor(e,s){super(e),M(this,"name","AlgoliaError"),s&&(this.name=s)}},se=class extends ae{constructor(e,s,a){super(e,a),M(this,"stackTrace",void 0),this.stackTrace=s}},Te=class extends se{constructor(e){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.",e,"RetryError")}},F=class extends se{constructor(e,s,a,d="ApiError"){super(e,a,d),M(this,"status",void 0),this.status=s}},Ee=class extends ae{constructor(e,s){super(e,"DeserializationError"),M(this,"response",void 0),this.response=s}},Se=class extends F{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),M(this,"error",void 0),this.error=a}};function xr(t){let e=t;for(let s=t.length-1;s>0;s--){let a=Math.floor(Math.random()*(s+1)),d=t[s];e[s]=t[a],e[a]=d}return e}function Nr(t,e,s){let a=Cr(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function Cr(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function Ur(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function jr(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function Dr(t){try{return JSON.parse(t.content)}catch(e){throw new Ee(e.message,t)}}function kr({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new Se(a.message,e,a.error,s):new F(a.message,e,s)}catch{}return new F(t,e,s)}function _r({isTimedOut:t,status:e}){return!t&&~~e===0}function $r({isTimedOut:t,status:e}){return t||_r({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function Jr({status:t}){return~~(t/100)===2}function Lr(t){return t.map(e=>Ve(e))}function Ve(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Wr({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(Ye(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=Ur(i,u),P=jr(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let E=0,b=async(w,R)=>{let S=w.pop();if(S===void 0)throw new Te(Lr(h));let v={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:Nr(S,i.path,q),connectTimeout:R(E,v.connect),responseTimeout:R(E,f?v.read:v.write)},x=A=>{let N={request:I,response:A,host:S,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if($r(T)){let A=x(T);return T.isTimedOut&&E++,console.log("Retryable failure",Ve(A)),await e.set(S,Ye(S,T.isTimedOut?"timed out":"down")),b(w,R)}if(Jr(T))return Dr(T);throw x(T),kr(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function zr(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function Gr({algoliaAgents:t,client:e,version:s}){let a=zr(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var Br=1e3,Fr=2e3,Mr=3e4;function Hr(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var H="5.2.4";function Qr(t){return[{url:`${t}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${t}.algolia.net`,accept:"write",protocol:"https"}].concat(xr([{url:`${t}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Kr({appId:t,apiKey:e,authMode:s,algoliaAgents:a,...d}){let g=Rr(t,e,s),m=Wr({hosts:Qr(t),...d,algoliaAgent:Gr({algoliaAgents:a,client:"Search",version:H}),baseHeaders:{"content-type":"text/plain",...g.headers(),...d.baseHeaders},baseQueryParameters:{...g.queryParameters(),...d.baseQueryParameters}});return{transporter:m,appId:t,clearCache(){return Promise.all([m.requestsCache.clear(),m.responsesCache.clear()]).then(()=>{})},get _ua(){return m.algoliaAgent.value},addAlgoliaAgent(r,n){m.algoliaAgent.add({segment:r,version:n})},waitForTask({indexName:r,taskID:n,maxRetries:o=50,timeout:c=i=>Math.min(i*200,5e3)},l){let i=0;return U({func:()=>this.getTask({indexName:r,taskID:n},l),validate:u=>u.status==="published",aggregator:()=>i+=1,error:{validate:()=>i>=o,message:()=>`The maximum number of retries exceeded. (${i}/${o})`},timeout:()=>c(i)})},waitForAppTask({taskID:r,maxRetries:n=50,timeout:o=l=>Math.min(l*200,5e3)},c){let l=0;return U({func:()=>this.getAppTask({taskID:r},c),validate:i=>i.status==="published",aggregator:()=>l+=1,error:{validate:()=>l>=n,message:()=>`The maximum number of retries exceeded. (${l}/${n})`},timeout:()=>o(l)})},waitForApiKey({operation:r,key:n,apiKey:o,maxRetries:c=50,timeout:l=u=>Math.min(u*200,5e3)},i){let u=0,f={aggregator:()=>u+=1,error:{validate:()=>u>=c,message:()=>`The maximum number of retries exceeded. (${u}/${c})`},timeout:()=>l(u)};if(r==="update"){if(!o)throw new Error("`apiKey` is required when waiting for an `update` operation.");return U({...f,func:()=>this.getApiKey({key:n},i),validate:h=>{for(let y of Object.keys(o)){let P=o[y],p=h[y];if(Array.isArray(P)&&Array.isArray(p)){if(P.length!==p.length||P.some((q,E)=>q!==p[E]))return!1}else if(P!==p)return!1}return!0}})}return U({...f,func:()=>this.getApiKey({key:n},i).catch(h=>{if(h.status!==404)throw h}),validate:h=>r==="add"?h!==void 0:h===void 0})},browseObjects({indexName:r,browseParams:n,...o},c){return U({func:l=>this.browse({indexName:r,browseParams:{cursor:l?l.cursor:void 0,...n}},c),validate:l=>l.cursor===void 0,...o})},browseRules({indexName:r,searchRulesParams:n,...o},c){let l={hitsPerPage:1e3,...n};return U({func:i=>this.searchRules({indexName:r,searchRulesParams:{...l,page:i?i.page+1:l.page||0}},c),validate:i=>i.nbHits<l.hitsPerPage,...o})},browseSynonyms({indexName:r,searchSynonymsParams:n,...o},c){let l={page:0,...n,hitsPerPage:1e3};return U({func:i=>{let u=this.searchSynonyms({indexName:r,searchSynonymsParams:{...l,page:l.page}},c);return l.page+=1,u},validate:i=>i.nbHits<l.hitsPerPage,...o})},async chunkedBatch({indexName:r,objects:n,action:o="addObject",waitForTasks:c,batchSize:l=1e3},i){let u=[],f=[],h=n.entries();for(let[y,P]of h)u.push({action:o,body:P}),(u.length===l||y===n.length-1)&&(f.push(await this.batch({indexName:r,batchWriteParams:{requests:u}},i)),u=[]);if(c)for(let y of f)await this.waitForTask({indexName:r,taskID:y.taskID});return f},async saveObjects({indexName:r,objects:n},o){return await this.chunkedBatch({indexName:r,objects:n,action:"addObject"},o)},async deleteObjects({indexName:r,objectIDs:n},o){return await this.chunkedBatch({indexName:r,objects:n.map(c=>({objectID:c})),action:"deleteObject"},o)},async partialUpdateObjects({indexName:r,objects:n,createIfNotExists:o},c){return await this.chunkedBatch({indexName:r,objects:n,action:o?"partialUpdateObject":"partialUpdateObjectNoCreate"},c)},async replaceAllObjects({indexName:r,objects:n,batchSize:o},c){let l=Math.floor(Math.random()*1e6)+1e5,i=`${r}_tmp_${l}`,u=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:i,scope:["settings","rules","synonyms"]}},c),f=await this.chunkedBatch({indexName:i,objects:n,waitForTasks:!0,batchSize:o},c);await this.waitForTask({indexName:i,taskID:u.taskID}),u=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:i,scope:["settings","rules","synonyms"]}},c),await this.waitForTask({indexName:i,taskID:u.taskID});let h=await this.operationIndex({indexName:i,operationIndexParams:{operation:"move",destination:r}},c);return await this.waitForTask({indexName:i,taskID:h.taskID}),{copyOperationResponse:u,batchResponses:f,moveOperationResponse:h}},searchForHits(r,n){return this.search(r,n)},searchForFacets(r,n){return this.search(r,n)},addApiKey(r,n){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 i={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return m.request(i,n)},addOrUpdateObject({indexName:r,objectID:n,body:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!o)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let f={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{},data:o};return m.request(f,c)},appendSource(r,n){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 i={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return m.request(i,n)},assignUserId({xAlgoliaUserID:r,assignUserIdParams:n},o){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!n)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!n.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let c="/1/clusters/mapping",l={},i={};r!==void 0&&(l["X-Algolia-User-ID"]=r.toString());let u={method:"POST",path:c,queryParameters:i,headers:l,data:n};return m.request(u,o)},batch({indexName:r,batchWriteParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!n)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!n.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let u={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},batchAssignUserIds({xAlgoliaUserID:r,batchAssignUserIdsParams:n},o){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!n)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!n.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!n.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let c="/1/clusters/mapping/batch",l={},i={};r!==void 0&&(l["X-Algolia-User-ID"]=r.toString());let u={method:"POST",path:c,queryParameters:i,headers:l,data:n};return m.request(u,o)},batchDictionaryEntries({dictionaryName:r,batchDictionaryEntriesParams:n},o){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!n)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!n.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let u={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},browse({indexName:r,browseParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `browse`.");let u={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{}};return m.request(u,o)},clearObjects({indexName:r},n){if(!r)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let i={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},clearRules({indexName:r,forwardToReplicas:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let c="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(r)),l={},i={};n!==void 0&&(i.forwardToReplicas=n.toString());let u={method:"POST",path:c,queryParameters:i,headers:l};return m.request(u,o)},clearSynonyms({indexName:r,forwardToReplicas:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let c="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(r)),l={},i={};n!==void 0&&(i.forwardToReplicas=n.toString());let u={method:"POST",path:c,queryParameters:i,headers:l};return m.request(u,o)},customDelete({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customGet({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customPost({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},customPut({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},deleteApiKey({key:r},n){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let i={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},deleteBy({indexName:r,deleteByParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!n)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let u={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},deleteIndex({indexName:r},n){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let i={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},deleteObject({indexName:r,objectID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let u={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},deleteRule({indexName:r,objectID:n,forwardToReplicas:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!n)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let l="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),i={},u={};o!==void 0&&(u.forwardToReplicas=o.toString());let f={method:"DELETE",path:l,queryParameters:u,headers:i};return m.request(f,c)},deleteSource({source:r},n){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let i={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},deleteSynonym({indexName:r,objectID:n,forwardToReplicas:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!n)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let l="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),i={},u={};o!==void 0&&(u.forwardToReplicas=o.toString());let f={method:"DELETE",path:l,queryParameters:u,headers:i};return m.request(f,c)},getApiKey({key:r},n){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let i={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},getAppTask({taskID:r},n){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let i={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},getDictionaryLanguages(r){let l={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return m.request(l,r)},getDictionarySettings(r){let l={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return m.request(l,r)},getLogs({offset:r,length:n,indexName:o,type:c}={},l=void 0){let i="/1/logs",u={},f={};r!==void 0&&(f.offset=r.toString()),n!==void 0&&(f.length=n.toString()),o!==void 0&&(f.indexName=o.toString()),c!==void 0&&(f.type=c.toString());let h={method:"GET",path:i,queryParameters:f,headers:u};return m.request(h,l)},getObject({indexName:r,objectID:n,attributesToRetrieve:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `getObject`.");let l="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),i={},u={};o!==void 0&&(u.attributesToRetrieve=o.toString());let f={method:"GET",path:l,queryParameters:u,headers:i};return m.request(f,c)},getObjects(r,n){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 i={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},getRule({indexName:r,objectID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!n)throw new Error("Parameter `objectID` is required when calling `getRule`.");let u={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},getSettings({indexName:r},n){if(!r)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let i={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},getSources(r){let l={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return m.request(l,r)},getSynonym({indexName:r,objectID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!n)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let u={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},getTask({indexName:r,taskID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!n)throw new Error("Parameter `taskID` is required when calling `getTask`.");let u={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},getTopUserIds(r){let l={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return m.request(l,r)},getUserId({userID:r},n){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let i={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},hasPendingMappings({getClusters:r}={},n=void 0){let o="/1/clusters/mapping/pending",c={},l={};r!==void 0&&(l.getClusters=r.toString());let i={method:"GET",path:o,queryParameters:l,headers:c};return m.request(i,n)},listApiKeys(r){let l={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return m.request(l,r)},listClusters(r){let l={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return m.request(l,r)},listIndices({page:r,hitsPerPage:n}={},o=void 0){let c="/1/indexes",l={},i={};r!==void 0&&(i.page=r.toString()),n!==void 0&&(i.hitsPerPage=n.toString());let u={method:"GET",path:c,queryParameters:i,headers:l};return m.request(u,o)},listUserIds({page:r,hitsPerPage:n}={},o=void 0){let c="/1/clusters/mapping",l={},i={};r!==void 0&&(i.page=r.toString()),n!==void 0&&(i.hitsPerPage=n.toString());let u={method:"GET",path:c,queryParameters:i,headers:l};return m.request(u,o)},multipleBatch(r,n){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 i={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return m.request(i,n)},operationIndex({indexName:r,operationIndexParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!n)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!n.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!n.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let u={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},partialUpdateObject({indexName:r,objectID:n,attributesToUpdate:o,createIfNotExists:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!o)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let i="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),u={},f={};c!==void 0&&(f.createIfNotExists=c.toString());let h={method:"POST",path:i,queryParameters:f,headers:u,data:o};return m.request(h,l)},removeUserId({userID:r},n){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let i={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},replaceSources({source:r},n){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let i={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return m.request(i,n)},restoreApiKey({key:r},n){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let i={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},saveObject({indexName:r,body:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!n)throw new Error("Parameter `body` is required when calling `saveObject`.");let u={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},saveRule({indexName:r,objectID:n,rule:o,forwardToReplicas:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!n)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!o)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!o.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");let i="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),u={},f={};c!==void 0&&(f.forwardToReplicas=c.toString());let h={method:"PUT",path:i,queryParameters:f,headers:u,data:o};return m.request(h,l)},saveRules({indexName:r,rules:n,forwardToReplicas:o,clearExistingRules:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!n)throw new Error("Parameter `rules` is required when calling `saveRules`.");let i="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),u={},f={};o!==void 0&&(f.forwardToReplicas=o.toString()),c!==void 0&&(f.clearExistingRules=c.toString());let h={method:"POST",path:i,queryParameters:f,headers:u,data:n};return m.request(h,l)},saveSynonym({indexName:r,objectID:n,synonymHit:o,forwardToReplicas:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!n)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!o)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!o.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!o.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let i="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),u={},f={};c!==void 0&&(f.forwardToReplicas=c.toString());let h={method:"PUT",path:i,queryParameters:f,headers:u,data:o};return m.request(h,l)},saveSynonyms({indexName:r,synonymHit:n,forwardToReplicas:o,replaceExistingSynonyms:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!n)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let i="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),u={},f={};o!==void 0&&(f.forwardToReplicas=o.toString()),c!==void 0&&(f.replaceExistingSynonyms=c.toString());let h={method:"POST",path:i,queryParameters:f,headers:u,data:n};return m.request(h,l)},search(r,n){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:f,...h})=>h.type==="facet"?{...h,...f,type:"facet"}:{...h,...f,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 i={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},searchDictionaryEntries({dictionaryName:r,searchDictionaryEntriesParams:n},o){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!n)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!n.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let u={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n,useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchForFacetValues({indexName:r,facetName:n,searchForFacetValuesRequest:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!n)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let f={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(r)).replace("{facetName}",encodeURIComponent(n)),queryParameters:{},headers:{},data:o||{},useReadTransporter:!0,cacheable:!0};return m.request(f,c)},searchRules({indexName:r,searchRulesParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let u={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchSingleIndex({indexName:r,searchParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let u={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchSynonyms({indexName:r,searchSynonymsParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let u={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchUserIds(r,n){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 i={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},setDictionarySettings(r,n){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 i={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return m.request(i,n)},setSettings({indexName:r,indexSettings:n,forwardToReplicas:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!n)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let l="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),i={},u={};o!==void 0&&(u.forwardToReplicas=o.toString());let f={method:"PUT",path:l,queryParameters:u,headers:i,data:n};return m.request(f,c)},updateApiKey({key:r,apiKey:n},o){if(!r)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!n)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!n.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let u={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)}}}function Ze(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return Kr({appId:t,apiKey:e,timeouts:{connect:Br,read:Fr,write:Mr},requester:Hr(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:qe(),requestsCache:qe({serializable:!1}),hostsCache:B({caches:[vr({key:`${H}-${t}`}),qe()]}),...s})}function Xr(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function Yr(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function Vr(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function Q(t){let e=[...t.caches],s=e.shift();return s===void 0?Vr():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>Q({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>Q({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>Q({caches:e}).delete(a))},clear(){return s.clear().catch(()=>Q({caches:e}).clear())}}}function be(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var et=2*60*1e3;function tt(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>et}function d(){return e==="timed out"&&Date.now()-s<=et}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function X(t,e,s){return(e=en(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Zr(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function en(t){var e=Zr(t,"string");return typeof e=="symbol"?e:e+""}var oe=class extends Error{constructor(e,s){super(e),X(this,"name","AlgoliaError"),s&&(this.name=s)}},ie=class extends oe{constructor(e,s,a){super(e,a),X(this,"stackTrace",void 0),this.stackTrace=s}},Re=class extends ie{constructor(e){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.",e,"RetryError")}},K=class extends ie{constructor(e,s,a,d="ApiError"){super(e,a,d),X(this,"status",void 0),this.status=s}},ve=class extends oe{constructor(e,s){super(e,"DeserializationError"),X(this,"response",void 0),this.response=s}},Ae=class extends K{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),X(this,"error",void 0),this.error=a}};function tn(t){let e=t;for(let s=t.length-1;s>0;s--){let a=Math.floor(Math.random()*(s+1)),d=t[s];e[s]=t[a],e[a]=d}return e}function rn(t,e,s){let a=nn(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function nn(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function an(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function sn(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function on(t){try{return JSON.parse(t.content)}catch(e){throw new ve(e.message,t)}}function cn({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new Ae(a.message,e,a.error,s):new K(a.message,e,s)}catch{}return new K(t,e,s)}function un({isTimedOut:t,status:e}){return!t&&~~e===0}function ln({isTimedOut:t,status:e}){return t||un({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function dn({status:t}){return~~(t/100)===2}function hn(t){return t.map(e=>rt(e))}function rt(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function mn({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(tt(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=an(i,u),P=sn(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let E=0,b=async(w,R)=>{let S=w.pop();if(S===void 0)throw new Re(hn(h));let v={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:rn(S,i.path,q),connectTimeout:R(E,v.connect),responseTimeout:R(E,f?v.read:v.write)},x=A=>{let N={request:I,response:A,host:S,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(ln(T)){let A=x(T);return T.isTimedOut&&E++,console.log("Retryable failure",rt(A)),await e.set(S,tt(S,T.isTimedOut?"timed out":"down")),b(w,R)}if(dn(T))return on(T);throw x(T),cn(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function fn(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function gn({algoliaAgents:t,client:e,version:s}){let a=fn(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var pn=1e3,Pn=2e3,yn=3e4;function wn(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var nt="5.2.4";function qn(t){return[{url:`${t}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${t}.algolia.net`,accept:"write",protocol:"https"}].concat(tn([{url:`${t}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Tn({appId:t,apiKey:e,authMode:s,algoliaAgents:a,...d}){let g=Xr(t,e,s),m=mn({hosts:qn(t),...d,algoliaAgent:gn({algoliaAgents:a,client:"Recommend",version:nt}),baseHeaders:{"content-type":"text/plain",...g.headers(),...d.baseHeaders},baseQueryParameters:{...g.queryParameters(),...d.baseQueryParameters}});return{transporter:m,appId:t,clearCache(){return Promise.all([m.requestsCache.clear(),m.responsesCache.clear()]).then(()=>{})},get _ua(){return m.algoliaAgent.value},addAlgoliaAgent(r,n){m.algoliaAgent.add({segment:r,version:n})},customDelete({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customGet({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customPost({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},customPut({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},deleteRecommendRule({indexName:r,model:n,objectID:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!n)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!o)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let f={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)).replace("{objectID}",encodeURIComponent(o)),queryParameters:{},headers:{}};return m.request(f,c)},getRecommendRule({indexName:r,model:n,objectID:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!n)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!o)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let f={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)).replace("{objectID}",encodeURIComponent(o)),queryParameters:{},headers:{}};return m.request(f,c)},getRecommendStatus({indexName:r,model:n,taskID:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!n)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!o)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let f={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)).replace("{taskID}",encodeURIComponent(o)),queryParameters:{},headers:{}};return m.request(f,c)},getRecommendations(r,n){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 i={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},searchRecommendRules({indexName:r,model:n,searchRecommendRulesParams:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!n)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let f={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)),queryParameters:{},headers:{},data:o||{},useReadTransporter:!0,cacheable:!0};return m.request(f,c)}}}function at(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return Tn({appId:t,apiKey:e,timeouts:{connect:pn,read:Pn,write:yn},requester:wn(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:be(),requestsCache:be({serializable:!1}),hostsCache:Q({caches:[Yr({key:`${nt}-${t}`}),be()]}),...s})}function st(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}function Rs(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");function a(r={}){return at(r.appId||t,r.apiKey||e,r.options)}function d(r={}){return Je(r.appId||t,r.apiKey||e,r.region,r.options)}function g(r={}){return Ue(r.appId||t,r.apiKey||e,r.region,r.options)}function m(r){return Ke(r.appId||t,r.apiKey||e,r.region,r.options)}return{...Ze(t,e,{timeouts:{connect:We,read:ze,write:Ge},requester:st(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:te(),requestsCache:te({serializable:!1}),hostsCache:j({caches:[Le({key:`${H}-${t}`}),te()]}),...s}),get _ua(){return this.transporter.algoliaAgent.value},initAbtesting:g,initAnalytics:d,initPersonalization:m,initRecommend:a}}export{Ue as abtestingClient,Rs as algoliasearch,Je as analyticsClient,H as apiClientVersion,Ke as personalizationClient,at as recommendClient,Ze as searchClient};
|
|
1
|
+
function ot(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function it(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function ct(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function D(t){let e=[...t.caches],s=e.shift();return s===void 0?ct():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>D({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>D({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>D({caches:e}).delete(a))},clear(){return s.clear().catch(()=>D({caches:e}).clear())}}}function ce(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var Oe=2*60*1e3;function Ie(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>Oe}function d(){return e==="timed out"&&Date.now()-s<=Oe}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function _(t,e,s){return(e=lt(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ut(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lt(t){var e=ut(t,"string");return typeof e=="symbol"?e:e+""}var V=class extends Error{constructor(e,s){super(e),_(this,"name","AlgoliaError"),s&&(this.name=s)}},Y=class extends V{constructor(e,s,a){super(e,a),_(this,"stackTrace",void 0),this.stackTrace=s}},ue=class extends Y{constructor(e){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.",e,"RetryError")}},k=class extends Y{constructor(e,s,a,d="ApiError"){super(e,a,d),_(this,"status",void 0),this.status=s}},le=class extends V{constructor(e,s){super(e,"DeserializationError"),_(this,"response",void 0),this.response=s}},de=class extends k{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),_(this,"error",void 0),this.error=a}};function dt(t,e,s){let a=ht(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function ht(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function mt(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function ft(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function gt(t){try{return JSON.parse(t.content)}catch(e){throw new le(e.message,t)}}function pt({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new de(a.message,e,a.error,s):new k(a.message,e,s)}catch{}return new k(t,e,s)}function Pt({isTimedOut:t,status:e}){return!t&&~~e===0}function yt({isTimedOut:t,status:e}){return t||Pt({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function wt({status:t}){return~~(t/100)===2}function qt(t){return t.map(e=>Ne(e))}function Ne(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Tt({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(Ie(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=mt(i,u),P=ft(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let S=0,b=async(w,R)=>{let E=w.pop();if(E===void 0)throw new ue(qt(h));let A={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:dt(E,i.path,q),connectTimeout:R(S,A.connect),responseTimeout:R(S,f?A.read:A.write)},x=v=>{let N={request:I,response:v,host:E,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(yt(T)){let v=x(T);return T.isTimedOut&&S++,console.log("Retryable failure",Ne(v)),await e.set(E,Ie(E,T.isTimedOut?"timed out":"down")),b(w,R)}if(wt(T))return gt(T);throw x(T),pt(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function St(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function Et({algoliaAgents:t,client:e,version:s}){let a=St(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var bt=1e3,Rt=2e3,At=3e4;function vt(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var Ce="5.2.4",xe=["de","us"];function Ot(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function It({appId:t,apiKey:e,authMode:s,algoliaAgents:a,region:d,...g}){let m=ot(t,e,s),r=Tt({hosts:Ot(d),...g,algoliaAgent:Et({algoliaAgents:a,client:"Abtesting",version:Ce}),baseHeaders:{"content-type":"text/plain",...m.headers(),...g.baseHeaders},baseQueryParameters:{...m.queryParameters(),...g.baseQueryParameters}});return{transporter:r,appId:t,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(n,o){r.algoliaAgent.add({segment:n,version:o})},addABTests(n,o){if(!n)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!n.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!n.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!n.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let u={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:n};return r.request(u,o)},customDelete({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customDelete`.");let f={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customGet({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customGet`.");let f={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customPost({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},customPut({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},deleteABTest({id:n},o){if(!n)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let u={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},getABTest({id:n},o){if(!n)throw new Error("Parameter `id` is required when calling `getABTest`.");let u={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},listABTests({offset:n,limit:o,indexPrefix:c,indexSuffix:l}={},i=void 0){let u="/2/abtests",f={},h={};n!==void 0&&(h.offset=n.toString()),o!==void 0&&(h.limit=o.toString()),c!==void 0&&(h.indexPrefix=c.toString()),l!==void 0&&(h.indexSuffix=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},scheduleABTest(n,o){if(!n)throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");if(!n.name)throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");if(!n.variants)throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");if(!n.scheduledAt)throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");if(!n.endAt)throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");let u={method:"POST",path:"/2/abtests/schedule",queryParameters:{},headers:{},data:n};return r.request(u,o)},stopABTest({id:n},o){if(!n)throw new Error("Parameter `id` is required when calling `stopABTest`.");let u={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)}}}function Ue(t,e,s,a){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!xe.includes(s)))throw new Error(`\`region\` must be one of the following: ${xe.join(", ")}`);return It({appId:t,apiKey:e,region:s,timeouts:{connect:bt,read:Rt,write:At},requester:vt(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:ce(),requestsCache:ce({serializable:!1}),hostsCache:D({caches:[it({key:`${Ce}-${t}`}),ce()]}),...a})}function xt(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function Nt(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function Ct(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function $(t){let e=[...t.caches],s=e.shift();return s===void 0?Ct():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>$({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>$({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>$({caches:e}).delete(a))},clear(){return s.clear().catch(()=>$({caches:e}).clear())}}}function he(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var je=2*60*1e3;function De(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>je}function d(){return e==="timed out"&&Date.now()-s<=je}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function J(t,e,s){return(e=jt(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Ut(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jt(t){var e=Ut(t,"string");return typeof e=="symbol"?e:e+""}var Z=class extends Error{constructor(e,s){super(e),J(this,"name","AlgoliaError"),s&&(this.name=s)}},ee=class extends Z{constructor(e,s,a){super(e,a),J(this,"stackTrace",void 0),this.stackTrace=s}},me=class extends ee{constructor(e){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.",e,"RetryError")}},L=class extends ee{constructor(e,s,a,d="ApiError"){super(e,a,d),J(this,"status",void 0),this.status=s}},fe=class extends Z{constructor(e,s){super(e,"DeserializationError"),J(this,"response",void 0),this.response=s}},ge=class extends L{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),J(this,"error",void 0),this.error=a}};function Dt(t,e,s){let a=kt(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function kt(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function _t(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function $t(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function Lt(t){try{return JSON.parse(t.content)}catch(e){throw new fe(e.message,t)}}function Jt({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new ge(a.message,e,a.error,s):new L(a.message,e,s)}catch{}return new L(t,e,s)}function Wt({isTimedOut:t,status:e}){return!t&&~~e===0}function zt({isTimedOut:t,status:e}){return t||Wt({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function Ft({status:t}){return~~(t/100)===2}function Gt(t){return t.map(e=>_e(e))}function _e(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Bt({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(De(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=_t(i,u),P=$t(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let S=0,b=async(w,R)=>{let E=w.pop();if(E===void 0)throw new me(Gt(h));let A={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:Dt(E,i.path,q),connectTimeout:R(S,A.connect),responseTimeout:R(S,f?A.read:A.write)},x=v=>{let N={request:I,response:v,host:E,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(zt(T)){let v=x(T);return T.isTimedOut&&S++,console.log("Retryable failure",_e(v)),await e.set(E,De(E,T.isTimedOut?"timed out":"down")),b(w,R)}if(Ft(T))return Lt(T);throw x(T),Jt(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function Mt(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function Ht({algoliaAgents:t,client:e,version:s}){let a=Mt(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var Qt=1e3,Kt=2e3,Xt=3e4;function Vt(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var $e="5.2.4",ke=["de","us"];function Yt(t){return[{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Zt({appId:t,apiKey:e,authMode:s,algoliaAgents:a,region:d,...g}){let m=xt(t,e,s),r=Bt({hosts:Yt(d),...g,algoliaAgent:Ht({algoliaAgents:a,client:"Analytics",version:$e}),baseHeaders:{"content-type":"text/plain",...m.headers(),...g.baseHeaders},baseQueryParameters:{...m.queryParameters(),...g.baseQueryParameters}});return{transporter:r,appId:t,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(n,o){r.algoliaAgent.add({segment:n,version:o})},customDelete({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customDelete`.");let f={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customGet({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customGet`.");let f={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customPost({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},customPut({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},getAddToCartRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let u="/2/conversions/addToCartRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getAverageClickPosition({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let u="/2/clicks/averageClickPosition",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getClickPositions({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let u="/2/clicks/positions",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getClickThroughRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let u="/2/clicks/clickThroughRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getConversionRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let u="/2/conversions/conversionRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getNoClickRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let u="/2/searches/noClickRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getNoResultsRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let u="/2/searches/noResultRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getPurchaseRate({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let u="/2/conversions/purchaseRate",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getRevenue({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getRevenue`.");let u="/2/conversions/revenue",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getSearchesCount({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let u="/2/searches/count",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)},getSearchesNoClicks({index:n,startDate:o,endDate:c,limit:l,offset:i,tags:u},f){if(!n)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let h="/2/searches/noClicks",y={},P={};n!==void 0&&(P.index=n.toString()),o!==void 0&&(P.startDate=o.toString()),c!==void 0&&(P.endDate=c.toString()),l!==void 0&&(P.limit=l.toString()),i!==void 0&&(P.offset=i.toString()),u!==void 0&&(P.tags=u.toString());let p={method:"GET",path:h,queryParameters:P,headers:y};return r.request(p,f)},getSearchesNoResults({index:n,startDate:o,endDate:c,limit:l,offset:i,tags:u},f){if(!n)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let h="/2/searches/noResults",y={},P={};n!==void 0&&(P.index=n.toString()),o!==void 0&&(P.startDate=o.toString()),c!==void 0&&(P.endDate=c.toString()),l!==void 0&&(P.limit=l.toString()),i!==void 0&&(P.offset=i.toString()),u!==void 0&&(P.tags=u.toString());let p={method:"GET",path:h,queryParameters:P,headers:y};return r.request(p,f)},getStatus({index:n},o){if(!n)throw new Error("Parameter `index` is required when calling `getStatus`.");let c="/2/status",l={},i={};n!==void 0&&(i.index=n.toString());let u={method:"GET",path:c,queryParameters:i,headers:l};return r.request(u,o)},getTopCountries({index:n,startDate:o,endDate:c,limit:l,offset:i,tags:u},f){if(!n)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let h="/2/countries",y={},P={};n!==void 0&&(P.index=n.toString()),o!==void 0&&(P.startDate=o.toString()),c!==void 0&&(P.endDate=c.toString()),l!==void 0&&(P.limit=l.toString()),i!==void 0&&(P.offset=i.toString()),u!==void 0&&(P.tags=u.toString());let p={method:"GET",path:h,queryParameters:P,headers:y};return r.request(p,f)},getTopFilterAttributes({index:n,search:o,startDate:c,endDate:l,limit:i,offset:u,tags:f},h){if(!n)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let y="/2/filters",P={},p={};n!==void 0&&(p.index=n.toString()),o!==void 0&&(p.search=o.toString()),c!==void 0&&(p.startDate=c.toString()),l!==void 0&&(p.endDate=l.toString()),i!==void 0&&(p.limit=i.toString()),u!==void 0&&(p.offset=u.toString()),f!==void 0&&(p.tags=f.toString());let q={method:"GET",path:y,queryParameters:p,headers:P};return r.request(q,h)},getTopFilterForAttribute({attribute:n,index:o,search:c,startDate:l,endDate:i,limit:u,offset:f,tags:h},y){if(!n)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!o)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let P="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(n)),p={},q={};o!==void 0&&(q.index=o.toString()),c!==void 0&&(q.search=c.toString()),l!==void 0&&(q.startDate=l.toString()),i!==void 0&&(q.endDate=i.toString()),u!==void 0&&(q.limit=u.toString()),f!==void 0&&(q.offset=f.toString()),h!==void 0&&(q.tags=h.toString());let S={method:"GET",path:P,queryParameters:q,headers:p};return r.request(S,y)},getTopFiltersNoResults({index:n,search:o,startDate:c,endDate:l,limit:i,offset:u,tags:f},h){if(!n)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let y="/2/filters/noResults",P={},p={};n!==void 0&&(p.index=n.toString()),o!==void 0&&(p.search=o.toString()),c!==void 0&&(p.startDate=c.toString()),l!==void 0&&(p.endDate=l.toString()),i!==void 0&&(p.limit=i.toString()),u!==void 0&&(p.offset=u.toString()),f!==void 0&&(p.tags=f.toString());let q={method:"GET",path:y,queryParameters:p,headers:P};return r.request(q,h)},getTopHits({index:n,search:o,clickAnalytics:c,revenueAnalytics:l,startDate:i,endDate:u,limit:f,offset:h,tags:y},P){if(!n)throw new Error("Parameter `index` is required when calling `getTopHits`.");let p="/2/hits",q={},S={};n!==void 0&&(S.index=n.toString()),o!==void 0&&(S.search=o.toString()),c!==void 0&&(S.clickAnalytics=c.toString()),l!==void 0&&(S.revenueAnalytics=l.toString()),i!==void 0&&(S.startDate=i.toString()),u!==void 0&&(S.endDate=u.toString()),f!==void 0&&(S.limit=f.toString()),h!==void 0&&(S.offset=h.toString()),y!==void 0&&(S.tags=y.toString());let b={method:"GET",path:p,queryParameters:S,headers:q};return r.request(b,P)},getTopSearches({index:n,clickAnalytics:o,revenueAnalytics:c,startDate:l,endDate:i,orderBy:u,direction:f,limit:h,offset:y,tags:P},p){if(!n)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let q="/2/searches",S={},b={};n!==void 0&&(b.index=n.toString()),o!==void 0&&(b.clickAnalytics=o.toString()),c!==void 0&&(b.revenueAnalytics=c.toString()),l!==void 0&&(b.startDate=l.toString()),i!==void 0&&(b.endDate=i.toString()),u!==void 0&&(b.orderBy=u.toString()),f!==void 0&&(b.direction=f.toString()),h!==void 0&&(b.limit=h.toString()),y!==void 0&&(b.offset=y.toString()),P!==void 0&&(b.tags=P.toString());let C={method:"GET",path:q,queryParameters:b,headers:S};return r.request(C,p)},getUsersCount({index:n,startDate:o,endDate:c,tags:l},i){if(!n)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let u="/2/users/count",f={},h={};n!==void 0&&(h.index=n.toString()),o!==void 0&&(h.startDate=o.toString()),c!==void 0&&(h.endDate=c.toString()),l!==void 0&&(h.tags=l.toString());let y={method:"GET",path:u,queryParameters:h,headers:f};return r.request(y,i)}}}function Le(t,e,s,a){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!ke.includes(s)))throw new Error(`\`region\` must be one of the following: ${ke.join(", ")}`);return Zt({appId:t,apiKey:e,region:s,timeouts:{connect:Qt,read:Kt,write:Xt},requester:Vt(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:he(),requestsCache:he({serializable:!1}),hostsCache:$({caches:[Nt({key:`${$e}-${t}`}),he()]}),...a})}function Je(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function er(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function j(t){let e=[...t.caches],s=e.shift();return s===void 0?er():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>j({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>j({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>j({caches:e}).delete(a))},clear(){return s.clear().catch(()=>j({caches:e}).clear())}}}function te(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var bn=2*60*1e3;var We=1e3,ze=2e3,Fe=3e4;function tr(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function rr(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function nr(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function W(t){let e=[...t.caches],s=e.shift();return s===void 0?nr():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>W({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>W({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>W({caches:e}).delete(a))},clear(){return s.clear().catch(()=>W({caches:e}).clear())}}}function pe(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var Ge=2*60*1e3;function Be(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>Ge}function d(){return e==="timed out"&&Date.now()-s<=Ge}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function F(t,e,s){return(e=sr(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ar(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sr(t){var e=ar(t,"string");return typeof e=="symbol"?e:e+""}var re=class extends Error{constructor(e,s){super(e),F(this,"name","AlgoliaError"),s&&(this.name=s)}},ne=class extends re{constructor(e,s,a){super(e,a),F(this,"stackTrace",void 0),this.stackTrace=s}},Pe=class extends ne{constructor(e){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.",e,"RetryError")}},z=class extends ne{constructor(e,s,a,d="ApiError"){super(e,a,d),F(this,"status",void 0),this.status=s}},ye=class extends re{constructor(e,s){super(e,"DeserializationError"),F(this,"response",void 0),this.response=s}},we=class extends z{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),F(this,"error",void 0),this.error=a}};function or(t,e,s){let a=ir(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function ir(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function cr(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function ur(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function lr(t){try{return JSON.parse(t.content)}catch(e){throw new ye(e.message,t)}}function dr({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new we(a.message,e,a.error,s):new z(a.message,e,s)}catch{}return new z(t,e,s)}function hr({isTimedOut:t,status:e}){return!t&&~~e===0}function mr({isTimedOut:t,status:e}){return t||hr({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function fr({status:t}){return~~(t/100)===2}function gr(t){return t.map(e=>He(e))}function He(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function pr({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(Be(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=cr(i,u),P=ur(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let S=0,b=async(w,R)=>{let E=w.pop();if(E===void 0)throw new Pe(gr(h));let A={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:or(E,i.path,q),connectTimeout:R(S,A.connect),responseTimeout:R(S,f?A.read:A.write)},x=v=>{let N={request:I,response:v,host:E,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(mr(T)){let v=x(T);return T.isTimedOut&&S++,console.log("Retryable failure",He(v)),await e.set(E,Be(E,T.isTimedOut?"timed out":"down")),b(w,R)}if(fr(T))return lr(T);throw x(T),dr(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function Pr(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function yr({algoliaAgents:t,client:e,version:s}){let a=Pr(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var wr=1e3,qr=2e3,Tr=3e4;function Sr(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var Qe="5.2.4",Me=["eu","us"];function Er(t){return[{url:"personalization.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function br({appId:t,apiKey:e,authMode:s,algoliaAgents:a,region:d,...g}){let m=tr(t,e,s),r=pr({hosts:Er(d),...g,algoliaAgent:yr({algoliaAgents:a,client:"Personalization",version:Qe}),baseHeaders:{"content-type":"text/plain",...m.headers(),...g.baseHeaders},baseQueryParameters:{...m.queryParameters(),...g.baseQueryParameters}});return{transporter:r,appId:t,clearCache(){return Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then(()=>{})},get _ua(){return r.algoliaAgent.value},addAlgoliaAgent(n,o){r.algoliaAgent.add({segment:n,version:o})},customDelete({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customDelete`.");let f={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customGet({path:n,parameters:o},c){if(!n)throw new Error("Parameter `path` is required when calling `customGet`.");let f={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return r.request(f,c)},customPost({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPost`.");let h={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},customPut({path:n,parameters:o,body:c},l){if(!n)throw new Error("Parameter `path` is required when calling `customPut`.");let h={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:c||{}};return r.request(h,l)},deleteUserProfile({userToken:n},o){if(!n)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let u={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},getPersonalizationStrategy(n){let i={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return r.request(i,n)},getUserTokenProfile({userToken:n},o){if(!n)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let u={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(n)),queryParameters:{},headers:{}};return r.request(u,o)},setPersonalizationStrategy(n,o){if(!n)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!n.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!n.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!n.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let u={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:n};return r.request(u,o)}}}function Ke(t,e,s,a){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!s||s&&(typeof s!="string"||!Me.includes(s)))throw new Error(`\`region\` is required and must be one of the following: ${Me.join(", ")}`);return br({appId:t,apiKey:e,region:s,timeouts:{connect:wr,read:qr,write:Tr},requester:Sr(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:pe(),requestsCache:pe({serializable:!1}),hostsCache:W({caches:[rr({key:`${Qe}-${t}`}),pe()]}),...a})}function Rr(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function U({func:t,validate:e,aggregator:s,error:a,timeout:d=()=>0}){let g=m=>new Promise((r,n)=>{t(m).then(o=>(s&&s(o),e(o)?r(o):a&&a.validate(o)?n(new Error(a.message(o))):setTimeout(()=>{g(o).then(r).catch(n)},d()))).catch(o=>{n(o)})});return g()}function Ar(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function vr(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function G(t){let e=[...t.caches],s=e.shift();return s===void 0?vr():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>G({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>G({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>G({caches:e}).delete(a))},clear(){return s.clear().catch(()=>G({caches:e}).clear())}}}function qe(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var Xe=2*60*1e3;function Ve(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>Xe}function d(){return e==="timed out"&&Date.now()-s<=Xe}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function M(t,e,s){return(e=Ir(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Or(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ir(t){var e=Or(t,"string");return typeof e=="symbol"?e:e+""}var ae=class extends Error{constructor(e,s){super(e),M(this,"name","AlgoliaError"),s&&(this.name=s)}},se=class extends ae{constructor(e,s,a){super(e,a),M(this,"stackTrace",void 0),this.stackTrace=s}},Te=class extends se{constructor(e){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.",e,"RetryError")}},B=class extends se{constructor(e,s,a,d="ApiError"){super(e,a,d),M(this,"status",void 0),this.status=s}},Se=class extends ae{constructor(e,s){super(e,"DeserializationError"),M(this,"response",void 0),this.response=s}},Ee=class extends B{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),M(this,"error",void 0),this.error=a}};function xr(t){let e=t;for(let s=t.length-1;s>0;s--){let a=Math.floor(Math.random()*(s+1)),d=t[s];e[s]=t[a],e[a]=d}return e}function Nr(t,e,s){let a=Cr(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function Cr(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function Ur(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function jr(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function Dr(t){try{return JSON.parse(t.content)}catch(e){throw new Se(e.message,t)}}function kr({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new Ee(a.message,e,a.error,s):new B(a.message,e,s)}catch{}return new B(t,e,s)}function _r({isTimedOut:t,status:e}){return!t&&~~e===0}function $r({isTimedOut:t,status:e}){return t||_r({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function Lr({status:t}){return~~(t/100)===2}function Jr(t){return t.map(e=>Ye(e))}function Ye(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Wr({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(Ve(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=Ur(i,u),P=jr(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let S=0,b=async(w,R)=>{let E=w.pop();if(E===void 0)throw new Te(Jr(h));let A={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:Nr(E,i.path,q),connectTimeout:R(S,A.connect),responseTimeout:R(S,f?A.read:A.write)},x=v=>{let N={request:I,response:v,host:E,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if($r(T)){let v=x(T);return T.isTimedOut&&S++,console.log("Retryable failure",Ye(v)),await e.set(E,Ve(E,T.isTimedOut?"timed out":"down")),b(w,R)}if(Lr(T))return Dr(T);throw x(T),kr(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function zr(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function Fr({algoliaAgents:t,client:e,version:s}){let a=zr(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var Gr=1e3,Br=2e3,Mr=3e4;function Hr(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var H="5.2.4";function Qr(t){return[{url:`${t}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${t}.algolia.net`,accept:"write",protocol:"https"}].concat(xr([{url:`${t}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Kr({appId:t,apiKey:e,authMode:s,algoliaAgents:a,...d}){let g=Rr(t,e,s),m=Wr({hosts:Qr(t),...d,algoliaAgent:Fr({algoliaAgents:a,client:"Search",version:H}),baseHeaders:{"content-type":"text/plain",...g.headers(),...d.baseHeaders},baseQueryParameters:{...g.queryParameters(),...d.baseQueryParameters}});return{transporter:m,appId:t,clearCache(){return Promise.all([m.requestsCache.clear(),m.responsesCache.clear()]).then(()=>{})},get _ua(){return m.algoliaAgent.value},addAlgoliaAgent(r,n){m.algoliaAgent.add({segment:r,version:n})},waitForTask({indexName:r,taskID:n,maxRetries:o=50,timeout:c=i=>Math.min(i*200,5e3)},l){let i=0;return U({func:()=>this.getTask({indexName:r,taskID:n},l),validate:u=>u.status==="published",aggregator:()=>i+=1,error:{validate:()=>i>=o,message:()=>`The maximum number of retries exceeded. (${i}/${o})`},timeout:()=>c(i)})},waitForAppTask({taskID:r,maxRetries:n=50,timeout:o=l=>Math.min(l*200,5e3)},c){let l=0;return U({func:()=>this.getAppTask({taskID:r},c),validate:i=>i.status==="published",aggregator:()=>l+=1,error:{validate:()=>l>=n,message:()=>`The maximum number of retries exceeded. (${l}/${n})`},timeout:()=>o(l)})},waitForApiKey({operation:r,key:n,apiKey:o,maxRetries:c=50,timeout:l=u=>Math.min(u*200,5e3)},i){let u=0,f={aggregator:()=>u+=1,error:{validate:()=>u>=c,message:()=>`The maximum number of retries exceeded. (${u}/${c})`},timeout:()=>l(u)};if(r==="update"){if(!o)throw new Error("`apiKey` is required when waiting for an `update` operation.");return U({...f,func:()=>this.getApiKey({key:n},i),validate:h=>{for(let y of Object.keys(o)){let P=o[y],p=h[y];if(Array.isArray(P)&&Array.isArray(p)){if(P.length!==p.length||P.some((q,S)=>q!==p[S]))return!1}else if(P!==p)return!1}return!0}})}return U({...f,func:()=>this.getApiKey({key:n},i).catch(h=>{if(h.status!==404)throw h}),validate:h=>r==="add"?h!==void 0:h===void 0})},browseObjects({indexName:r,browseParams:n,...o},c){return U({func:l=>this.browse({indexName:r,browseParams:{cursor:l?l.cursor:void 0,...n}},c),validate:l=>l.cursor===void 0,...o})},browseRules({indexName:r,searchRulesParams:n,...o},c){let l={hitsPerPage:1e3,...n};return U({func:i=>this.searchRules({indexName:r,searchRulesParams:{...l,page:i?i.page+1:l.page||0}},c),validate:i=>i.nbHits<l.hitsPerPage,...o})},browseSynonyms({indexName:r,searchSynonymsParams:n,...o},c){let l={page:0,...n,hitsPerPage:1e3};return U({func:i=>{let u=this.searchSynonyms({indexName:r,searchSynonymsParams:{...l,page:l.page}},c);return l.page+=1,u},validate:i=>i.nbHits<l.hitsPerPage,...o})},async chunkedBatch({indexName:r,objects:n,action:o="addObject",waitForTasks:c,batchSize:l=1e3},i){let u=[],f=[],h=n.entries();for(let[y,P]of h)u.push({action:o,body:P}),(u.length===l||y===n.length-1)&&(f.push(await this.batch({indexName:r,batchWriteParams:{requests:u}},i)),u=[]);if(c)for(let y of f)await this.waitForTask({indexName:r,taskID:y.taskID});return f},async saveObjects({indexName:r,objects:n},o){return await this.chunkedBatch({indexName:r,objects:n,action:"addObject"},o)},async deleteObjects({indexName:r,objectIDs:n},o){return await this.chunkedBatch({indexName:r,objects:n.map(c=>({objectID:c})),action:"deleteObject"},o)},async partialUpdateObjects({indexName:r,objects:n,createIfNotExists:o},c){return await this.chunkedBatch({indexName:r,objects:n,action:o?"partialUpdateObject":"partialUpdateObjectNoCreate"},c)},async replaceAllObjects({indexName:r,objects:n,batchSize:o},c){let l=Math.floor(Math.random()*1e6)+1e5,i=`${r}_tmp_${l}`,u=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:i,scope:["settings","rules","synonyms"]}},c),f=await this.chunkedBatch({indexName:i,objects:n,waitForTasks:!0,batchSize:o},c);await this.waitForTask({indexName:i,taskID:u.taskID}),u=await this.operationIndex({indexName:r,operationIndexParams:{operation:"copy",destination:i,scope:["settings","rules","synonyms"]}},c),await this.waitForTask({indexName:i,taskID:u.taskID});let h=await this.operationIndex({indexName:i,operationIndexParams:{operation:"move",destination:r}},c);return await this.waitForTask({indexName:i,taskID:h.taskID}),{copyOperationResponse:u,batchResponses:f,moveOperationResponse:h}},searchForHits(r,n){return this.search(r,n)},searchForFacets(r,n){return this.search(r,n)},addApiKey(r,n){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 i={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:r};return m.request(i,n)},addOrUpdateObject({indexName:r,objectID:n,body:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!o)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let f={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{},data:o};return m.request(f,c)},appendSource(r,n){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 i={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:r};return m.request(i,n)},assignUserId({xAlgoliaUserID:r,assignUserIdParams:n},o){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!n)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!n.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let c="/1/clusters/mapping",l={},i={};r!==void 0&&(l["X-Algolia-User-ID"]=r.toString());let u={method:"POST",path:c,queryParameters:i,headers:l,data:n};return m.request(u,o)},batch({indexName:r,batchWriteParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!n)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!n.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let u={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},batchAssignUserIds({xAlgoliaUserID:r,batchAssignUserIdsParams:n},o){if(!r)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!n)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!n.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!n.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let c="/1/clusters/mapping/batch",l={},i={};r!==void 0&&(l["X-Algolia-User-ID"]=r.toString());let u={method:"POST",path:c,queryParameters:i,headers:l,data:n};return m.request(u,o)},batchDictionaryEntries({dictionaryName:r,batchDictionaryEntriesParams:n},o){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!n)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!n.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let u={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},browse({indexName:r,browseParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `browse`.");let u={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{}};return m.request(u,o)},clearObjects({indexName:r},n){if(!r)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let i={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},clearRules({indexName:r,forwardToReplicas:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let c="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(r)),l={},i={};n!==void 0&&(i.forwardToReplicas=n.toString());let u={method:"POST",path:c,queryParameters:i,headers:l};return m.request(u,o)},clearSynonyms({indexName:r,forwardToReplicas:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let c="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(r)),l={},i={};n!==void 0&&(i.forwardToReplicas=n.toString());let u={method:"POST",path:c,queryParameters:i,headers:l};return m.request(u,o)},customDelete({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customGet({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customPost({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},customPut({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},deleteApiKey({key:r},n){if(!r)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let i={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},deleteBy({indexName:r,deleteByParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!n)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let u={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},deleteIndex({indexName:r},n){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let i={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},deleteObject({indexName:r,objectID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let u={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},deleteRule({indexName:r,objectID:n,forwardToReplicas:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!n)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let l="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),i={},u={};o!==void 0&&(u.forwardToReplicas=o.toString());let f={method:"DELETE",path:l,queryParameters:u,headers:i};return m.request(f,c)},deleteSource({source:r},n){if(!r)throw new Error("Parameter `source` is required when calling `deleteSource`.");let i={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},deleteSynonym({indexName:r,objectID:n,forwardToReplicas:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!n)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let l="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),i={},u={};o!==void 0&&(u.forwardToReplicas=o.toString());let f={method:"DELETE",path:l,queryParameters:u,headers:i};return m.request(f,c)},getApiKey({key:r},n){if(!r)throw new Error("Parameter `key` is required when calling `getApiKey`.");let i={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},getAppTask({taskID:r},n){if(!r)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let i={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},getDictionaryLanguages(r){let l={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return m.request(l,r)},getDictionarySettings(r){let l={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return m.request(l,r)},getLogs({offset:r,length:n,indexName:o,type:c}={},l=void 0){let i="/1/logs",u={},f={};r!==void 0&&(f.offset=r.toString()),n!==void 0&&(f.length=n.toString()),o!==void 0&&(f.indexName=o.toString()),c!==void 0&&(f.type=c.toString());let h={method:"GET",path:i,queryParameters:f,headers:u};return m.request(h,l)},getObject({indexName:r,objectID:n,attributesToRetrieve:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `getObject`.");let l="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),i={},u={};o!==void 0&&(u.attributesToRetrieve=o.toString());let f={method:"GET",path:l,queryParameters:u,headers:i};return m.request(f,c)},getObjects(r,n){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 i={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},getRule({indexName:r,objectID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!n)throw new Error("Parameter `objectID` is required when calling `getRule`.");let u={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},getSettings({indexName:r},n){if(!r)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let i={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},getSources(r){let l={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return m.request(l,r)},getSynonym({indexName:r,objectID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!n)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let u={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},getTask({indexName:r,taskID:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!n)throw new Error("Parameter `taskID` is required when calling `getTask`.");let u={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{taskID}",encodeURIComponent(n)),queryParameters:{},headers:{}};return m.request(u,o)},getTopUserIds(r){let l={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return m.request(l,r)},getUserId({userID:r},n){if(!r)throw new Error("Parameter `userID` is required when calling `getUserId`.");let i={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},hasPendingMappings({getClusters:r}={},n=void 0){let o="/1/clusters/mapping/pending",c={},l={};r!==void 0&&(l.getClusters=r.toString());let i={method:"GET",path:o,queryParameters:l,headers:c};return m.request(i,n)},listApiKeys(r){let l={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return m.request(l,r)},listClusters(r){let l={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return m.request(l,r)},listIndices({page:r,hitsPerPage:n}={},o=void 0){let c="/1/indexes",l={},i={};r!==void 0&&(i.page=r.toString()),n!==void 0&&(i.hitsPerPage=n.toString());let u={method:"GET",path:c,queryParameters:i,headers:l};return m.request(u,o)},listUserIds({page:r,hitsPerPage:n}={},o=void 0){let c="/1/clusters/mapping",l={},i={};r!==void 0&&(i.page=r.toString()),n!==void 0&&(i.hitsPerPage=n.toString());let u={method:"GET",path:c,queryParameters:i,headers:l};return m.request(u,o)},multipleBatch(r,n){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 i={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:r};return m.request(i,n)},operationIndex({indexName:r,operationIndexParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!n)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!n.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!n.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let u={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},partialUpdateObject({indexName:r,objectID:n,attributesToUpdate:o,createIfNotExists:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!n)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!o)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let i="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),u={},f={};c!==void 0&&(f.createIfNotExists=c.toString());let h={method:"POST",path:i,queryParameters:f,headers:u,data:o};return m.request(h,l)},removeUserId({userID:r},n){if(!r)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let i={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},replaceSources({source:r},n){if(!r)throw new Error("Parameter `source` is required when calling `replaceSources`.");let i={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:r};return m.request(i,n)},restoreApiKey({key:r},n){if(!r)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let i={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{}};return m.request(i,n)},saveObject({indexName:r,body:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!n)throw new Error("Parameter `body` is required when calling `saveObject`.");let u={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)},saveRule({indexName:r,objectID:n,rule:o,forwardToReplicas:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!n)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!o)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!o.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");let i="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),u={},f={};c!==void 0&&(f.forwardToReplicas=c.toString());let h={method:"PUT",path:i,queryParameters:f,headers:u,data:o};return m.request(h,l)},saveRules({indexName:r,rules:n,forwardToReplicas:o,clearExistingRules:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!n)throw new Error("Parameter `rules` is required when calling `saveRules`.");let i="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(r)),u={},f={};o!==void 0&&(f.forwardToReplicas=o.toString()),c!==void 0&&(f.clearExistingRules=c.toString());let h={method:"POST",path:i,queryParameters:f,headers:u,data:n};return m.request(h,l)},saveSynonym({indexName:r,objectID:n,synonymHit:o,forwardToReplicas:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!n)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!o)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!o.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!o.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let i="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{objectID}",encodeURIComponent(n)),u={},f={};c!==void 0&&(f.forwardToReplicas=c.toString());let h={method:"PUT",path:i,queryParameters:f,headers:u,data:o};return m.request(h,l)},saveSynonyms({indexName:r,synonymHit:n,forwardToReplicas:o,replaceExistingSynonyms:c},l){if(!r)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!n)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let i="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(r)),u={},f={};o!==void 0&&(f.forwardToReplicas=o.toString()),c!==void 0&&(f.replaceExistingSynonyms=c.toString());let h={method:"POST",path:i,queryParameters:f,headers:u,data:n};return m.request(h,l)},search(r,n){if(r&&Array.isArray(r)&&(r={requests:r.map(({params:f,...h})=>h.type==="facet"?{...h,...f,type:"facet"}:{...h,...f,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 i={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},searchDictionaryEntries({dictionaryName:r,searchDictionaryEntriesParams:n},o){if(!r)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!n)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!n.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let u={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n,useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchForFacetValues({indexName:r,facetName:n,searchForFacetValuesRequest:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!n)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let f={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(r)).replace("{facetName}",encodeURIComponent(n)),queryParameters:{},headers:{},data:o||{},useReadTransporter:!0,cacheable:!0};return m.request(f,c)},searchRules({indexName:r,searchRulesParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let u={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchSingleIndex({indexName:r,searchParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let u={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchSynonyms({indexName:r,searchSynonymsParams:n},o){if(!r)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let u={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return m.request(u,o)},searchUserIds(r,n){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 i={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},setDictionarySettings(r,n){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 i={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:r};return m.request(i,n)},setSettings({indexName:r,indexSettings:n,forwardToReplicas:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!n)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let l="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(r)),i={},u={};o!==void 0&&(u.forwardToReplicas=o.toString());let f={method:"PUT",path:l,queryParameters:u,headers:i,data:n};return m.request(f,c)},updateApiKey({key:r,apiKey:n},o){if(!r)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!n)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!n.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let u={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(r)),queryParameters:{},headers:{},data:n};return m.request(u,o)}}}function Ze(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return Kr({appId:t,apiKey:e,timeouts:{connect:Gr,read:Br,write:Mr},requester:Hr(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:qe(),requestsCache:qe({serializable:!1}),hostsCache:G({caches:[Ar({key:`${H}-${t}`}),qe()]}),...s})}function Xr(t,e,s="WithinHeaders"){let a={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?a:{}},queryParameters(){return s==="WithinQueryParameters"?a:{}}}}function Vr(t){let e,s=`algolia-client-js-${t.key}`;function a(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function d(){return JSON.parse(a().getItem(s)||"{}")}function g(r){a().setItem(s,JSON.stringify(r))}function m(){let r=t.timeToLive?t.timeToLive*1e3:null,n=d(),o=Object.fromEntries(Object.entries(n).filter(([,l])=>l.timestamp!==void 0));if(g(o),!r)return;let c=Object.fromEntries(Object.entries(o).filter(([,l])=>{let i=new Date().getTime();return!(l.timestamp+r<i)}));g(c)}return{get(r,n,o={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(m(),d()[JSON.stringify(r)])).then(c=>Promise.all([c?c.value:n(),c!==void 0])).then(([c,l])=>Promise.all([c,l||o.miss(c)])).then(([c])=>c)},set(r,n){return Promise.resolve().then(()=>{let o=d();return o[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},a().setItem(s,JSON.stringify(o)),n})},delete(r){return Promise.resolve().then(()=>{let n=d();delete n[JSON.stringify(r)],a().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{a().removeItem(s)})}}}function Yr(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(d=>Promise.all([d,s.miss(d)])).then(([d])=>d)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function Q(t){let e=[...t.caches],s=e.shift();return s===void 0?Yr():{get(a,d,g={miss:()=>Promise.resolve()}){return s.get(a,d,g).catch(()=>Q({caches:e}).get(a,d,g))},set(a,d){return s.set(a,d).catch(()=>Q({caches:e}).set(a,d))},delete(a){return s.delete(a).catch(()=>Q({caches:e}).delete(a))},clear(){return s.clear().catch(()=>Q({caches:e}).clear())}}}function be(t={serializable:!0}){let e={};return{get(s,a,d={miss:()=>Promise.resolve()}){let g=JSON.stringify(s);if(g in e)return Promise.resolve(t.serializable?JSON.parse(e[g]):e[g]);let m=a();return m.then(r=>d.miss(r)).then(()=>m)},set(s,a){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(a):a,Promise.resolve(a)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var et=2*60*1e3;function tt(t,e="up"){let s=Date.now();function a(){return e==="up"||Date.now()-s>et}function d(){return e==="timed out"&&Date.now()-s<=et}return{...t,status:e,lastUpdate:s,isUp:a,isTimedOut:d}}function X(t,e,s){return(e=en(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Zr(t,e){if(typeof t!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var a=s.call(t,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function en(t){var e=Zr(t,"string");return typeof e=="symbol"?e:e+""}var oe=class extends Error{constructor(e,s){super(e),X(this,"name","AlgoliaError"),s&&(this.name=s)}},ie=class extends oe{constructor(e,s,a){super(e,a),X(this,"stackTrace",void 0),this.stackTrace=s}},Re=class extends ie{constructor(e){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.",e,"RetryError")}},K=class extends ie{constructor(e,s,a,d="ApiError"){super(e,a,d),X(this,"status",void 0),this.status=s}},Ae=class extends oe{constructor(e,s){super(e,"DeserializationError"),X(this,"response",void 0),this.response=s}},ve=class extends K{constructor(e,s,a,d){super(e,s,d,"DetailedApiError"),X(this,"error",void 0),this.error=a}};function tn(t){let e=t;for(let s=t.length-1;s>0;s--){let a=Math.floor(Math.random()*(s+1)),d=t[s];e[s]=t[a],e[a]=d}return e}function rn(t,e,s){let a=nn(s),d=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return a.length&&(d+=`?${a}`),d}function nn(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replaceAll("+","%20")}`).join("&")}function an(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function sn(t,e,s){let a={Accept:"application/json",...t,...e,...s},d={};return Object.keys(a).forEach(g=>{let m=a[g];d[g.toLowerCase()]=m}),d}function on(t){try{return JSON.parse(t.content)}catch(e){throw new Ae(e.message,t)}}function cn({content:t,status:e},s){try{let a=JSON.parse(t);return"error"in a?new ve(a.message,e,a.error,s):new K(a.message,e,s)}catch{}return new K(t,e,s)}function un({isTimedOut:t,status:e}){return!t&&~~e===0}function ln({isTimedOut:t,status:e}){return t||un({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function dn({status:t}){return~~(t/100)===2}function hn(t){return t.map(e=>rt(e))}function rt(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function mn({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:a,algoliaAgent:d,timeouts:g,requester:m,requestsCache:r,responsesCache:n}){async function o(i){let u=await Promise.all(i.map(p=>e.get(p,()=>Promise.resolve(tt(p))))),f=u.filter(p=>p.isUp()),h=u.filter(p=>p.isTimedOut()),y=[...f,...h];return{hosts:y.length>0?y:i,getTimeout(p,q){return(h.length===0&&p===0?1:h.length+3+p)*q}}}async function c(i,u,f=!0){let h=[],y=an(i,u),P=sn(s,i.headers,u.headers),p=i.method==="GET"?{...i.data,...u.data}:{},q={...a,...i.queryParameters,...p};if(d.value&&(q["x-algolia-agent"]=d.value),u&&u.queryParameters)for(let w of Object.keys(u.queryParameters))!u.queryParameters[w]||Object.prototype.toString.call(u.queryParameters[w])==="[object Object]"?q[w]=u.queryParameters[w]:q[w]=u.queryParameters[w].toString();let S=0,b=async(w,R)=>{let E=w.pop();if(E===void 0)throw new Re(hn(h));let A={...g,...u.timeouts},I={data:y,headers:P,method:i.method,url:rn(E,i.path,q),connectTimeout:R(S,A.connect),responseTimeout:R(S,f?A.read:A.write)},x=v=>{let N={request:I,response:v,host:E,triesLeft:w.length};return h.push(N),N},T=await m.send(I);if(ln(T)){let v=x(T);return T.isTimedOut&&S++,console.log("Retryable failure",rt(v)),await e.set(E,tt(E,T.isTimedOut?"timed out":"down")),b(w,R)}if(dn(T))return on(T);throw x(T),cn(T,h)},C=t.filter(w=>w.accept==="readWrite"||(f?w.accept==="read":w.accept==="write")),O=await o(C);return b([...O.hosts].reverse(),O.getTimeout)}function l(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return c(i,u,f);let h=()=>c(i,u);if((u.cacheable||i.cacheable)!==!0)return h();let P={request:i,requestOptions:u,transporter:{queryParameters:a,headers:s}};return n.get(P,()=>r.get(P,()=>r.set(P,h()).then(p=>Promise.all([r.delete(P),p]),p=>Promise.all([r.delete(P),Promise.reject(p)])).then(([p,q])=>q)),{miss:p=>n.set(P,p)})}return{hostsCache:e,requester:m,timeouts:g,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:l,requestsCache:r,responsesCache:n}}function fn(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let a=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(a)===-1&&(e.value=`${e.value}${a}`),e}};return e}function gn({algoliaAgents:t,client:e,version:s}){let a=fn(s).add({segment:e,version:s});return t.forEach(d=>a.add(d)),a}var pn=1e3,Pn=2e3,yn=3e4;function wn(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}var nt="5.2.4";function qn(t){return[{url:`${t}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${t}.algolia.net`,accept:"write",protocol:"https"}].concat(tn([{url:`${t}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${t}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function Tn({appId:t,apiKey:e,authMode:s,algoliaAgents:a,...d}){let g=Xr(t,e,s),m=mn({hosts:qn(t),...d,algoliaAgent:gn({algoliaAgents:a,client:"Recommend",version:nt}),baseHeaders:{"content-type":"text/plain",...g.headers(),...d.baseHeaders},baseQueryParameters:{...g.queryParameters(),...d.baseQueryParameters}});return{transporter:m,appId:t,clearCache(){return Promise.all([m.requestsCache.clear(),m.responsesCache.clear()]).then(()=>{})},get _ua(){return m.algoliaAgent.value},addAlgoliaAgent(r,n){m.algoliaAgent.add({segment:r,version:n})},customDelete({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customGet({path:r,parameters:n},o){if(!r)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return m.request(u,o)},customPost({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},customPut({path:r,parameters:n,body:o},c){if(!r)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:o||{}};return m.request(f,c)},deleteRecommendRule({indexName:r,model:n,objectID:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!n)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!o)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let f={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)).replace("{objectID}",encodeURIComponent(o)),queryParameters:{},headers:{}};return m.request(f,c)},getRecommendRule({indexName:r,model:n,objectID:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!n)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!o)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let f={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)).replace("{objectID}",encodeURIComponent(o)),queryParameters:{},headers:{}};return m.request(f,c)},getRecommendStatus({indexName:r,model:n,taskID:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!n)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!o)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let f={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)).replace("{taskID}",encodeURIComponent(o)),queryParameters:{},headers:{}};return m.request(f,c)},getRecommendations(r,n){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 i={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return m.request(i,n)},searchRecommendRules({indexName:r,model:n,searchRecommendRulesParams:o},c){if(!r)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!n)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let f={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(r)).replace("{model}",encodeURIComponent(n)),queryParameters:{},headers:{},data:o||{},useReadTransporter:!0,cacheable:!0};return m.request(f,c)}}}function at(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return Tn({appId:t,apiKey:e,timeouts:{connect:pn,read:Pn,write:yn},requester:wn(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:be(),requestsCache:be({serializable:!1}),hostsCache:Q({caches:[Vr({key:`${nt}-${t}`}),be()]}),...s})}function st(){function t(e){return new Promise(s=>{let a=new XMLHttpRequest;a.open(e.method,e.url,!0),Object.keys(e.headers).forEach(r=>a.setRequestHeader(r,e.headers[r]));let d=(r,n)=>setTimeout(()=>{a.abort(),s({status:0,content:n,isTimedOut:!0})},r),g=d(e.connectTimeout,"Connection timeout"),m;a.onreadystatechange=()=>{a.readyState>a.OPENED&&m===void 0&&(clearTimeout(g),m=d(e.responseTimeout,"Socket timeout"))},a.onerror=()=>{a.status===0&&(clearTimeout(g),clearTimeout(m),s({content:a.responseText||"Network request failed",status:a.status,isTimedOut:!1}))},a.onload=()=>{clearTimeout(g),clearTimeout(m),s({content:a.responseText,status:a.status,isTimedOut:!1})},a.send(e.data)})}return{send:t}}function na(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");function a(r={}){return at(r.appId||t,r.apiKey||e,r.options)}function d(r={}){return Le(r.appId||t,r.apiKey||e,r.region,r.options)}function g(r={}){return Ue(r.appId||t,r.apiKey||e,r.region,r.options)}function m(r){return Ke(r.appId||t,r.apiKey||e,r.region,r.options)}return{...Ze(t,e,{timeouts:{connect:We,read:ze,write:Fe},requester:st(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:te(),requestsCache:te({serializable:!1}),hostsCache:j({caches:[Je({key:`${H}-${t}`}),te()]}),...s}),get _ua(){return this.transporter.algoliaAgent.value},initAbtesting:g,initAnalytics:d,initPersonalization:m,initRecommend:a}}export{Ue as abtestingClient,na as algoliasearch,Le as analyticsClient,H as apiClientVersion,Ke as personalizationClient,at as recommendClient,Ze as searchClient};
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|