algoliasearch 5.51.0 → 5.52.0

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.
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.algoliasearch = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function R(c){let d,l=`algolia-client-js-${c.key}`;function m(){return d===void 0&&(d=c.localStorage||window.localStorage),d}function P(){return JSON.parse(m().getItem(l)||"{}")}function p(t){m().setItem(l,JSON.stringify(t));}function h(){let t=c.timeToLive?c.timeToLive*1e3:null,e=P(),r=Object.fromEntries(Object.entries(e).filter(([,s])=>s.timestamp!==void 0));if(p(r),!t)return;let a=Object.fromEntries(Object.entries(r).filter(([,s])=>{let o=new Date().getTime();return !(s.timestamp+t<o)}));p(a);}return {get(t,e,r={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),P()[JSON.stringify(t)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,s])=>Promise.all([a,s||r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve().then(()=>{let r=P();return r[JSON.stringify(t)]={timestamp:new Date().getTime(),value:e},m().setItem(l,JSON.stringify(r)),e})},delete(t){return Promise.resolve().then(()=>{let e=P();delete e[JSON.stringify(t)],m().setItem(l,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{m().removeItem(l);})}}}function Ae(){return {get(c,d,l={miss:()=>Promise.resolve()}){return d().then(P=>Promise.all([P,l.miss(P)])).then(([P])=>P)},set(c,d){return Promise.resolve(d)},delete(c){return Promise.resolve()},clear(){return Promise.resolve()}}}function v(c){let d=[...c.caches],l=d.shift();return l===void 0?Ae():{get(m,P,p={miss:()=>Promise.resolve()}){return l.get(m,P,p).catch(()=>v({caches:d}).get(m,P,p))},set(m,P){return l.set(m,P).catch(()=>v({caches:d}).set(m,P))},delete(m){return l.delete(m).catch(()=>v({caches:d}).delete(m))},clear(){return l.clear().catch(()=>v({caches:d}).clear())}}}function E(c={serializable:true}){let d={};return {get(l,m,P={miss:()=>Promise.resolve()}){let p=JSON.stringify(l);if(p in d)return Promise.resolve(c.serializable?JSON.parse(d[p]):d[p]);let h=m();return h.then(t=>P.miss(t)).then(()=>h)},set(l,m){return d[JSON.stringify(l)]=c.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(l){return delete d[JSON.stringify(l)],Promise.resolve()},clear(){return d={},Promise.resolve()}}}function be(c){let d={value:`Algolia for JavaScript (${c})`,add(l){let m=`; ${l.segment}${l.version!==void 0?` (${l.version})`:""}`;return d.value.indexOf(m)===-1&&(d.value=`${d.value}${m}`),d}};return d}function I(c,d,l="WithinHeaders"){let m={"x-algolia-api-key":d,"x-algolia-application-id":c};return {headers(){return l==="WithinHeaders"?m:{}},queryParameters(){return l==="WithinQueryParameters"?m:{}}}}function x({func:c,validate:d,aggregator:l,error:m,timeout:P=()=>0}){let p=h=>new Promise((t,e)=>{c(h).then(async r=>(l&&await l(r),await d(r)?t(r):m&&await m.validate(r)?e(new Error(await m.message(r))):setTimeout(()=>{p(r).then(t).catch(e);},await P()))).catch(r=>{e(r);});});return p()}function C({algoliaAgents:c,client:d,version:l}){let m=be(l).add({segment:d,version:l});return c.forEach(P=>m.add(P)),m}function A(){return {debug(c,d){return Promise.resolve()},info(c,d){return Promise.resolve()},error(c,d){return Promise.resolve()}}}var De=750,X=120*1e3;function Y(c,d="up"){let l=Date.now();function m(){return d==="up"||Date.now()-l>X}function P(){return d==="timed out"&&Date.now()-l<=X}return {...c,status:d,lastUpdate:l,isUp:m,isTimedOut:P}}var Z=class extends Error{name="AlgoliaError";constructor(c,d){super(c),d&&(this.name=d);}};var ee=class extends Z{stackTrace;constructor(c,d,l){super(c,l),this.stackTrace=d;}},ke=class extends ee{constructor(c){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",c,"RetryError");}},G=class extends ee{status;constructor(c,d,l,m="ApiError"){super(c,l,m),this.status=d;}},xe=class extends Z{response;constructor(c,d){super(c,"DeserializationError"),this.response=d;}},Oe=class extends G{error;constructor(c,d,l,m){super(c,d,m,"DetailedApiError"),this.error=l;}};function F(c){let d=c;for(let l=c.length-1;l>0;l--){let m=Math.floor(Math.random()*(l+1)),P=c[l];d[l]=c[m],d[m]=P;}return d}function Ue(c,d,l){let m=Ne(l),P=`${c.protocol}://${c.url}${c.port?`:${c.port}`:""}/${d.charAt(0)==="/"?d.substring(1):d}`;return m.length&&(P+=`?${m}`),P}function Ne(c){return Object.keys(c).filter(d=>c[d]!==void 0).sort().map(d=>`${d}=${encodeURIComponent(Object.prototype.toString.call(c[d])==="[object Array]"?c[d].join(","):c[d]).replace(/\+/g,"%20")}`).join("&")}function Be(c,d){if(c.method==="GET"||c.data===void 0&&d.data===void 0)return;let l=Array.isArray(c.data)?c.data:{...c.data,...d.data};return JSON.stringify(l)}function Ge(c,d,l){let m={Accept:"application/json",...c,...d,...l},P={};return Object.keys(m).forEach(p=>{let h=m[p];P[p.toLowerCase()]=h;}),P}function je(c){try{return JSON.parse(c.content)}catch(d){throw new xe(d.message,c)}}function Fe({content:c,status:d},l){try{let m=JSON.parse(c);return "error"in m?new Oe(m.message,d,m.error,l):new G(m.message,d,l)}catch{}return new G(c,d,l)}function Le({isTimedOut:c,status:d}){return !c&&~~d===0}function He({isTimedOut:c,status:d}){return c||Le({isTimedOut:c,status:d})||~~(d/100)!==2&&~~(d/100)!==4}function We({status:c}){return ~~(c/100)===2}function Qe(c){return c.map(d=>re(d))}function re(c){let d=c.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...c,request:{...c.request,headers:{...c.request.headers,...d}}}}function b({hosts:c,hostsCache:d,baseHeaders:l,logger:m,baseQueryParameters:P,algoliaAgent:p,timeouts:h,requester:t,requestsCache:e,responsesCache:r,compress:a,compression:s}){async function o(u){let q=await Promise.all(u.map(y=>d.get(y,()=>Promise.resolve(Y(y))))),g=q.filter(y=>y.isUp()),w=q.filter(y=>y.isTimedOut()),S=[...g,...w];return {hosts:S.length>0?S:u,getTimeout(y,T){return (w.length===0&&y===0?1:w.length+3+y)*T}}}async function n(u,q,g){let w=[],S=Be(u,q),f=Ge(l,u.headers,q.headers),y=s==="gzip"&&S!==void 0&&S.length>De&&(u.method==="POST"||u.method==="PUT");y&&a===void 0&&m.info("Compression is disabled because no compress method is available.");let T=y&&a!==void 0,O=T?await a(S):S;T&&(f["content-encoding"]="gzip");let N=u.method==="GET"?{...u.data,...q.data}:{},j={...P,...u.queryParameters,...N};if(p.value&&(j["x-algolia-agent"]=p.value),q&&q.queryParameters)for(let k of Object.keys(q.queryParameters))!q.queryParameters[k]||Object.prototype.toString.call(q.queryParameters[k])==="[object Object]"?j[k]=q.queryParameters[k]:j[k]=q.queryParameters[k].toString();let L=0,z=async(k,H)=>{let B=k.pop();if(B===void 0)throw new ke(Qe(w));let W={...h,...q.timeouts},M={data:O,headers:f,method:u.method,url:Ue(B,u.path,j),connectTimeout:H(L,W.connect),responseTimeout:H(L,g?W.read:W.write)},J=Q=>{let K={request:M,response:Q,host:B,triesLeft:k.length};return w.push(K),K},U=await t.send(M);if(He(U)){let Q=J(U);return U.isTimedOut&&L++,m.info("Retryable failure",re(Q)),await d.set(B,Y(B,U.isTimedOut?"timed out":"down")),z(k,H)}if(We(U))return je(U);throw J(U),Fe(U,w)},Ce=c.filter(k=>k.accept==="readWrite"||(g?k.accept==="read":k.accept==="write")),_=await o(Ce);return z([..._.hosts].reverse(),_.getTimeout)}function i(u,q={}){let g=()=>n(u,q,w),w=u.useReadTransporter||u.method==="GET";if((q.cacheable||u.cacheable)!==true)return g();let f={request:u,requestOptions:q,transporter:{queryParameters:P,headers:l}};return r.get(f,()=>e.get(f,()=>e.set(f,g()).then(y=>Promise.all([e.delete(f),y]),y=>Promise.all([e.delete(f),Promise.reject(y)])).then(([y,T])=>T)),{miss:y=>r.set(f,y)})}return {hostsCache:d,requester:t,timeouts:h,logger:m,algoliaAgent:p,baseHeaders:l,baseQueryParameters:P,hosts:c,request:i,requestsCache:e,responsesCache:r}}function D(){function c(d){return new Promise(l=>{let m=new XMLHttpRequest;m.open(d.method,d.url,true),Object.keys(d.headers).forEach(t=>m.setRequestHeader(t,d.headers[t]));let P=(t,e)=>setTimeout(()=>{m.abort(),l({status:0,content:e,isTimedOut:true});},t),p=P(d.connectTimeout,"Connection timeout"),h;m.onreadystatechange=()=>{m.readyState>m.OPENED&&h===void 0&&(clearTimeout(p),h=P(d.responseTimeout,"Socket timeout"));},m.onerror=()=>{m.status===0&&(clearTimeout(p),clearTimeout(h),l({content:m.responseText||"Network request failed",status:m.status,isTimedOut:false}));},m.onload=()=>{clearTimeout(p),clearTimeout(h),l({content:m.responseText,status:m.status,isTimedOut:false});},m.send(d.data);})}return {send:c}}var ae="1.17.0",te=["de","us"];function Ve(c){return [{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function $e({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Ve(P),...p,algoliaAgent:C({algoliaAgents:m,client:"AbtestingV3",version:ae}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},addABTests(e,r){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.metrics)throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let n={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let n={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},estimateABTest(e,r){if(!e)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!e.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!e.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let n={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:e};return t.request(n,r)},getABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let n={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTimeseries({id:e,startDate:r,endDate:a,metric:s},o){if(!e)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let n="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(e)),i={},u={};r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.metric=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},listABTests({offset:e,limit:r,indexPrefix:a,indexSuffix:s,direction:o}={},n=void 0){let i="/3/abtests",u={},q={};e!==void 0&&(q.offset=e.toString()),r!==void 0&&(q.limit=r.toString()),a!==void 0&&(q.indexPrefix=a.toString()),s!==void 0&&(q.indexSuffix=s.toString()),o!==void 0&&(q.direction=o.toString());let g={method:"GET",path:i,queryParameters:q,headers:u};return t.request(g,n)},stopABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let n={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)}}}function se(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!te.includes(l)))throw new Error(`\`region\` must be one of the following: ${te.join(", ")}`);let{compression:P,...p}=m||{};return $e({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${ae}-${c}`}),E()]}),...p})}var oe="5.51.0",ne=["de","us"];function ze(c){return [{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function _e({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:ze(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Abtesting",version:oe}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},addABTests(e,r){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let n={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let n={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},estimateABTest(e,r){if(!e)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!e.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!e.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let n={method:"POST",path:"/2/abtests/estimate",queryParameters:{},headers:{},data:e};return t.request(n,r)},getABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let n={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},listABTests({offset:e,limit:r,indexPrefix:a,indexSuffix:s}={},o=void 0){let n="/2/abtests",i={},u={};e!==void 0&&(u.offset=e.toString()),r!==void 0&&(u.limit=r.toString()),a!==void 0&&(u.indexPrefix=a.toString()),s!==void 0&&(u.indexSuffix=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},stopABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let n={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)}}}function ie(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!ne.includes(l)))throw new Error(`\`region\` must be one of the following: ${ne.join(", ")}`);let{compression:P,...p}=m||{};return _e({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${oe}-${c}`}),E()]}),...p})}var ue="5.51.0",ce=["de","us"];function Me(c){return [{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Je({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Me(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Analytics",version:ue}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},getAddToCartRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let n="/2/conversions/addToCartRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getAverageClickPosition({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let n="/2/clicks/averageClickPosition",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getClickPositions({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let n="/2/clicks/positions",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getClickThroughRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let n="/2/clicks/clickThroughRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getConversionRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let n="/2/conversions/conversionRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getNoClickRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let n="/2/searches/noClickRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getNoResultsRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let n="/2/searches/noResultRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getPurchaseRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let n="/2/conversions/purchaseRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getRevenue({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let n="/2/conversions/revenue",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getSearchesCount({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let n="/2/searches/count",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getSearchesNoClicks({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let u="/2/searches/noClicks",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getSearchesNoResults({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let u="/2/searches/noResults",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getStatus({index:e},r){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",s={},o={};e!==void 0&&(o.index=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return t.request(n,r)},getTopCountries({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let u="/2/countries",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getTopFilterAttributes({index:e,search:r,startDate:a,endDate:s,limit:o,offset:n,tags:i},u){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let q="/2/filters",g={},w={};e!==void 0&&(w.index=e.toString()),r!==void 0&&(w.search=r.toString()),a!==void 0&&(w.startDate=a.toString()),s!==void 0&&(w.endDate=s.toString()),o!==void 0&&(w.limit=o.toString()),n!==void 0&&(w.offset=n.toString()),i!==void 0&&(w.tags=i.toString());let S={method:"GET",path:q,queryParameters:w,headers:g};return t.request(S,u)},getTopFilterForAttribute({attribute:e,index:r,search:a,startDate:s,endDate:o,limit:n,offset:i,tags:u},q){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!r)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let g="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),w={},S={};r!==void 0&&(S.index=r.toString()),a!==void 0&&(S.search=a.toString()),s!==void 0&&(S.startDate=s.toString()),o!==void 0&&(S.endDate=o.toString()),n!==void 0&&(S.limit=n.toString()),i!==void 0&&(S.offset=i.toString()),u!==void 0&&(S.tags=u.toString());let f={method:"GET",path:g,queryParameters:S,headers:w};return t.request(f,q)},getTopFiltersNoResults({index:e,search:r,startDate:a,endDate:s,limit:o,offset:n,tags:i},u){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let q="/2/filters/noResults",g={},w={};e!==void 0&&(w.index=e.toString()),r!==void 0&&(w.search=r.toString()),a!==void 0&&(w.startDate=a.toString()),s!==void 0&&(w.endDate=s.toString()),o!==void 0&&(w.limit=o.toString()),n!==void 0&&(w.offset=n.toString()),i!==void 0&&(w.tags=i.toString());let S={method:"GET",path:q,queryParameters:w,headers:g};return t.request(S,u)},getTopHits({index:e,search:r,clickAnalytics:a,revenueAnalytics:s,startDate:o,endDate:n,limit:i,offset:u,tags:q},g){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");let w="/2/hits",S={},f={};e!==void 0&&(f.index=e.toString()),r!==void 0&&(f.search=r.toString()),a!==void 0&&(f.clickAnalytics=a.toString()),s!==void 0&&(f.revenueAnalytics=s.toString()),o!==void 0&&(f.startDate=o.toString()),n!==void 0&&(f.endDate=n.toString()),i!==void 0&&(f.limit=i.toString()),u!==void 0&&(f.offset=u.toString()),q!==void 0&&(f.tags=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},getTopSearches({index:e,clickAnalytics:r,revenueAnalytics:a,startDate:s,endDate:o,orderBy:n,direction:i,limit:u,offset:q,tags:g},w){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let S="/2/searches",f={},y={};e!==void 0&&(y.index=e.toString()),r!==void 0&&(y.clickAnalytics=r.toString()),a!==void 0&&(y.revenueAnalytics=a.toString()),s!==void 0&&(y.startDate=s.toString()),o!==void 0&&(y.endDate=o.toString()),n!==void 0&&(y.orderBy=n.toString()),i!==void 0&&(y.direction=i.toString()),u!==void 0&&(y.limit=u.toString()),q!==void 0&&(y.offset=q.toString()),g!==void 0&&(y.tags=g.toString());let T={method:"GET",path:S,queryParameters:y,headers:f};return t.request(T,w)},getUsersCount({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let n="/2/users/count",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)}}}function he(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!ce.includes(l)))throw new Error(`\`region\` must be one of the following: ${ce.join(", ")}`);let{compression:P,...p}=m||{};return Je({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${ue}-${c}`}),E()]}),...p})}var le="5.51.0",de=["de","us"];function Ke(c){return [{url:c?"insights.{region}.algolia.io".replace("{region}",c):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function Xe({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Ke(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Insights",version:le}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteUserToken({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let n={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},pushEvents(e,r){if(!e)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!e.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let n={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:e};return t.request(n,r)}}}function me(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!de.includes(l)))throw new Error(`\`region\` must be one of the following: ${de.join(", ")}`);let{compression:P,...p}=m||{};return Xe({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${le}-${c}`}),E()]}),...p})}var ge="5.51.0",qe=["eu","us"];function Ye(c){return [{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function Ze({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Ye(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Personalization",version:ge}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteUserProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let n={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getPersonalizationStrategy(e){let o={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return t.request(o,e)},getUserTokenProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let n={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},setPersonalizationStrategy(e,r){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventsScoring)throw new Error("Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetsScoring)throw new Error("Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let n={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return t.request(n,r)}}}function Pe(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!qe.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${qe.join(", ")}`);let{compression:P,...p}=m||{};return Ze({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${ge}-${c}`}),E()]}),...p})}var we="5.51.0",pe=["eu","us"];function er(c){return [{url:"query-suggestions.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function rr({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:er(P),...p,algoliaAgent:C({algoliaAgents:m,client:"QuerySuggestions",version:we}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},createConfig(e,r){if(!e)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let n={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteConfig({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let n={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getAllConfigs(e){let o={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return t.request(o,e)},getConfig({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let n={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getConfigStatus({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let n={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getLogFile({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let n={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},updateConfig({indexName:e,configuration:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!r)throw new Error("Parameter `configuration` is required when calling `updateConfig`.");if(!r.sourceIndices)throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");let i={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)}}}function fe(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!pe.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${pe.join(", ")}`);let{compression:P,...p}=m||{};return rr({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${we}-${c}`}),E()]}),...p})}var V="5.51.0";function tr(c){return [{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${c}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ar({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=I(c,d,l),h=b({hosts:tr(c),...P,algoliaAgent:C({algoliaAgents:m,client:"Search",version:V}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return {transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e});},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t;},waitForTask({indexName:t,taskID:e,maxRetries:r=100,timeout:a=o=>Math.min(o*200,5e3)},s){let o=0;return x({func:()=>this.getTask({indexName:t,taskID:e},s),validate:n=>n.status==="published",aggregator:()=>o+=1,error:{validate:()=>o>=r,message:()=>`Stopped waiting for the task after ${r} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>a(o)})},waitForAppTask({taskID:t,maxRetries:e=100,timeout:r=s=>Math.min(s*200,5e3)},a){let s=0;return x({func:()=>this.getAppTask({taskID:t},a),validate:o=>o.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=e,message:()=>`Stopped waiting for the task after ${e} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>r(s)})},waitForApiKey({operation:t,key:e,apiKey:r,maxRetries:a=100,timeout:s=n=>Math.min(n*200,5e3)},o){let n=0,i={aggregator:()=>n+=1,error:{validate:()=>n>=a,message:()=>`Stopped waiting for the API key operation after ${a} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>s(n)};if(t==="update"){if(!r)throw new Error("`apiKey` is required when waiting for an `update` operation.");return x({...i,func:()=>this.getApiKey({key:e},o),validate:u=>{for(let q of Object.keys(r)){let g=r[q],w=u[q];if(Array.isArray(g)&&Array.isArray(w)){if(g.length!==w.length||g.some((S,f)=>S!==w[f]))return false}else if(g!==w)return false}return true}})}return x({...i,func:()=>this.getApiKey({key:e},o).catch(u=>{if(u.status!==404)throw u}),validate:u=>t==="add"?u!==void 0:u===void 0})},browseObjects({indexName:t,browseParams:e,...r},a){return x({func:s=>this.browse({indexName:t,browseParams:{cursor:s?s.cursor:void 0,hitsPerPage:1e3,...e}},a),validate:s=>s.cursor===void 0,...r})},browseRules({indexName:t,searchRulesParams:e,...r},a){let s={...e,hitsPerPage:e?.hitsPerPage||1e3};return x({func:o=>this.searchRules({indexName:t,searchRulesParams:{...s,page:o?o.page+1:s.page||0}},a),validate:o=>o.hits.length<s.hitsPerPage,...r})},browseSynonyms({indexName:t,searchSynonymsParams:e,...r},a){let s={...e,page:e?.page||0,hitsPerPage:1e3};return x({func:o=>{let n=this.searchSynonyms({indexName:t,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,n},validate:o=>o.hits.length<s.hitsPerPage,...r})},async chunkedBatch({indexName:t,objects:e,action:r="addObject",waitForTasks:a,batchSize:s=1e3},o){let n=[],i=[],u=e.entries();for(let[q,g]of u)n.push({action:r,body:g}),(n.length===s||q===e.length-1)&&(i.push(await this.batch({indexName:t,batchWriteParams:{requests:n}},o)),n=[]);if(a)for(let q of i)await this.waitForTask({indexName:t,taskID:q.taskID});return i},async saveObjects({indexName:t,objects:e,waitForTasks:r,batchSize:a},s){return await this.chunkedBatch({indexName:t,objects:e,action:"addObject",waitForTasks:r,batchSize:a},s)},async deleteObjects({indexName:t,objectIDs:e,waitForTasks:r,batchSize:a},s){return await this.chunkedBatch({indexName:t,objects:e.map(o=>({objectID:o})),action:"deleteObject",waitForTasks:r,batchSize:a},s)},async partialUpdateObjects({indexName:t,objects:e,createIfNotExists:r,waitForTasks:a,batchSize:s},o){return await this.chunkedBatch({indexName:t,objects:e,action:r?"partialUpdateObject":"partialUpdateObjectNoCreate",batchSize:s,waitForTasks:a},o)},async replaceAllObjects({indexName:t,objects:e,batchSize:r,scopes:a},s){let o=Math.floor(Math.random()*1e6)+1e5,n=`${t}_tmp_${o}`;a===void 0&&(a=["settings","rules","synonyms"]);try{let i=await this.operationIndex({indexName:t,operationIndexParams:{operation:"copy",destination:n,scope:a}},s),u=await this.chunkedBatch({indexName:n,objects:e,waitForTasks:!0,batchSize:r},s);await this.waitForTask({indexName:n,taskID:i.taskID}),i=await this.operationIndex({indexName:t,operationIndexParams:{operation:"copy",destination:n,scope:a}},s),await this.waitForTask({indexName:n,taskID:i.taskID});let q=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:t}},s);return await this.waitForTask({indexName:n,taskID:q.taskID}),{copyOperationResponse:i,batchResponses:u,moveOperationResponse:q}}catch(i){throw await this.deleteIndex({indexName:n}),i}},async indexExists({indexName:t}){try{await this.getSettings({indexName:t});}catch(e){if(e instanceof G&&e.status===404)return false;throw e}return true},searchForHits(t,e){return this.search(t,e)},searchForFacets(t,e){return this.search(t,e)},addApiKey(t,e){if(!t)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!t.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let o={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:t};return h.request(o,e)},addOrUpdateObject({indexName:t,objectID:e,body:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let i={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return h.request(i,a)},appendSource(t,e){if(!t)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!t.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let o={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:t};return h.request(o,e)},assignUserId({xAlgoliaUserID:t,assignUserIdParams:e},r){if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!e)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!e.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let a="/1/clusters/mapping",s={},o={};t!==void 0&&(s["X-Algolia-User-ID"]=t.toString());let n={method:"POST",path:a,queryParameters:o,headers:s,data:e};return h.request(n,r)},batch({indexName:t,batchWriteParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!e)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!e.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},batchAssignUserIds({xAlgoliaUserID:t,batchAssignUserIdsParams:e},r){if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!e)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!e.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!e.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let a="/1/clusters/mapping/batch",s={},o={};t!==void 0&&(s["X-Algolia-User-ID"]=t.toString());let n={method:"POST",path:a,queryParameters:o,headers:s,data:e};return h.request(n,r)},batchDictionaryEntries({dictionaryName:t,batchDictionaryEntriesParams:e},r){if(!t)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!e)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!e.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},browse({indexName:t,browseParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `browse`.");let n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true};return h.request(n,r)},clearObjects({indexName:t},e){if(!t)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let o={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},clearRules({indexName:t,forwardToReplicas:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.forwardToReplicas=e.toString());let n={method:"POST",path:a,queryParameters:o,headers:s};return h.request(n,r)},clearSynonyms({indexName:t,forwardToReplicas:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.forwardToReplicas=e.toString());let n={method:"POST",path:a,queryParameters:o,headers:s};return h.request(n,r)},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},deleteApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let o={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteBy({indexName:t,deleteByParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!e)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},deleteIndex({indexName:t},e){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let o={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteObject({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},deleteRule({indexName:t,objectID:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"DELETE",path:s,queryParameters:n,headers:o};return h.request(i,a)},deleteSource({source:t},e){if(!t)throw new Error("Parameter `source` is required when calling `deleteSource`.");let o={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteSynonym({indexName:t,objectID:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"DELETE",path:s,queryParameters:n,headers:o};return h.request(i,a)},getApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `getApiKey`.");let o={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getAppTask({taskID:t},e){if(!t)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let o={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getDictionaryLanguages(t){let s={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return h.request(s,t)},getDictionarySettings(t){let s={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return h.request(s,t)},getLogs({offset:t,length:e,indexName:r,type:a}={},s=void 0){let o="/1/logs",n={},i={};t!==void 0&&(i.offset=t.toString()),e!==void 0&&(i.length=e.toString()),r!==void 0&&(i.indexName=r.toString()),a!==void 0&&(i.type=a.toString());let u={method:"GET",path:o,queryParameters:i,headers:n};return h.request(u,s)},getObject({indexName:t,objectID:e,attributesToRetrieve:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getObject`.");let s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.attributesToRetrieve=r.toString());let i={method:"GET",path:s,queryParameters:n,headers:o};return h.request(i,a)},getObjects(t,e){if(!t)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!t.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let o={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},getRule({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getRule`.");let n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getSettings({indexName:t,getVersion:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.getVersion=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},getSources(t){let s={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return h.request(s,t)},getSynonym({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getTask({indexName:t,taskID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(t)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getTopUserIds(t){let s={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return h.request(s,t)},getUserId({userID:t},e){if(!t)throw new Error("Parameter `userID` is required when calling `getUserId`.");let o={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},hasPendingMappings({getClusters:t}={},e=void 0){let r="/1/clusters/mapping/pending",a={},s={};t!==void 0&&(s.getClusters=t.toString());let o={method:"GET",path:r,queryParameters:s,headers:a};return h.request(o,e)},listApiKeys(t){let s={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return h.request(s,t)},listClusters(t){let s={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return h.request(s,t)},listIndices({page:t,hitsPerPage:e}={},r=void 0){let a="/1/indexes",s={},o={};t!==void 0&&(o.page=t.toString()),e!==void 0&&(o.hitsPerPage=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},listUserIds({page:t,hitsPerPage:e}={},r=void 0){let a="/1/clusters/mapping",s={},o={};t!==void 0&&(o.page=t.toString()),e!==void 0&&(o.hitsPerPage=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},multipleBatch(t,e){if(!t)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!t.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let o={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:t};return h.request(o,e)},operationIndex({indexName:t,operationIndexParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!e)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!e.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!e.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},partialUpdateObject({indexName:t,objectID:e,attributesToUpdate:r,createIfNotExists:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let o="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.createIfNotExists=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},removeUserId({userID:t},e){if(!t)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let o={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},replaceSources({source:t},e){if(!t)throw new Error("Parameter `source` is required when calling `replaceSources`.");let o={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:t};return h.request(o,e)},restoreApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let o={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},saveObject({indexName:t,body:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!e)throw new Error("Parameter `body` is required when calling `saveObject`.");let n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},saveRule({indexName:t,objectID:e,rule:r,forwardToReplicas:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!r.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");if(!r.consequence)throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");let o="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.forwardToReplicas=a.toString());let u={method:"PUT",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},saveRules({indexName:t,rules:e,forwardToReplicas:r,clearExistingRules:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!e)throw new Error("Parameter `rules` is required when calling `saveRules`.");let o="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(t)),n={},i={};r!==void 0&&(i.forwardToReplicas=r.toString()),a!==void 0&&(i.clearExistingRules=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:e};return h.request(u,s)},saveSynonym({indexName:t,objectID:e,synonymHit:r,forwardToReplicas:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!r.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!r.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let o="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.forwardToReplicas=a.toString());let u={method:"PUT",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},saveSynonyms({indexName:t,synonymHit:e,forwardToReplicas:r,replaceExistingSynonyms:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!e)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let o="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(t)),n={},i={};r!==void 0&&(i.forwardToReplicas=r.toString()),a!==void 0&&(i.replaceExistingSynonyms=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:e};return h.request(u,s)},search(t,e){if(t&&Array.isArray(t)&&(t={requests:t.map(({params:i,...u})=>u.type==="facet"?{...u,...i,type:"facet"}:{...u,...i,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!t)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!t.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let o={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},searchDictionaryEntries({dictionaryName:t,searchDictionaryEntriesParams:e},r){if(!t)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!e)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!e.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e,useReadTransporter:true,cacheable:true};return h.request(n,r)},searchForFacetValues({indexName:t,facetName:e,searchForFacetValuesRequest:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!e)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let i={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(t)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:true,cacheable:true};return h.request(i,a)},searchRules({indexName:t,searchRulesParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true,cacheable:true};return h.request(n,r)},searchSingleIndex({indexName:t,searchParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true,cacheable:true};return h.request(n,r)},searchSynonyms({indexName:t,searchSynonymsParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let n={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true,cacheable:true};return h.request(n,r)},searchUserIds(t,e){if(!t)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!t.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let o={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},setDictionarySettings(t,e){if(!t)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!t.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let o={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:t};return h.request(o,e)},setSettings({indexName:t,indexSettings:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!e)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"PUT",path:s,queryParameters:n,headers:o,data:e};return h.request(i,a)},updateApiKey({key:t,apiKey:e},r){if(!t)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!e)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)}}}function ye(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ar({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${V}-${c}`}),E()]}),...P})}var Se="1.51.0",Ee=["eu","us"];function sr(c){return [{url:"data.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function Jr(c){return c.type==="onDemand"}function Kr(c){return c.type==="schedule"}function Xr(c){return c.type==="subscription"}function nr({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:sr(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Ingestion",version:Se}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},async chunkedPush({indexName:e,objects:r,action:a="addObject",waitForTasks:s,batchSize:o=1e3,referenceIndexName:n},i){let u=[],q=0,g=[],w=Math.floor(o/10)||o,S=r.entries();for(let[f,y]of S)if(u.push(y),(u.length===o||f===r.length-1)&&(g.push(await this.push({indexName:e,pushTaskPayload:{action:a,records:u},referenceIndexName:n},i)),u=[]),s&&g.length>0&&(g.length%w===0||f===r.length-1)){for(let T of g.slice(q,q+w)){if(!T.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let O=0;await x({func:async()=>{if(T.eventID===void 0||!T.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:T.runID,eventID:T.eventID}).catch(N=>{if(N.status!==404)throw N})},validate:N=>N!==void 0,aggregator:()=>O+=1,error:{validate:()=>O>=50,message:()=>`The maximum number of retries exceeded. (${O}/50)`},timeout:()=>Math.min(O*500,5e3)});}q+=w;}return g},createAuthentication(e,r){if(!e)throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");if(!e.type)throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");if(!e.name)throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");if(!e.input)throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");let n={method:"POST",path:"/1/authentications",queryParameters:{},headers:{},data:e};return t.request(n,r)},createDestination(e,r){if(!e)throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");if(!e.type)throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");if(!e.name)throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");if(!e.input)throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");let n={method:"POST",path:"/1/destinations",queryParameters:{},headers:{},data:e};return t.request(n,r)},createSource(e,r){if(!e)throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");if(!e.type)throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");if(!e.name)throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");let n={method:"POST",path:"/1/sources",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTask(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTask`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");let n={method:"POST",path:"/2/tasks",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTaskV1(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");if(!e.trigger)throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");let n={method:"POST",path:"/1/tasks",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTransformation(e,r){if(!e)throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");if(!e.name)throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");let n={method:"POST",path:"/1/transformations",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");let n={method:"DELETE",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");let n={method:"DELETE",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");let n={method:"DELETE",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTask`.");let n={method:"DELETE",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");let n={method:"DELETE",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");let n={method:"DELETE",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},disableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTask`.");let n={method:"PUT",path:"/2/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},disableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");let n={method:"PUT",path:"/1/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},enableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTask`.");let n={method:"PUT",path:"/2/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},enableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");let n={method:"PUT",path:"/1/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");let n={method:"GET",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `getDestination`.");let n={method:"GET",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getEvent({runID:e,eventID:r},a){if(!e)throw new Error("Parameter `runID` is required when calling `getEvent`.");if(!r)throw new Error("Parameter `eventID` is required when calling `getEvent`.");let i={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return t.request(i,a)},getRun({runID:e},r){if(!e)throw new Error("Parameter `runID` is required when calling `getRun`.");let n={method:"GET",path:"/1/runs/{runID}".replace("{runID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `getSource`.");let n={method:"GET",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");let n={method:"GET",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");let n={method:"GET",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},listAuthentications({itemsPerPage:e,page:r,type:a,platform:s,sort:o,order:n}={},i=void 0){let u="/1/authentications",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),r!==void 0&&(g.page=r.toString()),a!==void 0&&(g.type=a.toString()),s!==void 0&&(g.platform=s.toString()),o!==void 0&&(g.sort=o.toString()),n!==void 0&&(g.order=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},listDestinations({itemsPerPage:e,page:r,type:a,authenticationID:s,transformationID:o,sort:n,order:i}={},u=void 0){let q="/1/destinations",g={},w={};e!==void 0&&(w.itemsPerPage=e.toString()),r!==void 0&&(w.page=r.toString()),a!==void 0&&(w.type=a.toString()),s!==void 0&&(w.authenticationID=s.toString()),o!==void 0&&(w.transformationID=o.toString()),n!==void 0&&(w.sort=n.toString()),i!==void 0&&(w.order=i.toString());let S={method:"GET",path:q,queryParameters:w,headers:g};return t.request(S,u)},listEvents({runID:e,itemsPerPage:r,page:a,status:s,type:o,sort:n,order:i,startDate:u,endDate:q},g){if(!e)throw new Error("Parameter `runID` is required when calling `listEvents`.");let w="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),S={},f={};r!==void 0&&(f.itemsPerPage=r.toString()),a!==void 0&&(f.page=a.toString()),s!==void 0&&(f.status=s.toString()),o!==void 0&&(f.type=o.toString()),n!==void 0&&(f.sort=n.toString()),i!==void 0&&(f.order=i.toString()),u!==void 0&&(f.startDate=u.toString()),q!==void 0&&(f.endDate=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},listRuns({itemsPerPage:e,page:r,status:a,type:s,taskID:o,sort:n,order:i,startDate:u,endDate:q}={},g=void 0){let w="/1/runs",S={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),a!==void 0&&(f.status=a.toString()),s!==void 0&&(f.type=s.toString()),o!==void 0&&(f.taskID=o.toString()),n!==void 0&&(f.sort=n.toString()),i!==void 0&&(f.order=i.toString()),u!==void 0&&(f.startDate=u.toString()),q!==void 0&&(f.endDate=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},listSources({itemsPerPage:e,page:r,type:a,authenticationID:s,sort:o,order:n}={},i=void 0){let u="/1/sources",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),r!==void 0&&(g.page=r.toString()),a!==void 0&&(g.type=a.toString()),s!==void 0&&(g.authenticationID=s.toString()),o!==void 0&&(g.sort=o.toString()),n!==void 0&&(g.order=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},listTasks({itemsPerPage:e,page:r,action:a,enabled:s,sourceID:o,sourceType:n,destinationID:i,triggerType:u,withEmailNotifications:q,sort:g,order:w}={},S=void 0){let f="/2/tasks",y={},T={};e!==void 0&&(T.itemsPerPage=e.toString()),r!==void 0&&(T.page=r.toString()),a!==void 0&&(T.action=a.toString()),s!==void 0&&(T.enabled=s.toString()),o!==void 0&&(T.sourceID=o.toString()),n!==void 0&&(T.sourceType=n.toString()),i!==void 0&&(T.destinationID=i.toString()),u!==void 0&&(T.triggerType=u.toString()),q!==void 0&&(T.withEmailNotifications=q.toString()),g!==void 0&&(T.sort=g.toString()),w!==void 0&&(T.order=w.toString());let O={method:"GET",path:f,queryParameters:T,headers:y};return t.request(O,S)},listTasksV1({itemsPerPage:e,page:r,action:a,enabled:s,sourceID:o,destinationID:n,triggerType:i,sort:u,order:q}={},g=void 0){let w="/1/tasks",S={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),a!==void 0&&(f.action=a.toString()),s!==void 0&&(f.enabled=s.toString()),o!==void 0&&(f.sourceID=o.toString()),n!==void 0&&(f.destinationID=n.toString()),i!==void 0&&(f.triggerType=i.toString()),u!==void 0&&(f.sort=u.toString()),q!==void 0&&(f.order=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},listTransformations({itemsPerPage:e,page:r,sort:a,order:s,type:o}={},n=void 0){let i="/1/transformations",u={},q={};e!==void 0&&(q.itemsPerPage=e.toString()),r!==void 0&&(q.page=r.toString()),a!==void 0&&(q.sort=a.toString()),s!==void 0&&(q.order=s.toString()),o!==void 0&&(q.type=o.toString());let g={method:"GET",path:i,queryParameters:q,headers:u};return t.request(g,n)},push({indexName:e,pushTaskPayload:r,watch:a,referenceIndexName:s},o){if(!e)throw new Error("Parameter `indexName` is required when calling `push`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");let n="/1/push/{indexName}".replace("{indexName}",encodeURIComponent(e)),i={},u={};a!==void 0&&(u.watch=a.toString()),s!==void 0&&(u.referenceIndexName=s.toString());let q={method:"POST",path:n,queryParameters:u,headers:i,data:r};return o={timeouts:{connect:18e4,read:18e4,write:18e4,...o?.timeouts}},t.request(q,o)},pushTask({taskID:e,pushTaskPayload:r,watch:a},s){if(!e)throw new Error("Parameter `taskID` is required when calling `pushTask`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");let o="/2/tasks/{taskID}/push".replace("{taskID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.watch=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:r};return s={timeouts:{connect:18e4,read:18e4,write:18e4,...s?.timeouts}},t.request(u,s)},replaceTask({taskID:e,taskReplace:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `replaceTask`.");if(!r)throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");if(!r.destinationID)throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");if(!r.action)throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");let i={method:"PUT",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},runSource({sourceID:e,runSourcePayload:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `runSource`.");let i={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},runTask({taskID:e,runTaskPayload:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `runTask`.");let i={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},runTaskV1({taskID:e,runTaskPayload:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");let i={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},searchAuthentications(e,r){if(!e)throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");if(!e.authenticationIDs)throw new Error("Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`.");let n={method:"POST",path:"/1/authentications/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchDestinations(e,r){if(!e)throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");if(!e.destinationIDs)throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");let n={method:"POST",path:"/1/destinations/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchSources(e,r){if(!e)throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");if(!e.sourceIDs)throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");let n={method:"POST",path:"/1/sources/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTasks(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");let n={method:"POST",path:"/2/tasks/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTasksV1(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");let n={method:"POST",path:"/1/tasks/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTransformations(e,r){if(!e)throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");if(!e.transformationIDs)throw new Error("Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`.");let n={method:"POST",path:"/1/transformations/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},triggerDockerSourceDiscover({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");let n={method:"POST",path:"/1/sources/{sourceID}/discover".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},t.request(n,r)},tryTransformation(e,r){if(!e)throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");if(!e.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");let n={method:"POST",path:"/1/transformations/try",queryParameters:{},headers:{},data:e};return t.request(n,r)},tryTransformationBeforeUpdate({transformationID:e,transformationTry:r},a){if(!e)throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");if(!r)throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");if(!r.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.");let i={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateAuthentication({authenticationID:e,authenticationUpdate:r},a){if(!e)throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");if(!r)throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");let i={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateDestination({destinationID:e,destinationUpdate:r},a){if(!e)throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");if(!r)throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");let i={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateSource({sourceID:e,sourceUpdate:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `updateSource`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");let i={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTask({taskID:e,taskUpdate:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTask`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");let i={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTaskV1({taskID:e,taskUpdate:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");let i={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTransformation({transformationID:e,transformationCreate:r},a){if(!e)throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");if(!r)throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");if(!r.name)throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");let i={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},validateSource(e,r=void 0){let n={method:"POST",path:"/1/sources/validate",queryParameters:{},headers:{},data:e||{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},t.request(n,r)},validateSourceBeforeUpdate({sourceID:e,sourceUpdate:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");let i={method:"POST",path:"/1/sources/{sourceID}/validate".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return a={timeouts:{connect:18e4,read:18e4,write:18e4,...a?.timeouts}},t.request(i,a)}}}function $(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!Ee.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${Ee.join(", ")}`);let{compression:P,...p}=m||{};return nr({appId:c,apiKey:d,region:l,timeouts:{connect:25e3,read:25e3,write:25e3},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${Se}-${c}`}),E()]}),...p})}var Te="1.51.0";function or(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function ir({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=I(c,d,l),h=b({hosts:or(),...P,algoliaAgent:C({algoliaAgents:m,client:"Monitoring",version:Te}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return {transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e});},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t;},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},getClusterIncidents({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let o={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getClusterStatus({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let o={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getIncidents(t){let s={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return h.request(s,t)},getIndexingTime({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let o={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getLatency({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let o={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getMetrics({metric:t,period:e},r){if(!t)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!e)throw new Error("Parameter `period` is required when calling `getMetrics`.");let n={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(t)).replace("{period}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getReachability({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let o={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getServers(t){let s={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return h.request(s,t)},getStatus(t){let s={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return h.request(s,t)}}}function ve(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ir({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${Te}-${c}`}),E()]}),...P})}var Re="5.51.0";function cr(c){return [{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${c}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ur({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=I(c,d,l),h=b({hosts:cr(c),...P,algoliaAgent:C({algoliaAgents:m,client:"Recommend",version:Re}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return {transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e});},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t;},batchRecommendRules({indexName:t,model:e,recommendRule:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `batchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `batchRecommendRules`.");let i={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/batch".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return h.request(i,a)},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},deleteRecommendRule({indexName:t,model:e,objectID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let i={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendRule({indexName:t,model:e,objectID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let i={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendStatus({indexName:t,model:e,taskID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let i={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendations(t,e){if(t&&Array.isArray(t)&&(t={requests:t}),!t)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!t.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let o={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},searchRecommendRules({indexName:t,model:e,searchRecommendRulesParams:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let i={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:true,cacheable:true};return h.request(i,a)}}}function Ie(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ur({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${Re}-${c}`}),E()]}),...P})}function bt(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let m=ye(c,d,l),P;l?.transformationOptions?P=l.transformationOptions:l?.transformation&&(P={region:l.transformation.region});let p;if(P){if(!P.region)throw new Error("`region` is required in `transformationOptions`. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let{region:h,...t}=P;p=$(c,d,h,t);}return {...m,async saveObjectsWithTransformation({indexName:h,objects:t,waitForTasks:e},r){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return p.chunkedPush({indexName:h,objects:t,action:"addObject",waitForTasks:e},r)},async partialUpdateObjectsWithTransformation({indexName:h,objects:t,createIfNotExists:e,waitForTasks:r},a){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return p.chunkedPush({indexName:h,objects:t,action:e?"partialUpdateObject":"partialUpdateObjectNoCreate",waitForTasks:r},a)},async replaceAllObjectsWithTransformation({indexName:h,objects:t,batchSize:e,scopes:r},a){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let s=Math.floor(Math.random()*1e6)+1e5,o=`${h}_tmp_${s}`;r===void 0&&(r=["settings","rules","synonyms"]);try{let n=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:o,scope:r}},a),i=await p.chunkedPush({indexName:o,objects:t,waitForTasks:!0,batchSize:e,referenceIndexName:h},a);await this.waitForTask({indexName:o,taskID:n.taskID}),n=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:o,scope:r}},a),await this.waitForTask({indexName:o,taskID:n.taskID});let u=await this.operationIndex({indexName:o,operationIndexParams:{operation:"move",destination:h}},a);return await this.waitForTask({indexName:o,taskID:u.taskID}),{copyOperationResponse:n,watchResponses:i,moveOperationResponse:u}}catch(n){throw await this.deleteIndex({indexName:o}),n}},get _ua(){return m.transporter.algoliaAgent.value},initAbtesting:h=>ie(h.appId||c,h.apiKey||d,h.region,h.options),initAbtestingV3:h=>se(h.appId||c,h.apiKey||d,h.region,h.options),initAnalytics:h=>he(h.appId||c,h.apiKey||d,h.region,h.options),initIngestion:h=>$(h.appId||c,h.apiKey||d,h.region,h.options),initInsights:h=>me(h.appId||c,h.apiKey||d,h.region,h.options),initMonitoring:(h={})=>ve(h.appId||c,h.apiKey||d,h.options),initPersonalization:h=>Pe(h.appId||c,h.apiKey||d,h.region,h.options),initQuerySuggestions:h=>fe(h.appId||c,h.apiKey||d,h.region,h.options),initRecommend:(h={})=>Ie(h.appId||c,h.apiKey||d,h.options)}}
7
+ function R(c){let d,l=`algolia-client-js-${c.key}`;function m(){return d===void 0&&(d=c.localStorage||window.localStorage),d}function P(){return JSON.parse(m().getItem(l)||"{}")}function p(t){m().setItem(l,JSON.stringify(t));}function h(){let t=c.timeToLive?c.timeToLive*1e3:null,e=P(),r=Object.fromEntries(Object.entries(e).filter(([,s])=>s.timestamp!==void 0));if(p(r),!t)return;let a=Object.fromEntries(Object.entries(r).filter(([,s])=>{let o=new Date().getTime();return !(s.timestamp+t<o)}));p(a);}return {get(t,e,r={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),P()[JSON.stringify(t)])).then(a=>Promise.all([a?a.value:e(),a!==void 0])).then(([a,s])=>Promise.all([a,s||r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve().then(()=>{let r=P();return r[JSON.stringify(t)]={timestamp:new Date().getTime(),value:e},m().setItem(l,JSON.stringify(r)),e})},delete(t){return Promise.resolve().then(()=>{let e=P();delete e[JSON.stringify(t)],m().setItem(l,JSON.stringify(e));})},clear(){return Promise.resolve().then(()=>{m().removeItem(l);})}}}function Ae(){return {get(c,d,l={miss:()=>Promise.resolve()}){return d().then(P=>Promise.all([P,l.miss(P)])).then(([P])=>P)},set(c,d){return Promise.resolve(d)},delete(c){return Promise.resolve()},clear(){return Promise.resolve()}}}function v(c){let d=[...c.caches],l=d.shift();return l===void 0?Ae():{get(m,P,p={miss:()=>Promise.resolve()}){return l.get(m,P,p).catch(()=>v({caches:d}).get(m,P,p))},set(m,P){return l.set(m,P).catch(()=>v({caches:d}).set(m,P))},delete(m){return l.delete(m).catch(()=>v({caches:d}).delete(m))},clear(){return l.clear().catch(()=>v({caches:d}).clear())}}}function E(c={serializable:true}){let d={};return {get(l,m,P={miss:()=>Promise.resolve()}){let p=JSON.stringify(l);if(p in d)return Promise.resolve(c.serializable?JSON.parse(d[p]):d[p]);let h=m();return h.then(t=>P.miss(t)).then(()=>h)},set(l,m){return d[JSON.stringify(l)]=c.serializable?JSON.stringify(m):m,Promise.resolve(m)},delete(l){return delete d[JSON.stringify(l)],Promise.resolve()},clear(){return d={},Promise.resolve()}}}function be(c){let d={value:`Algolia for JavaScript (${c})`,add(l){let m=`; ${l.segment}${l.version!==void 0?` (${l.version})`:""}`;return d.value.indexOf(m)===-1&&(d.value=`${d.value}${m}`),d}};return d}function I(c,d,l="WithinHeaders"){let m={"x-algolia-api-key":d,"x-algolia-application-id":c};return {headers(){return l==="WithinHeaders"?m:{}},queryParameters(){return l==="WithinQueryParameters"?m:{}}}}function x({func:c,validate:d,aggregator:l,error:m,timeout:P=()=>0}){let p=h=>new Promise((t,e)=>{c(h).then(async r=>(l&&await l(r),await d(r)?t(r):m&&await m.validate(r)?e(new Error(await m.message(r))):setTimeout(()=>{p(r).then(t).catch(e);},await P()))).catch(r=>{e(r);});});return p()}function C({algoliaAgents:c,client:d,version:l}){let m=be(l).add({segment:d,version:l});return c.forEach(P=>m.add(P)),m}function A(){return {debug(c,d){return Promise.resolve()},info(c,d){return Promise.resolve()},error(c,d){return Promise.resolve()}}}var De=750,X=120*1e3;function Y(c,d="up"){let l=Date.now();function m(){return d==="up"||Date.now()-l>X}function P(){return d==="timed out"&&Date.now()-l<=X}return {...c,status:d,lastUpdate:l,isUp:m,isTimedOut:P}}var Z=class extends Error{name="AlgoliaError";constructor(c,d){super(c),d&&(this.name=d);}};var ee=class extends Z{stackTrace;constructor(c,d,l){super(c,l),this.stackTrace=d;}},ke=class extends ee{constructor(c){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",c,"RetryError");}},G=class extends ee{status;constructor(c,d,l,m="ApiError"){super(c,l,m),this.status=d;}},xe=class extends Z{response;constructor(c,d){super(c,"DeserializationError"),this.response=d;}},Oe=class extends G{error;constructor(c,d,l,m){super(c,d,m,"DetailedApiError"),this.error=l;}};function F(c){let d=c;for(let l=c.length-1;l>0;l--){let m=Math.floor(Math.random()*(l+1)),P=c[l];d[l]=c[m],d[m]=P;}return d}function Ue(c,d,l){let m=Ne(l),P=`${c.protocol}://${c.url}${c.port?`:${c.port}`:""}/${d.charAt(0)==="/"?d.substring(1):d}`;return m.length&&(P+=`?${m}`),P}function Ne(c){return Object.keys(c).filter(d=>c[d]!==void 0).sort().map(d=>`${d}=${encodeURIComponent(Object.prototype.toString.call(c[d])==="[object Array]"?c[d].join(","):c[d]).replace(/\+/g,"%20")}`).join("&")}function Be(c,d){if(c.method==="GET"||c.data===void 0&&d.data===void 0)return;let l=Array.isArray(c.data)?c.data:{...c.data,...d.data};return JSON.stringify(l)}function Ge(c,d,l){let m={Accept:"application/json",...c,...d,...l},P={};return Object.keys(m).forEach(p=>{let h=m[p];P[p.toLowerCase()]=h;}),P}function je(c){try{return JSON.parse(c.content)}catch(d){throw new xe(d.message,c)}}function Fe({content:c,status:d},l){try{let m=JSON.parse(c);return "error"in m?new Oe(m.message,d,m.error,l):new G(m.message,d,l)}catch{}return new G(c,d,l)}function Le({isTimedOut:c,status:d}){return !c&&~~d===0}function He({isTimedOut:c,status:d}){return c||Le({isTimedOut:c,status:d})||~~(d/100)!==2&&~~(d/100)!==4}function We({status:c}){return ~~(c/100)===2}function Qe(c){return c.map(d=>re(d))}function re(c){let d=c.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...c,request:{...c.request,headers:{...c.request.headers,...d}}}}function b({hosts:c,hostsCache:d,baseHeaders:l,logger:m,baseQueryParameters:P,algoliaAgent:p,timeouts:h,requester:t,requestsCache:e,responsesCache:r,compress:a,compression:s}){async function o(u){let q=await Promise.all(u.map(y=>d.get(y,()=>Promise.resolve(Y(y))))),g=q.filter(y=>y.isUp()),w=q.filter(y=>y.isTimedOut()),S=[...g,...w];return {hosts:S.length>0?S:u,getTimeout(y,T){return (w.length===0&&y===0?1:w.length+3+y)*T}}}async function n(u,q,g){let w=[],S=Be(u,q),f=Ge(l,u.headers,q.headers),y=s==="gzip"&&S!==void 0&&S.length>De&&(u.method==="POST"||u.method==="PUT");y&&a===void 0&&m.info("Compression is disabled because no compress method is available.");let T=y&&a!==void 0,O=T?await a(S):S;T&&(f["content-encoding"]="gzip");let N=u.method==="GET"?{...u.data,...q.data}:{},j={...P,...u.queryParameters,...N};if(p.value&&(j["x-algolia-agent"]=p.value),q&&q.queryParameters)for(let k of Object.keys(q.queryParameters))!q.queryParameters[k]||Object.prototype.toString.call(q.queryParameters[k])==="[object Object]"?j[k]=q.queryParameters[k]:j[k]=q.queryParameters[k].toString();let L=0,z=async(k,H)=>{let B=k.pop();if(B===void 0)throw new ke(Qe(w));let W={...h,...q.timeouts},M={data:O,headers:f,method:u.method,url:Ue(B,u.path,j),connectTimeout:H(L,W.connect),responseTimeout:H(L,g?W.read:W.write)},J=Q=>{let K={request:M,response:Q,host:B,triesLeft:k.length};return w.push(K),K},U=await t.send(M);if(He(U)){let Q=J(U);return U.isTimedOut&&L++,m.info("Retryable failure",re(Q)),await d.set(B,Y(B,U.isTimedOut?"timed out":"down")),z(k,H)}if(We(U))return je(U);throw J(U),Fe(U,w)},Ce=c.filter(k=>k.accept==="readWrite"||(g?k.accept==="read":k.accept==="write")),_=await o(Ce);return z([..._.hosts].reverse(),_.getTimeout)}function i(u,q={}){let g=()=>n(u,q,w),w=u.useReadTransporter||u.method==="GET";if((q.cacheable||u.cacheable)!==true)return g();let f={request:u,requestOptions:q,transporter:{queryParameters:P,headers:l}};return r.get(f,()=>e.get(f,()=>e.set(f,g()).then(y=>Promise.all([e.delete(f),y]),y=>Promise.all([e.delete(f),Promise.reject(y)])).then(([y,T])=>T)),{miss:y=>r.set(f,y)})}return {hostsCache:d,requester:t,timeouts:h,logger:m,algoliaAgent:p,baseHeaders:l,baseQueryParameters:P,hosts:c,request:i,requestsCache:e,responsesCache:r}}function D(){function c(d){return new Promise(l=>{let m=new XMLHttpRequest;m.open(d.method,d.url,true),Object.keys(d.headers).forEach(t=>m.setRequestHeader(t,d.headers[t]));let P=(t,e)=>setTimeout(()=>{m.abort(),l({status:0,content:e,isTimedOut:true});},t),p=P(d.connectTimeout,"Connection timeout"),h;m.onreadystatechange=()=>{m.readyState>m.OPENED&&h===void 0&&(clearTimeout(p),h=P(d.responseTimeout,"Socket timeout"));},m.onerror=()=>{m.status===0&&(clearTimeout(p),clearTimeout(h),l({content:m.responseText||"Network request failed",status:m.status,isTimedOut:false}));},m.onload=()=>{clearTimeout(p),clearTimeout(h),l({content:m.responseText,status:m.status,isTimedOut:false});},m.send(d.data);})}return {send:c}}var ae="1.18.0",te=["de","us"];function Ve(c){return [{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function $e({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Ve(P),...p,algoliaAgent:C({algoliaAgents:m,client:"AbtestingV3",version:ae}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},addABTests(e,r){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.metrics)throw new Error("Parameter `addABTestsRequest.metrics` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let n={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let n={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},estimateABTest(e,r){if(!e)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!e.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!e.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let n={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:e};return t.request(n,r)},getABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let n={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTimeseries({id:e,startDate:r,endDate:a,metric:s},o){if(!e)throw new Error("Parameter `id` is required when calling `getTimeseries`.");let n="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(e)),i={},u={};r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.metric=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},listABTests({offset:e,limit:r,indexPrefix:a,indexSuffix:s,direction:o}={},n=void 0){let i="/3/abtests",u={},q={};e!==void 0&&(q.offset=e.toString()),r!==void 0&&(q.limit=r.toString()),a!==void 0&&(q.indexPrefix=a.toString()),s!==void 0&&(q.indexSuffix=s.toString()),o!==void 0&&(q.direction=o.toString());let g={method:"GET",path:i,queryParameters:q,headers:u};return t.request(g,n)},stopABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let n={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)}}}function se(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!te.includes(l)))throw new Error(`\`region\` must be one of the following: ${te.join(", ")}`);let{compression:P,...p}=m||{};return $e({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${ae}-${c}`}),E()]}),...p})}var oe="5.52.0",ne=["de","us"];function ze(c){return [{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function _e({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:ze(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Abtesting",version:oe}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},addABTests(e,r){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");let n={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");let n={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},estimateABTest(e,r){if(!e)throw new Error("Parameter `estimateABTestRequest` is required when calling `estimateABTest`.");if(!e.configuration)throw new Error("Parameter `estimateABTestRequest.configuration` is required when calling `estimateABTest`.");if(!e.variants)throw new Error("Parameter `estimateABTestRequest.variants` is required when calling `estimateABTest`.");let n={method:"POST",path:"/2/abtests/estimate",queryParameters:{},headers:{},data:e};return t.request(n,r)},getABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");let n={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},listABTests({offset:e,limit:r,indexPrefix:a,indexSuffix:s}={},o=void 0){let n="/2/abtests",i={},u={};e!==void 0&&(u.offset=e.toString()),r!==void 0&&(u.limit=r.toString()),a!==void 0&&(u.indexPrefix=a.toString()),s!==void 0&&(u.indexSuffix=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},stopABTest({id:e},r){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");let n={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)}}}function ie(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!ne.includes(l)))throw new Error(`\`region\` must be one of the following: ${ne.join(", ")}`);let{compression:P,...p}=m||{};return _e({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${oe}-${c}`}),E()]}),...p})}var ue="5.52.0",ce=["de","us"];function Me(c){return [{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function Je({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Me(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Analytics",version:ue}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},getAddToCartRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getAddToCartRate`.");let n="/2/conversions/addToCartRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getAverageClickPosition({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getAverageClickPosition`.");let n="/2/clicks/averageClickPosition",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getClickPositions({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getClickPositions`.");let n="/2/clicks/positions",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getClickThroughRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getClickThroughRate`.");let n="/2/clicks/clickThroughRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getConversionRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getConversionRate`.");let n="/2/conversions/conversionRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getNoClickRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getNoClickRate`.");let n="/2/searches/noClickRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getNoResultsRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getNoResultsRate`.");let n="/2/searches/noResultRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getPurchaseRate({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getPurchaseRate`.");let n="/2/conversions/purchaseRate",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getRevenue({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getRevenue`.");let n="/2/conversions/revenue",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getSearchesCount({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesCount`.");let n="/2/searches/count",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)},getSearchesNoClicks({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoClicks`.");let u="/2/searches/noClicks",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getSearchesNoResults({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getSearchesNoResults`.");let u="/2/searches/noResults",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getStatus({index:e},r){if(!e)throw new Error("Parameter `index` is required when calling `getStatus`.");let a="/2/status",s={},o={};e!==void 0&&(o.index=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return t.request(n,r)},getTopCountries({index:e,startDate:r,endDate:a,limit:s,offset:o,tags:n},i){if(!e)throw new Error("Parameter `index` is required when calling `getTopCountries`.");let u="/2/countries",q={},g={};e!==void 0&&(g.index=e.toString()),r!==void 0&&(g.startDate=r.toString()),a!==void 0&&(g.endDate=a.toString()),s!==void 0&&(g.limit=s.toString()),o!==void 0&&(g.offset=o.toString()),n!==void 0&&(g.tags=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},getTopFilterAttributes({index:e,search:r,startDate:a,endDate:s,limit:o,offset:n,tags:i},u){if(!e)throw new Error("Parameter `index` is required when calling `getTopFilterAttributes`.");let q="/2/filters",g={},w={};e!==void 0&&(w.index=e.toString()),r!==void 0&&(w.search=r.toString()),a!==void 0&&(w.startDate=a.toString()),s!==void 0&&(w.endDate=s.toString()),o!==void 0&&(w.limit=o.toString()),n!==void 0&&(w.offset=n.toString()),i!==void 0&&(w.tags=i.toString());let S={method:"GET",path:q,queryParameters:w,headers:g};return t.request(S,u)},getTopFilterForAttribute({attribute:e,index:r,search:a,startDate:s,endDate:o,limit:n,offset:i,tags:u},q){if(!e)throw new Error("Parameter `attribute` is required when calling `getTopFilterForAttribute`.");if(!r)throw new Error("Parameter `index` is required when calling `getTopFilterForAttribute`.");let g="/2/filters/{attribute}".replace("{attribute}",encodeURIComponent(e)),w={},S={};r!==void 0&&(S.index=r.toString()),a!==void 0&&(S.search=a.toString()),s!==void 0&&(S.startDate=s.toString()),o!==void 0&&(S.endDate=o.toString()),n!==void 0&&(S.limit=n.toString()),i!==void 0&&(S.offset=i.toString()),u!==void 0&&(S.tags=u.toString());let f={method:"GET",path:g,queryParameters:S,headers:w};return t.request(f,q)},getTopFiltersNoResults({index:e,search:r,startDate:a,endDate:s,limit:o,offset:n,tags:i},u){if(!e)throw new Error("Parameter `index` is required when calling `getTopFiltersNoResults`.");let q="/2/filters/noResults",g={},w={};e!==void 0&&(w.index=e.toString()),r!==void 0&&(w.search=r.toString()),a!==void 0&&(w.startDate=a.toString()),s!==void 0&&(w.endDate=s.toString()),o!==void 0&&(w.limit=o.toString()),n!==void 0&&(w.offset=n.toString()),i!==void 0&&(w.tags=i.toString());let S={method:"GET",path:q,queryParameters:w,headers:g};return t.request(S,u)},getTopHits({index:e,search:r,clickAnalytics:a,revenueAnalytics:s,startDate:o,endDate:n,limit:i,offset:u,tags:q},g){if(!e)throw new Error("Parameter `index` is required when calling `getTopHits`.");let w="/2/hits",S={},f={};e!==void 0&&(f.index=e.toString()),r!==void 0&&(f.search=r.toString()),a!==void 0&&(f.clickAnalytics=a.toString()),s!==void 0&&(f.revenueAnalytics=s.toString()),o!==void 0&&(f.startDate=o.toString()),n!==void 0&&(f.endDate=n.toString()),i!==void 0&&(f.limit=i.toString()),u!==void 0&&(f.offset=u.toString()),q!==void 0&&(f.tags=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},getTopSearches({index:e,clickAnalytics:r,revenueAnalytics:a,startDate:s,endDate:o,orderBy:n,direction:i,limit:u,offset:q,tags:g},w){if(!e)throw new Error("Parameter `index` is required when calling `getTopSearches`.");let S="/2/searches",f={},y={};e!==void 0&&(y.index=e.toString()),r!==void 0&&(y.clickAnalytics=r.toString()),a!==void 0&&(y.revenueAnalytics=a.toString()),s!==void 0&&(y.startDate=s.toString()),o!==void 0&&(y.endDate=o.toString()),n!==void 0&&(y.orderBy=n.toString()),i!==void 0&&(y.direction=i.toString()),u!==void 0&&(y.limit=u.toString()),q!==void 0&&(y.offset=q.toString()),g!==void 0&&(y.tags=g.toString());let T={method:"GET",path:S,queryParameters:y,headers:f};return t.request(T,w)},getUsersCount({index:e,startDate:r,endDate:a,tags:s},o){if(!e)throw new Error("Parameter `index` is required when calling `getUsersCount`.");let n="/2/users/count",i={},u={};e!==void 0&&(u.index=e.toString()),r!==void 0&&(u.startDate=r.toString()),a!==void 0&&(u.endDate=a.toString()),s!==void 0&&(u.tags=s.toString());let q={method:"GET",path:n,queryParameters:u,headers:i};return t.request(q,o)}}}function he(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!ce.includes(l)))throw new Error(`\`region\` must be one of the following: ${ce.join(", ")}`);let{compression:P,...p}=m||{};return Je({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${ue}-${c}`}),E()]}),...p})}var le="5.52.0",de=["de","us"];function Ke(c){return [{url:c?"insights.{region}.algolia.io".replace("{region}",c):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function Xe({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Ke(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Insights",version:le}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteUserToken({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let n={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},pushEvents(e,r){if(!e)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!e.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let n={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:e};return t.request(n,r)}}}function me(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(l&&(typeof l!="string"||!de.includes(l)))throw new Error(`\`region\` must be one of the following: ${de.join(", ")}`);let{compression:P,...p}=m||{};return Xe({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${le}-${c}`}),E()]}),...p})}var ge="5.52.0",qe=["eu","us"];function Ye(c){return [{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function Ze({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:Ye(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Personalization",version:ge}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteUserProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");let n={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getPersonalizationStrategy(e){let o={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return t.request(o,e)},getUserTokenProfile({userToken:e},r){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");let n={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},setPersonalizationStrategy(e,r){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventsScoring)throw new Error("Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetsScoring)throw new Error("Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");let n={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return t.request(n,r)}}}function Pe(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!qe.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${qe.join(", ")}`);let{compression:P,...p}=m||{};return Ze({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${ge}-${c}`}),E()]}),...p})}var we="5.52.0",pe=["eu","us"];function er(c){return [{url:"query-suggestions.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function rr({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:er(P),...p,algoliaAgent:C({algoliaAgents:m,client:"QuerySuggestions",version:we}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},createConfig(e,r){if(!e)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let n={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteConfig({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let n={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getAllConfigs(e){let o={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return t.request(o,e)},getConfig({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let n={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getConfigStatus({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let n={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getLogFile({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let n={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},updateConfig({indexName:e,configuration:r},a){if(!e)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!r)throw new Error("Parameter `configuration` is required when calling `updateConfig`.");if(!r.sourceIndices)throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");let i={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)}}}function fe(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!pe.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${pe.join(", ")}`);let{compression:P,...p}=m||{};return rr({appId:c,apiKey:d,region:l,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${we}-${c}`}),E()]}),...p})}var V="5.52.0";function tr(c){return [{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${c}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ar({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=I(c,d,l),h=b({hosts:tr(c),...P,algoliaAgent:C({algoliaAgents:m,client:"Search",version:V}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return {transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e});},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t;},waitForTask({indexName:t,taskID:e,maxRetries:r=100,timeout:a=o=>Math.min(o*200,5e3)},s){let o=0;return x({func:()=>this.getTask({indexName:t,taskID:e},s),validate:n=>n.status==="published",aggregator:()=>o+=1,error:{validate:()=>o>=r,message:()=>`Stopped waiting for the task after ${r} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>a(o)})},waitForAppTask({taskID:t,maxRetries:e=100,timeout:r=s=>Math.min(s*200,5e3)},a){let s=0;return x({func:()=>this.getAppTask({taskID:t},a),validate:o=>o.status==="published",aggregator:()=>s+=1,error:{validate:()=>s>=e,message:()=>`Stopped waiting for the task after ${e} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>r(s)})},waitForApiKey({operation:t,key:e,apiKey:r,maxRetries:a=100,timeout:s=n=>Math.min(n*200,5e3)},o){let n=0,i={aggregator:()=>n+=1,error:{validate:()=>n>=a,message:()=>`Stopped waiting for the API key operation after ${a} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`},timeout:()=>s(n)};if(t==="update"){if(!r)throw new Error("`apiKey` is required when waiting for an `update` operation.");return x({...i,func:()=>this.getApiKey({key:e},o),validate:u=>{for(let q of Object.keys(r)){let g=r[q],w=u[q];if(Array.isArray(g)&&Array.isArray(w)){if(g.length!==w.length||g.some((S,f)=>S!==w[f]))return false}else if(g!==w)return false}return true}})}return x({...i,func:()=>this.getApiKey({key:e},o).catch(u=>{if(u.status!==404)throw u}),validate:u=>t==="add"?u!==void 0:u===void 0})},browseObjects({indexName:t,browseParams:e,...r},a){return x({func:s=>this.browse({indexName:t,browseParams:{cursor:s?s.cursor:void 0,hitsPerPage:1e3,...e}},a),validate:s=>s.cursor===void 0,...r})},browseRules({indexName:t,searchRulesParams:e,...r},a){let s={...e,hitsPerPage:e?.hitsPerPage||1e3};return x({func:o=>this.searchRules({indexName:t,searchRulesParams:{...s,page:o?o.page+1:s.page||0}},a),validate:o=>o.hits.length<s.hitsPerPage,...r})},browseSynonyms({indexName:t,searchSynonymsParams:e,...r},a){let s={...e,page:e?.page||0,hitsPerPage:1e3};return x({func:o=>{let n=this.searchSynonyms({indexName:t,searchSynonymsParams:{...s,page:s.page}},a);return s.page+=1,n},validate:o=>o.hits.length<s.hitsPerPage,...r})},async chunkedBatch({indexName:t,objects:e,action:r="addObject",waitForTasks:a,batchSize:s=1e3},o){let n=[],i=[],u=e.entries();for(let[q,g]of u)n.push({action:r,body:g}),(n.length===s||q===e.length-1)&&(i.push(await this.batch({indexName:t,batchWriteParams:{requests:n}},o)),n=[]);if(a)for(let q of i)await this.waitForTask({indexName:t,taskID:q.taskID});return i},async saveObjects({indexName:t,objects:e,waitForTasks:r,batchSize:a},s){return await this.chunkedBatch({indexName:t,objects:e,action:"addObject",waitForTasks:r,batchSize:a},s)},async deleteObjects({indexName:t,objectIDs:e,waitForTasks:r,batchSize:a},s){return await this.chunkedBatch({indexName:t,objects:e.map(o=>({objectID:o})),action:"deleteObject",waitForTasks:r,batchSize:a},s)},async partialUpdateObjects({indexName:t,objects:e,createIfNotExists:r,waitForTasks:a,batchSize:s},o){return await this.chunkedBatch({indexName:t,objects:e,action:r?"partialUpdateObject":"partialUpdateObjectNoCreate",batchSize:s,waitForTasks:a},o)},async replaceAllObjects({indexName:t,objects:e,batchSize:r,scopes:a},s){let o=Math.floor(Math.random()*1e6)+1e5,n=`${t}_tmp_${o}`;a===void 0&&(a=["settings","rules","synonyms"]);try{let i=await this.operationIndex({indexName:t,operationIndexParams:{operation:"copy",destination:n,scope:a}},s),u=await this.chunkedBatch({indexName:n,objects:e,waitForTasks:!0,batchSize:r},s);await this.waitForTask({indexName:n,taskID:i.taskID}),i=await this.operationIndex({indexName:t,operationIndexParams:{operation:"copy",destination:n,scope:a}},s),await this.waitForTask({indexName:n,taskID:i.taskID});let q=await this.operationIndex({indexName:n,operationIndexParams:{operation:"move",destination:t}},s);return await this.waitForTask({indexName:n,taskID:q.taskID}),{copyOperationResponse:i,batchResponses:u,moveOperationResponse:q}}catch(i){throw await this.deleteIndex({indexName:n}),i}},async indexExists({indexName:t}){try{await this.getSettings({indexName:t});}catch(e){if(e instanceof G&&e.status===404)return false;throw e}return true},searchForHits(t,e){return this.search(t,e)},searchForFacets(t,e){return this.search(t,e)},addApiKey(t,e){if(!t)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!t.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");let o={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:t};return h.request(o,e)},addOrUpdateObject({indexName:t,objectID:e,body:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");let i={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return h.request(i,a)},appendSource(t,e){if(!t)throw new Error("Parameter `source` is required when calling `appendSource`.");if(!t.source)throw new Error("Parameter `source.source` is required when calling `appendSource`.");let o={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:t};return h.request(o,e)},assignUserId({xAlgoliaUserID:t,assignUserIdParams:e},r){if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!e)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!e.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");let a="/1/clusters/mapping",s={},o={};t!==void 0&&(s["X-Algolia-User-ID"]=t.toString());let n={method:"POST",path:a,queryParameters:o,headers:s,data:e};return h.request(n,r)},batch({indexName:t,batchWriteParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!e)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!e.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");let n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},batchAssignUserIds({xAlgoliaUserID:t,batchAssignUserIdsParams:e},r){if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!e)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!e.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!e.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");let a="/1/clusters/mapping/batch",s={},o={};t!==void 0&&(s["X-Algolia-User-ID"]=t.toString());let n={method:"POST",path:a,queryParameters:o,headers:s,data:e};return h.request(n,r)},batchDictionaryEntries({dictionaryName:t,batchDictionaryEntriesParams:e},r){if(!t)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!e)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!e.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},browse({indexName:t,browseParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `browse`.");let n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true};return h.request(n,r)},clearObjects({indexName:t},e){if(!t)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");let o={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},clearRules({indexName:t,forwardToReplicas:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `clearRules`.");let a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.forwardToReplicas=e.toString());let n={method:"POST",path:a,queryParameters:o,headers:s};return h.request(n,r)},clearSynonyms({indexName:t,forwardToReplicas:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");let a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.forwardToReplicas=e.toString());let n={method:"POST",path:a,queryParameters:o,headers:s};return h.request(n,r)},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},deleteApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");let o={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteBy({indexName:t,deleteByParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!e)throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");let n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},deleteIndex({indexName:t},e){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");let o={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteObject({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");let n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},deleteRule({indexName:t,objectID:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");let s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"DELETE",path:s,queryParameters:n,headers:o};return h.request(i,a)},deleteSource({source:t},e){if(!t)throw new Error("Parameter `source` is required when calling `deleteSource`.");let o={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},deleteSynonym({indexName:t,objectID:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");let s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"DELETE",path:s,queryParameters:n,headers:o};return h.request(i,a)},getApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `getApiKey`.");let o={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getAppTask({taskID:t},e){if(!t)throw new Error("Parameter `taskID` is required when calling `getAppTask`.");let o={method:"GET",path:"/1/task/{taskID}".replace("{taskID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getDictionaryLanguages(t){let s={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return h.request(s,t)},getDictionarySettings(t){let s={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return h.request(s,t)},getLogs({offset:t,length:e,indexName:r,type:a}={},s=void 0){let o="/1/logs",n={},i={};t!==void 0&&(i.offset=t.toString()),e!==void 0&&(i.length=e.toString()),r!==void 0&&(i.indexName=r.toString()),a!==void 0&&(i.type=a.toString());let u={method:"GET",path:o,queryParameters:i,headers:n};return h.request(u,s)},getObject({indexName:t,objectID:e,attributesToRetrieve:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getObject`.");let s="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),o={},n={};r!==void 0&&(n.attributesToRetrieve=r.toString());let i={method:"GET",path:s,queryParameters:n,headers:o};return h.request(i,a)},getObjects(t,e){if(!t)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!t.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");let o={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},getRule({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getRule`.");let n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getSettings({indexName:t,getVersion:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getSettings`.");let a="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),s={},o={};e!==void 0&&(o.getVersion=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},getSources(t){let s={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return h.request(s,t)},getSynonym({indexName:t,objectID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");let n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getTask({indexName:t,taskID:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(t)).replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getTopUserIds(t){let s={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return h.request(s,t)},getUserId({userID:t},e){if(!t)throw new Error("Parameter `userID` is required when calling `getUserId`.");let o={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},hasPendingMappings({getClusters:t}={},e=void 0){let r="/1/clusters/mapping/pending",a={},s={};t!==void 0&&(s.getClusters=t.toString());let o={method:"GET",path:r,queryParameters:s,headers:a};return h.request(o,e)},listApiKeys(t){let s={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return h.request(s,t)},listClusters(t){let s={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return h.request(s,t)},listIndices({page:t,hitsPerPage:e}={},r=void 0){let a="/1/indexes",s={},o={};t!==void 0&&(o.page=t.toString()),e!==void 0&&(o.hitsPerPage=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},listUserIds({page:t,hitsPerPage:e}={},r=void 0){let a="/1/clusters/mapping",s={},o={};t!==void 0&&(o.page=t.toString()),e!==void 0&&(o.hitsPerPage=e.toString());let n={method:"GET",path:a,queryParameters:o,headers:s};return h.request(n,r)},multipleBatch(t,e){if(!t)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!t.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");let o={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:t};return h.request(o,e)},operationIndex({indexName:t,operationIndexParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!e)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!e.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!e.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},partialUpdateObject({indexName:t,objectID:e,attributesToUpdate:r,createIfNotExists:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!e)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");let o="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.createIfNotExists=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},removeUserId({userID:t},e){if(!t)throw new Error("Parameter `userID` is required when calling `removeUserId`.");let o={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},replaceSources({source:t},e){if(!t)throw new Error("Parameter `source` is required when calling `replaceSources`.");let o={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:t};return h.request(o,e)},restoreApiKey({key:t},e){if(!t)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");let o={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},saveObject({indexName:t,body:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!e)throw new Error("Parameter `body` is required when calling `saveObject`.");let n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)},saveRule({indexName:t,objectID:e,rule:r,forwardToReplicas:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!e)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!r.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");if(!r.consequence)throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");let o="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.forwardToReplicas=a.toString());let u={method:"PUT",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},saveRules({indexName:t,rules:e,forwardToReplicas:r,clearExistingRules:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!e)throw new Error("Parameter `rules` is required when calling `saveRules`.");let o="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(t)),n={},i={};r!==void 0&&(i.forwardToReplicas=r.toString()),a!==void 0&&(i.clearExistingRules=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:e};return h.request(u,s)},saveSynonym({indexName:t,objectID:e,synonymHit:r,forwardToReplicas:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!e)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!r.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");if(!r.type)throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");let o="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.forwardToReplicas=a.toString());let u={method:"PUT",path:o,queryParameters:i,headers:n,data:r};return h.request(u,s)},saveSynonyms({indexName:t,synonymHit:e,forwardToReplicas:r,replaceExistingSynonyms:a},s){if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!e)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");let o="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(t)),n={},i={};r!==void 0&&(i.forwardToReplicas=r.toString()),a!==void 0&&(i.replaceExistingSynonyms=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:e};return h.request(u,s)},search(t,e){if(t&&Array.isArray(t)&&(t={requests:t.map(({params:i,...u})=>u.type==="facet"?{...u,...i,type:"facet"}:{...u,...i,facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}),!t)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!t.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");let o={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},searchDictionaryEntries({dictionaryName:t,searchDictionaryEntriesParams:e},r){if(!t)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!e)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!e.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");let n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e,useReadTransporter:true,cacheable:true};return h.request(n,r)},searchForFacetValues({indexName:t,facetName:e,searchForFacetValuesRequest:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!e)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");let i={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(t)).replace("{facetName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:true,cacheable:true};return h.request(i,a)},searchRules({indexName:t,searchRulesParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchRules`.");let n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true,cacheable:true};return h.request(n,r)},searchSingleIndex({indexName:t,searchParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");let n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true,cacheable:true};return h.request(n,r)},searchSynonyms({indexName:t,searchSynonymsParams:e},r){if(!t)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");let n={method:"POST",path:"/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e||{},useReadTransporter:true,cacheable:true};return h.request(n,r)},searchUserIds(t,e){if(!t)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!t.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");let o={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},setDictionarySettings(t,e){if(!t)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!t.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");let o={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:t};return h.request(o,e)},setSettings({indexName:t,indexSettings:e,forwardToReplicas:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!e)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");let s="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),o={},n={};r!==void 0&&(n.forwardToReplicas=r.toString());let i={method:"PUT",path:s,queryParameters:n,headers:o,data:e};return h.request(i,a)},updateApiKey({key:t,apiKey:e},r){if(!t)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!e)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");let n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{},data:e};return h.request(n,r)}}}function ye(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ar({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${V}-${c}`}),E()]}),...P})}var Se="1.52.0",Ee=["eu","us"];function sr(c){return [{url:"data.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]}function Jr(c){return c.type==="onDemand"}function Kr(c){return c.type==="schedule"}function Xr(c){return c.type==="subscription"}function nr({appId:c,apiKey:d,authMode:l,algoliaAgents:m,region:P,...p}){let h=I(c,d,l),t=b({hosts:sr(P),...p,algoliaAgent:C({algoliaAgents:m,client:"Ingestion",version:Se}),baseHeaders:{"content-type":"text/plain",...h.headers(),...p.baseHeaders},baseQueryParameters:{...h.queryParameters(),...p.baseQueryParameters}});return {transporter:t,appId:c,apiKey:d,clearCache(){return Promise.all([t.requestsCache.clear(),t.responsesCache.clear()]).then(()=>{})},get _ua(){return t.algoliaAgent.value},addAlgoliaAgent(e,r){t.algoliaAgent.add({segment:e,version:r});},setClientApiKey({apiKey:e}){!l||l==="WithinHeaders"?t.baseHeaders["x-algolia-api-key"]=e:t.baseQueryParameters["x-algolia-api-key"]=e;},async chunkedPush({indexName:e,objects:r,action:a="addObject",waitForTasks:s,batchSize:o=1e3,referenceIndexName:n},i){let u=[],q=0,g=[],w=Math.floor(o/10)||o,S=r.entries();for(let[f,y]of S)if(u.push(y),(u.length===o||f===r.length-1)&&(g.push(await this.push({indexName:e,pushTaskPayload:{action:a,records:u},referenceIndexName:n},i)),u=[]),s&&g.length>0&&(g.length%w===0||f===r.length-1)){for(let T of g.slice(q,q+w)){if(!T.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");let O=0;await x({func:async()=>{if(T.eventID===void 0||!T.eventID)throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");return this.getEvent({runID:T.runID,eventID:T.eventID}).catch(N=>{if(N.status!==404)throw N})},validate:N=>N!==void 0,aggregator:()=>O+=1,error:{validate:()=>O>=50,message:()=>`The maximum number of retries exceeded. (${O}/50)`},timeout:()=>Math.min(O*1500,5e3)});}q+=w;}return g},createAuthentication(e,r){if(!e)throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");if(!e.type)throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");if(!e.name)throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");if(!e.input)throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");let n={method:"POST",path:"/1/authentications",queryParameters:{},headers:{},data:e};return t.request(n,r)},createDestination(e,r){if(!e)throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");if(!e.type)throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");if(!e.name)throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");if(!e.input)throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");let n={method:"POST",path:"/1/destinations",queryParameters:{},headers:{},data:e};return t.request(n,r)},createSource(e,r){if(!e)throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");if(!e.type)throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");if(!e.name)throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");let n={method:"POST",path:"/1/sources",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTask(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTask`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");let n={method:"POST",path:"/2/tasks",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTaskV1(e,r){if(!e)throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");if(!e.sourceID)throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");if(!e.destinationID)throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");if(!e.trigger)throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");if(!e.action)throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");let n={method:"POST",path:"/1/tasks",queryParameters:{},headers:{},data:e};return t.request(n,r)},createTransformation(e,r){if(!e)throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");if(!e.name)throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");let n={method:"POST",path:"/1/transformations",queryParameters:{},headers:{},data:e};return t.request(n,r)},customDelete({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");let i={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customGet({path:e,parameters:r},a){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");let i={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return t.request(i,a)},customPost({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");let u={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},customPut({path:e,parameters:r,body:a},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");let u={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:a||{}};return t.request(u,s)},deleteAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");let n={method:"DELETE",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");let n={method:"DELETE",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");let n={method:"DELETE",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTask`.");let n={method:"DELETE",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");let n={method:"DELETE",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},deleteTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");let n={method:"DELETE",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},disableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTask`.");let n={method:"PUT",path:"/2/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},disableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");let n={method:"PUT",path:"/1/tasks/{taskID}/disable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},enableTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTask`.");let n={method:"PUT",path:"/2/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},enableTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");let n={method:"PUT",path:"/1/tasks/{taskID}/enable".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getAuthentication({authenticationID:e},r){if(!e)throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");let n={method:"GET",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getDestination({destinationID:e},r){if(!e)throw new Error("Parameter `destinationID` is required when calling `getDestination`.");let n={method:"GET",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getEvent({runID:e,eventID:r},a){if(!e)throw new Error("Parameter `runID` is required when calling `getEvent`.");if(!r)throw new Error("Parameter `eventID` is required when calling `getEvent`.");let i={method:"GET",path:"/1/runs/{runID}/events/{eventID}".replace("{runID}",encodeURIComponent(e)).replace("{eventID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return t.request(i,a)},getRun({runID:e},r){if(!e)throw new Error("Parameter `runID` is required when calling `getRun`.");let n={method:"GET",path:"/1/runs/{runID}".replace("{runID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getSource({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `getSource`.");let n={method:"GET",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTask({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTask`.");let n={method:"GET",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTaskV1({taskID:e},r){if(!e)throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");let n={method:"GET",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},getTransformation({transformationID:e},r){if(!e)throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");let n={method:"GET",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return t.request(n,r)},listAuthentications({itemsPerPage:e,page:r,type:a,platform:s,sort:o,order:n}={},i=void 0){let u="/1/authentications",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),r!==void 0&&(g.page=r.toString()),a!==void 0&&(g.type=a.toString()),s!==void 0&&(g.platform=s.toString()),o!==void 0&&(g.sort=o.toString()),n!==void 0&&(g.order=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},listDestinations({itemsPerPage:e,page:r,type:a,authenticationID:s,transformationID:o,sort:n,order:i}={},u=void 0){let q="/1/destinations",g={},w={};e!==void 0&&(w.itemsPerPage=e.toString()),r!==void 0&&(w.page=r.toString()),a!==void 0&&(w.type=a.toString()),s!==void 0&&(w.authenticationID=s.toString()),o!==void 0&&(w.transformationID=o.toString()),n!==void 0&&(w.sort=n.toString()),i!==void 0&&(w.order=i.toString());let S={method:"GET",path:q,queryParameters:w,headers:g};return t.request(S,u)},listEvents({runID:e,itemsPerPage:r,page:a,status:s,type:o,sort:n,order:i,startDate:u,endDate:q},g){if(!e)throw new Error("Parameter `runID` is required when calling `listEvents`.");let w="/1/runs/{runID}/events".replace("{runID}",encodeURIComponent(e)),S={},f={};r!==void 0&&(f.itemsPerPage=r.toString()),a!==void 0&&(f.page=a.toString()),s!==void 0&&(f.status=s.toString()),o!==void 0&&(f.type=o.toString()),n!==void 0&&(f.sort=n.toString()),i!==void 0&&(f.order=i.toString()),u!==void 0&&(f.startDate=u.toString()),q!==void 0&&(f.endDate=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},listRuns({itemsPerPage:e,page:r,status:a,type:s,taskID:o,sort:n,order:i,startDate:u,endDate:q}={},g=void 0){let w="/1/runs",S={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),a!==void 0&&(f.status=a.toString()),s!==void 0&&(f.type=s.toString()),o!==void 0&&(f.taskID=o.toString()),n!==void 0&&(f.sort=n.toString()),i!==void 0&&(f.order=i.toString()),u!==void 0&&(f.startDate=u.toString()),q!==void 0&&(f.endDate=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},listSources({itemsPerPage:e,page:r,type:a,authenticationID:s,sort:o,order:n}={},i=void 0){let u="/1/sources",q={},g={};e!==void 0&&(g.itemsPerPage=e.toString()),r!==void 0&&(g.page=r.toString()),a!==void 0&&(g.type=a.toString()),s!==void 0&&(g.authenticationID=s.toString()),o!==void 0&&(g.sort=o.toString()),n!==void 0&&(g.order=n.toString());let w={method:"GET",path:u,queryParameters:g,headers:q};return t.request(w,i)},listTasks({itemsPerPage:e,page:r,action:a,enabled:s,sourceID:o,sourceType:n,destinationID:i,triggerType:u,withEmailNotifications:q,sort:g,order:w}={},S=void 0){let f="/2/tasks",y={},T={};e!==void 0&&(T.itemsPerPage=e.toString()),r!==void 0&&(T.page=r.toString()),a!==void 0&&(T.action=a.toString()),s!==void 0&&(T.enabled=s.toString()),o!==void 0&&(T.sourceID=o.toString()),n!==void 0&&(T.sourceType=n.toString()),i!==void 0&&(T.destinationID=i.toString()),u!==void 0&&(T.triggerType=u.toString()),q!==void 0&&(T.withEmailNotifications=q.toString()),g!==void 0&&(T.sort=g.toString()),w!==void 0&&(T.order=w.toString());let O={method:"GET",path:f,queryParameters:T,headers:y};return t.request(O,S)},listTasksV1({itemsPerPage:e,page:r,action:a,enabled:s,sourceID:o,destinationID:n,triggerType:i,sort:u,order:q}={},g=void 0){let w="/1/tasks",S={},f={};e!==void 0&&(f.itemsPerPage=e.toString()),r!==void 0&&(f.page=r.toString()),a!==void 0&&(f.action=a.toString()),s!==void 0&&(f.enabled=s.toString()),o!==void 0&&(f.sourceID=o.toString()),n!==void 0&&(f.destinationID=n.toString()),i!==void 0&&(f.triggerType=i.toString()),u!==void 0&&(f.sort=u.toString()),q!==void 0&&(f.order=q.toString());let y={method:"GET",path:w,queryParameters:f,headers:S};return t.request(y,g)},listTransformations({itemsPerPage:e,page:r,sort:a,order:s,type:o}={},n=void 0){let i="/1/transformations",u={},q={};e!==void 0&&(q.itemsPerPage=e.toString()),r!==void 0&&(q.page=r.toString()),a!==void 0&&(q.sort=a.toString()),s!==void 0&&(q.order=s.toString()),o!==void 0&&(q.type=o.toString());let g={method:"GET",path:i,queryParameters:q,headers:u};return t.request(g,n)},push({indexName:e,pushTaskPayload:r,watch:a,referenceIndexName:s},o){if(!e)throw new Error("Parameter `indexName` is required when calling `push`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");let n="/1/push/{indexName}".replace("{indexName}",encodeURIComponent(e)),i={},u={};a!==void 0&&(u.watch=a.toString()),s!==void 0&&(u.referenceIndexName=s.toString());let q={method:"POST",path:n,queryParameters:u,headers:i,data:r};return o={timeouts:{connect:18e4,read:18e4,write:18e4,...o?.timeouts}},t.request(q,o)},pushTask({taskID:e,pushTaskPayload:r,watch:a},s){if(!e)throw new Error("Parameter `taskID` is required when calling `pushTask`.");if(!r)throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");if(!r.action)throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");if(!r.records)throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");let o="/2/tasks/{taskID}/push".replace("{taskID}",encodeURIComponent(e)),n={},i={};a!==void 0&&(i.watch=a.toString());let u={method:"POST",path:o,queryParameters:i,headers:n,data:r};return s={timeouts:{connect:18e4,read:18e4,write:18e4,...s?.timeouts}},t.request(u,s)},replaceTask({taskID:e,taskReplace:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `replaceTask`.");if(!r)throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");if(!r.destinationID)throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");if(!r.action)throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");let i={method:"PUT",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},runSource({sourceID:e,runSourcePayload:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `runSource`.");let i={method:"POST",path:"/1/sources/{sourceID}/run".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},runTask({taskID:e,runTaskPayload:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `runTask`.");let i={method:"POST",path:"/2/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},runTaskV1({taskID:e,runTaskPayload:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");let i={method:"POST",path:"/1/tasks/{taskID}/run".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return t.request(i,a)},searchAuthentications(e,r){if(!e)throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");if(!e.authenticationIDs)throw new Error("Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`.");let n={method:"POST",path:"/1/authentications/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchDestinations(e,r){if(!e)throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");if(!e.destinationIDs)throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");let n={method:"POST",path:"/1/destinations/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchSources(e,r){if(!e)throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");if(!e.sourceIDs)throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");let n={method:"POST",path:"/1/sources/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTasks(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");let n={method:"POST",path:"/2/tasks/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTasksV1(e,r){if(!e)throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");if(!e.taskIDs)throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");let n={method:"POST",path:"/1/tasks/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},searchTransformations(e,r){if(!e)throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");if(!e.transformationIDs)throw new Error("Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`.");let n={method:"POST",path:"/1/transformations/search",queryParameters:{},headers:{},data:e};return t.request(n,r)},triggerDockerSourceDiscover({sourceID:e},r){if(!e)throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");let n={method:"POST",path:"/1/sources/{sourceID}/discover".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},t.request(n,r)},tryTransformation(e,r){if(!e)throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");if(!e.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");let n={method:"POST",path:"/1/transformations/try",queryParameters:{},headers:{},data:e};return t.request(n,r)},tryTransformationBeforeUpdate({transformationID:e,transformationTry:r},a){if(!e)throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");if(!r)throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");if(!r.sampleRecord)throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.");let i={method:"POST",path:"/1/transformations/{transformationID}/try".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateAuthentication({authenticationID:e,authenticationUpdate:r},a){if(!e)throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");if(!r)throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");let i={method:"PATCH",path:"/1/authentications/{authenticationID}".replace("{authenticationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateDestination({destinationID:e,destinationUpdate:r},a){if(!e)throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");if(!r)throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");let i={method:"PATCH",path:"/1/destinations/{destinationID}".replace("{destinationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateSource({sourceID:e,sourceUpdate:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `updateSource`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");let i={method:"PATCH",path:"/1/sources/{sourceID}".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTask({taskID:e,taskUpdate:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTask`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");let i={method:"PATCH",path:"/2/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTaskV1({taskID:e,taskUpdate:r},a){if(!e)throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");if(!r)throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");let i={method:"PATCH",path:"/1/tasks/{taskID}".replace("{taskID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},updateTransformation({transformationID:e,transformationCreate:r},a){if(!e)throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");if(!r)throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");if(!r.name)throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");let i={method:"PUT",path:"/1/transformations/{transformationID}".replace("{transformationID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return t.request(i,a)},validateSource(e,r=void 0){let n={method:"POST",path:"/1/sources/validate",queryParameters:{},headers:{},data:e||{}};return r={timeouts:{connect:18e4,read:18e4,write:18e4,...r?.timeouts}},t.request(n,r)},validateSourceBeforeUpdate({sourceID:e,sourceUpdate:r},a){if(!e)throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");if(!r)throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");let i={method:"POST",path:"/1/sources/{sourceID}/validate".replace("{sourceID}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return a={timeouts:{connect:18e4,read:18e4,write:18e4,...a?.timeouts}},t.request(i,a)}}}function $(c,d,l,m){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");if(!l||l&&(typeof l!="string"||!Ee.includes(l)))throw new Error(`\`region\` is required and must be one of the following: ${Ee.join(", ")}`);let{compression:P,...p}=m||{};return nr({appId:c,apiKey:d,region:l,timeouts:{connect:25e3,read:25e3,write:25e3},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${Se}-${c}`}),E()]}),...p})}var Te="1.52.0";function or(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function ir({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=I(c,d,l),h=b({hosts:or(),...P,algoliaAgent:C({algoliaAgents:m,client:"Monitoring",version:Te}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return {transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e});},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t;},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},getClusterIncidents({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let o={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getClusterStatus({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let o={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getIncidents(t){let s={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return h.request(s,t)},getIndexingTime({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let o={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getLatency({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let o={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getMetrics({metric:t,period:e},r){if(!t)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!e)throw new Error("Parameter `period` is required when calling `getMetrics`.");let n={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(t)).replace("{period}",encodeURIComponent(e)),queryParameters:{},headers:{}};return h.request(n,r)},getReachability({clusters:t},e){if(!t)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let o={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(t)),queryParameters:{},headers:{}};return h.request(o,e)},getServers(t){let s={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return h.request(s,t)},getStatus(t){let s={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return h.request(s,t)}}}function ve(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ir({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${Te}-${c}`}),E()]}),...P})}var Re="5.52.0";function cr(c){return [{url:`${c}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${c}.algolia.net`,accept:"write",protocol:"https"}].concat(F([{url:`${c}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${c}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ur({appId:c,apiKey:d,authMode:l,algoliaAgents:m,...P}){let p=I(c,d,l),h=b({hosts:cr(c),...P,algoliaAgent:C({algoliaAgents:m,client:"Recommend",version:Re}),baseHeaders:{"content-type":"text/plain",...p.headers(),...P.baseHeaders},baseQueryParameters:{...p.queryParameters(),...P.baseQueryParameters}});return {transporter:h,appId:c,apiKey:d,clearCache(){return Promise.all([h.requestsCache.clear(),h.responsesCache.clear()]).then(()=>{})},get _ua(){return h.algoliaAgent.value},addAlgoliaAgent(t,e){h.algoliaAgent.add({segment:t,version:e});},setClientApiKey({apiKey:t}){!l||l==="WithinHeaders"?h.baseHeaders["x-algolia-api-key"]=t:h.baseQueryParameters["x-algolia-api-key"]=t;},batchRecommendRules({indexName:t,model:e,recommendRule:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `batchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `batchRecommendRules`.");let i={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/batch".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return h.request(i,a)},customDelete({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customDelete`.");let n={method:"DELETE",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customGet({path:t,parameters:e},r){if(!t)throw new Error("Parameter `path` is required when calling `customGet`.");let n={method:"GET",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{}};return h.request(n,r)},customPost({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPost`.");let i={method:"POST",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},customPut({path:t,parameters:e,body:r},a){if(!t)throw new Error("Parameter `path` is required when calling `customPut`.");let i={method:"PUT",path:"/{path}".replace("{path}",t),queryParameters:e||{},headers:{},data:r||{}};return h.request(i,a)},deleteRecommendRule({indexName:t,model:e,objectID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");let i={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendRule({indexName:t,model:e,objectID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");let i={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendStatus({indexName:t,model:e,taskID:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");if(!e)throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");let i={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return h.request(i,a)},getRecommendations(t,e){if(t&&Array.isArray(t)&&(t={requests:t}),!t)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!t.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");let o={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:t,useReadTransporter:true,cacheable:true};return h.request(o,e)},searchRecommendRules({indexName:t,model:e,searchRecommendRulesParams:r},a){if(!t)throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");if(!e)throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");let i={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(t)).replace("{model}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:true,cacheable:true};return h.request(i,a)}}}function Ie(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let{compression:m,...P}=l||{};return ur({appId:c,apiKey:d,timeouts:{connect:1e3,read:2e3,write:3e4},logger:A(),requester:D(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:E(),requestsCache:E({serializable:false}),hostsCache:v({caches:[R({key:`${Re}-${c}`}),E()]}),...P})}function bt(c,d,l){if(!c||typeof c!="string")throw new Error("`appId` is missing.");if(!d||typeof d!="string")throw new Error("`apiKey` is missing.");let m=ye(c,d,l),P;l?.transformationOptions?P=l.transformationOptions:l?.transformation&&(P={region:l.transformation.region});let p;if(P){if(!P.region)throw new Error("`region` is required in `transformationOptions`. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let{region:h,...t}=P;p=$(c,d,h,t);}return {...m,async saveObjectsWithTransformation({indexName:h,objects:t,waitForTasks:e},r){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return p.chunkedPush({indexName:h,objects:t,action:"addObject",waitForTasks:e},r)},async partialUpdateObjectsWithTransformation({indexName:h,objects:t,createIfNotExists:e,waitForTasks:r},a){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");return p.chunkedPush({indexName:h,objects:t,action:e?"partialUpdateObject":"partialUpdateObjectNoCreate",waitForTasks:r},a)},async replaceAllObjectsWithTransformation({indexName:h,objects:t,batchSize:e,scopes:r},a){if(!p)throw new Error("`transformationOptions` must be set in the client config before calling this method. It defaults to the Ingestion API defaults. See https://www.algolia.com/doc/libraries/sdk/methods/ingestion/");let s=Math.floor(Math.random()*1e6)+1e5,o=`${h}_tmp_${s}`;r===void 0&&(r=["settings","rules","synonyms"]);try{let n=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:o,scope:r}},a),i=await p.chunkedPush({indexName:o,objects:t,waitForTasks:!0,batchSize:e,referenceIndexName:h},a);await this.waitForTask({indexName:o,taskID:n.taskID}),n=await this.operationIndex({indexName:h,operationIndexParams:{operation:"copy",destination:o,scope:r}},a),await this.waitForTask({indexName:o,taskID:n.taskID});let u=await this.operationIndex({indexName:o,operationIndexParams:{operation:"move",destination:h}},a);return await this.waitForTask({indexName:o,taskID:u.taskID}),{copyOperationResponse:n,watchResponses:i,moveOperationResponse:u}}catch(n){throw await this.deleteIndex({indexName:o}),n}},get _ua(){return m.transporter.algoliaAgent.value},initAbtesting:h=>ie(h.appId||c,h.apiKey||d,h.region,h.options),initAbtestingV3:h=>se(h.appId||c,h.apiKey||d,h.region,h.options),initAnalytics:h=>he(h.appId||c,h.apiKey||d,h.region,h.options),initIngestion:h=>$(h.appId||c,h.apiKey||d,h.region,h.options),initInsights:h=>me(h.appId||c,h.apiKey||d,h.region,h.options),initMonitoring:(h={})=>ve(h.appId||c,h.apiKey||d,h.options),initPersonalization:h=>Pe(h.appId||c,h.apiKey||d,h.region,h.options),initQuerySuggestions:h=>fe(h.appId||c,h.apiKey||d,h.region,h.options),initRecommend:(h={})=>Ie(h.appId||c,h.apiKey||d,h.options)}}
8
8
 
9
9
  exports.abtestingClient = ie;
10
10
  exports.abtestingV3Client = se;