@algolia/recommend 5.54.0 → 5.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,11 +40,11 @@ All of our clients comes with type definition, and are available for both browse
40
40
  ### With a package manager
41
41
 
42
42
  ```bash
43
- yarn add @algolia/recommend@5.54.0
43
+ yarn add @algolia/recommend@5.54.1
44
44
  # or
45
- npm install @algolia/recommend@5.54.0
45
+ npm install @algolia/recommend@5.54.1
46
46
  # or
47
- pnpm add @algolia/recommend@5.54.0
47
+ pnpm add @algolia/recommend@5.54.1
48
48
  ```
49
49
 
50
50
  ### Without a package manager
@@ -52,7 +52,7 @@ pnpm add @algolia/recommend@5.54.0
52
52
  Add the following JavaScript snippet to the <head> of your website:
53
53
 
54
54
  ```html
55
- <script src="https://cdn.jsdelivr.net/npm/@algolia/recommend@5.54.0/dist/builds/browser.umd.js"></script>
55
+ <script src="https://cdn.jsdelivr.net/npm/@algolia/recommend@5.54.1/dist/builds/browser.umd.js"></script>
56
56
  ```
57
57
 
58
58
  ### Usage
package/dist/browser.d.ts CHANGED
@@ -1423,7 +1423,7 @@ type SearchRecommendRulesProps = {
1423
1423
  searchRecommendRulesParams?: SearchRecommendRulesParams | undefined;
1424
1424
  };
1425
1425
 
1426
- declare const apiClientVersion = "5.54.0";
1426
+ declare const apiClientVersion = "5.54.1";
1427
1427
  declare function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
1428
1428
  transporter: _algolia_client_common.Transporter;
1429
1429
  /**
@@ -9,7 +9,7 @@ import { createXhrRequester } from "@algolia/requester-browser-xhr";
9
9
 
10
10
  // src/recommendClient.ts
11
11
  import { createAuth, createTransporter, getAlgoliaAgent, shuffle, validateRequired } from "@algolia/client-common";
12
- var apiClientVersion = "5.54.0";
12
+ var apiClientVersion = "5.54.1";
13
13
  function getDefaultHosts(appId) {
14
14
  return [
15
15
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../builds/browser.ts","../../src/recommendClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createRecommendClient } from '../src/recommendClient';\n\nexport { apiClientVersion } from '../src/recommendClient';\n\nexport * from '../model';\n\nexport function recommendClient(appId: string, apiKey: string, options?: ClientOptions | undefined): RecommendClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createRecommendClient({\n appId,\n apiKey,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type RecommendClient = ReturnType<typeof createRecommendClient>;\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, shuffle, validateRequired } from '@algolia/client-common';\n\nimport type { DeletedAtResponse } from '../model/deletedAtResponse';\nimport type { GetRecommendTaskResponse } from '../model/getRecommendTaskResponse';\nimport type { GetRecommendationsParams } from '../model/getRecommendationsParams';\nimport type { GetRecommendationsResponse } from '../model/getRecommendationsResponse';\nimport type { RecommendRule } from '../model/recommendRule';\nimport type { RecommendUpdatedAtResponse } from '../model/recommendUpdatedAtResponse';\nimport type { SearchRecommendRulesResponse } from '../model/searchRecommendRulesResponse';\n\nimport type {\n BatchRecommendRulesProps,\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteRecommendRuleProps,\n GetRecommendRuleProps,\n GetRecommendStatusProps,\n LegacyGetRecommendationsParams,\n SearchRecommendRulesProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.54.0';\n\nfunction getDefaultHosts(appId: string): Host[] {\n return (\n [\n {\n url: `${appId}-dsn.algolia.net`,\n accept: 'read',\n protocol: 'https',\n },\n {\n url: `${appId}.algolia.net`,\n accept: 'write',\n protocol: 'https',\n },\n ] as Host[]\n ).concat(\n shuffle([\n {\n url: `${appId}-1.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-2.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-3.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n ]),\n );\n}\n\nexport function createRecommendClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n ...options\n}: CreateClientOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(appIdOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Recommend',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Create or update a batch of Recommend Rules Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn\\'t require a facet value placeholder (it tries to match the data source item\\'s attributes instead).\n *\n * Required API Key ACLs:\n * - editSettings\n * @param batchRecommendRules - The batchRecommendRules object.\n * @param batchRecommendRules.indexName - Name of the index on which to perform the operation.\n * @param batchRecommendRules.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param batchRecommendRules.recommendRule - The recommendRule object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n batchRecommendRules(\n { indexName, model, recommendRule }: BatchRecommendRulesProps,\n requestOptions?: RequestOptions,\n ): Promise<RecommendUpdatedAtResponse> {\n validateRequired('indexName', 'batchRecommendRules', indexName);\n\n validateRequired('model', 'batchRecommendRules', model);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/batch'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: recommendRule ? recommendRule : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a Recommend rule from a recommendation scenario.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteRecommendRule - The deleteRecommendRule object.\n * @param deleteRecommendRule.indexName - Name of the index on which to perform the operation.\n * @param deleteRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param deleteRecommendRule.objectID - Unique record identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteRecommendRule(\n { indexName, model, objectID }: DeleteRecommendRuleProps,\n requestOptions?: RequestOptions,\n ): Promise<DeletedAtResponse> {\n validateRequired('indexName', 'deleteRecommendRule', indexName);\n\n validateRequired('model', 'deleteRecommendRule', model);\n\n validateRequired('objectID', 'deleteRecommendRule', objectID);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{objectID}', encodeURIComponent(objectID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a Recommend rule that you previously created in the Algolia dashboard.\n *\n * Required API Key ACLs:\n * - settings\n * @param getRecommendRule - The getRecommendRule object.\n * @param getRecommendRule.indexName - Name of the index on which to perform the operation.\n * @param getRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param getRecommendRule.objectID - Unique record identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendRule(\n { indexName, model, objectID }: GetRecommendRuleProps,\n requestOptions?: RequestOptions,\n ): Promise<RecommendRule> {\n validateRequired('indexName', 'getRecommendRule', indexName);\n\n validateRequired('model', 'getRecommendRule', model);\n\n validateRequired('objectID', 'getRecommendRule', objectID);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{objectID}', encodeURIComponent(objectID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Checks the status of a given task. Deleting a Recommend rule is asynchronous. When you delete a rule, a task is created on a queue and completed depending on the load on the server. The API response includes a task ID that you can use to check the status.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param getRecommendStatus - The getRecommendStatus object.\n * @param getRecommendStatus.indexName - Name of the index on which to perform the operation.\n * @param getRecommendStatus.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param getRecommendStatus.taskID - Unique task identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendStatus(\n { indexName, model, taskID }: GetRecommendStatusProps,\n requestOptions?: RequestOptions,\n ): Promise<GetRecommendTaskResponse> {\n validateRequired('indexName', 'getRecommendStatus', indexName);\n\n validateRequired('model', 'getRecommendStatus', model);\n\n validateRequired('taskID', 'getRecommendStatus', taskID);\n\n const requestPath = '/1/indexes/{indexName}/{model}/task/{taskID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{taskID}', encodeURIComponent(taskID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves recommendations from selected AI models.\n *\n * Required API Key ACLs:\n * - search\n * @param getRecommendationsParams - The getRecommendationsParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendations(\n getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams,\n requestOptions?: RequestOptions,\n ): Promise<GetRecommendationsResponse> {\n if (getRecommendationsParams && Array.isArray(getRecommendationsParams)) {\n const newSignatureRequest: GetRecommendationsParams = {\n requests: getRecommendationsParams,\n };\n\n getRecommendationsParams = newSignatureRequest;\n }\n\n validateRequired('getRecommendationsParams', 'getRecommendations', getRecommendationsParams);\n\n validateRequired('getRecommendationsParams.requests', 'getRecommendations', getRecommendationsParams.requests);\n\n const requestPath = '/1/indexes/*/recommendations';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: getRecommendationsParams,\n useReadTransporter: true,\n cacheable: true,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Searches for Recommend rules. Use an empty query to list all rules for this recommendation scenario.\n *\n * Required API Key ACLs:\n * - settings\n * @param searchRecommendRules - The searchRecommendRules object.\n * @param searchRecommendRules.indexName - Name of the index on which to perform the operation.\n * @param searchRecommendRules.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n searchRecommendRules(\n { indexName, model, searchRecommendRulesParams }: SearchRecommendRulesProps,\n requestOptions?: RequestOptions,\n ): Promise<SearchRecommendRulesResponse> {\n validateRequired('indexName', 'searchRecommendRules', indexName);\n\n validateRequired('model', 'searchRecommendRules', model);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/search'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: searchRecommendRulesParams ? searchRecommendRulesParams : {},\n useReadTransporter: true,\n cacheable: true,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,SAAS,wBAAwB;AAuBnF,IAAM,mBAAmB;AAEhC,SAAS,gBAAgB,OAAuB;AAC9C,SACE;AAAA,IACE;AAAA,MACE,KAAK,GAAG,KAAK;AAAA,MACb,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,MACE,K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ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createRecommendClient } from '../src/recommendClient';\n\nexport { apiClientVersion } from '../src/recommendClient';\n\nexport * from '../model';\n\nexport function recommendClient(appId: string, apiKey: string, options?: ClientOptions | undefined): RecommendClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createRecommendClient({\n appId,\n apiKey,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type RecommendClient = ReturnType<typeof createRecommendClient>;\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, shuffle, validateRequired } from '@algolia/client-common';\n\nimport type { DeletedAtResponse } from '../model/deletedAtResponse';\nimport type { GetRecommendTaskResponse } from '../model/getRecommendTaskResponse';\nimport type { GetRecommendationsParams } from '../model/getRecommendationsParams';\nimport type { GetRecommendationsResponse } from '../model/getRecommendationsResponse';\nimport type { RecommendRule } from '../model/recommendRule';\nimport type { RecommendUpdatedAtResponse } from '../model/recommendUpdatedAtResponse';\nimport type { SearchRecommendRulesResponse } from '../model/searchRecommendRulesResponse';\n\nimport type {\n BatchRecommendRulesProps,\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteRecommendRuleProps,\n GetRecommendRuleProps,\n GetRecommendStatusProps,\n LegacyGetRecommendationsParams,\n SearchRecommendRulesProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.54.1';\n\nfunction getDefaultHosts(appId: string): Host[] {\n return (\n [\n {\n url: `${appId}-dsn.algolia.net`,\n accept: 'read',\n protocol: 'https',\n },\n {\n url: `${appId}.algolia.net`,\n accept: 'write',\n protocol: 'https',\n },\n ] as Host[]\n ).concat(\n shuffle([\n {\n url: `${appId}-1.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-2.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-3.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n ]),\n );\n}\n\nexport function createRecommendClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n ...options\n}: CreateClientOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(appIdOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Recommend',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Create or update a batch of Recommend Rules Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn\\'t require a facet value placeholder (it tries to match the data source item\\'s attributes instead).\n *\n * Required API Key ACLs:\n * - editSettings\n * @param batchRecommendRules - The batchRecommendRules object.\n * @param batchRecommendRules.indexName - Name of the index on which to perform the operation.\n * @param batchRecommendRules.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param batchRecommendRules.recommendRule - The recommendRule object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n batchRecommendRules(\n { indexName, model, recommendRule }: BatchRecommendRulesProps,\n requestOptions?: RequestOptions,\n ): Promise<RecommendUpdatedAtResponse> {\n validateRequired('indexName', 'batchRecommendRules', indexName);\n\n validateRequired('model', 'batchRecommendRules', model);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/batch'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: recommendRule ? recommendRule : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a Recommend rule from a recommendation scenario.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteRecommendRule - The deleteRecommendRule object.\n * @param deleteRecommendRule.indexName - Name of the index on which to perform the operation.\n * @param deleteRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param deleteRecommendRule.objectID - Unique record identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteRecommendRule(\n { indexName, model, objectID }: DeleteRecommendRuleProps,\n requestOptions?: RequestOptions,\n ): Promise<DeletedAtResponse> {\n validateRequired('indexName', 'deleteRecommendRule', indexName);\n\n validateRequired('model', 'deleteRecommendRule', model);\n\n validateRequired('objectID', 'deleteRecommendRule', objectID);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{objectID}', encodeURIComponent(objectID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a Recommend rule that you previously created in the Algolia dashboard.\n *\n * Required API Key ACLs:\n * - settings\n * @param getRecommendRule - The getRecommendRule object.\n * @param getRecommendRule.indexName - Name of the index on which to perform the operation.\n * @param getRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param getRecommendRule.objectID - Unique record identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendRule(\n { indexName, model, objectID }: GetRecommendRuleProps,\n requestOptions?: RequestOptions,\n ): Promise<RecommendRule> {\n validateRequired('indexName', 'getRecommendRule', indexName);\n\n validateRequired('model', 'getRecommendRule', model);\n\n validateRequired('objectID', 'getRecommendRule', objectID);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{objectID}', encodeURIComponent(objectID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Checks the status of a given task. Deleting a Recommend rule is asynchronous. When you delete a rule, a task is created on a queue and completed depending on the load on the server. The API response includes a task ID that you can use to check the status.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param getRecommendStatus - The getRecommendStatus object.\n * @param getRecommendStatus.indexName - Name of the index on which to perform the operation.\n * @param getRecommendStatus.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param getRecommendStatus.taskID - Unique task identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendStatus(\n { indexName, model, taskID }: GetRecommendStatusProps,\n requestOptions?: RequestOptions,\n ): Promise<GetRecommendTaskResponse> {\n validateRequired('indexName', 'getRecommendStatus', indexName);\n\n validateRequired('model', 'getRecommendStatus', model);\n\n validateRequired('taskID', 'getRecommendStatus', taskID);\n\n const requestPath = '/1/indexes/{indexName}/{model}/task/{taskID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{taskID}', encodeURIComponent(taskID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves recommendations from selected AI models.\n *\n * Required API Key ACLs:\n * - search\n * @param getRecommendationsParams - The getRecommendationsParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendations(\n getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams,\n requestOptions?: RequestOptions,\n ): Promise<GetRecommendationsResponse> {\n if (getRecommendationsParams && Array.isArray(getRecommendationsParams)) {\n const newSignatureRequest: GetRecommendationsParams = {\n requests: getRecommendationsParams,\n };\n\n getRecommendationsParams = newSignatureRequest;\n }\n\n validateRequired('getRecommendationsParams', 'getRecommendations', getRecommendationsParams);\n\n validateRequired('getRecommendationsParams.requests', 'getRecommendations', getRecommendationsParams.requests);\n\n const requestPath = '/1/indexes/*/recommendations';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: getRecommendationsParams,\n useReadTransporter: true,\n cacheable: true,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Searches for Recommend rules. Use an empty query to list all rules for this recommendation scenario.\n *\n * Required API Key ACLs:\n * - settings\n * @param searchRecommendRules - The searchRecommendRules object.\n * @param searchRecommendRules.indexName - Name of the index on which to perform the operation.\n * @param searchRecommendRules.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n searchRecommendRules(\n { indexName, model, searchRecommendRulesParams }: SearchRecommendRulesProps,\n requestOptions?: RequestOptions,\n ): Promise<SearchRecommendRulesResponse> {\n validateRequired('indexName', 'searchRecommendRules', indexName);\n\n validateRequired('model', 'searchRecommendRules', model);\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/search'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: searchRecommendRulesParams ? searchRecommendRulesParams : {},\n useReadTransporter: true,\n cacheable: true,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,SAAS,wBAAwB;AAuBnF,IAAM,mBAAmB;AAEhC,SAAS,gBAAgB,OAAuB;AAC9C,SACE;AAAA,IACE;AAAA,MACE,KAAK,GAAG,KAAK;AAAA,MACb,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,MACE,KAAK,GAAG,KAAK;AAAA,MACb,QAAQ;AAAA,MACR,UAAU;A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B,SAAS,CAAC,EACpD,QAAQ,WAAW,mBAAmB,KAAK,CAAC;AAC/C,YAAM,UAAmB,CAAC;AAC1B,YAAM,kBAAmC,CAAC;AAE1C,YAAM,UAAmB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,MAAM,6BAA6B,6BAA6B,CAAC;AAAA,QACjE,oBAAoB;AAAA,QACpB,WAAW;AAAA,MACb;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;;;ADpdO,SAAS,gBAAgB,OAAe,QAAgB,SAAsD;AACnH,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI,WAAW,CAAC;AAErE,SAAO,sBAAsB;AAAA,IAC3B;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
@@ -1,6 +1,6 @@
1
- function V(e){let t,r=`algolia-client-js-${e.key}`;function o(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function i(){return JSON.parse(o().getItem(r)||"{}")}function d(s){o().setItem(r,JSON.stringify(s))}function c(){return new Promise(s=>setTimeout(s,0))}function n(){let s=e.timeToLive?e.timeToLive*1e3:null,a=i(),m=new Date().getTime(),f=!1;return{namespace:Object.fromEntries(Object.entries(a).filter(([,p])=>!p||p.timestamp===void 0||s&&p.timestamp+s<m?(f=!0,!1):!0)),changed:f}}return{get(s,a,m={miss:()=>Promise.resolve()}){return c().then(()=>{let{namespace:f,changed:R}=n(),p=f[JSON.stringify(s)];return R&&d(f),p?p.value:a().then(x=>m.miss(x).then(()=>x))})},set(s,a){return c().then(()=>{let m=i();return m[JSON.stringify(s)]={timestamp:new Date().getTime(),value:a},o().setItem(r,JSON.stringify(m)),a})},delete(s){return c().then(()=>{let a=i();delete a[JSON.stringify(s)],o().setItem(r,JSON.stringify(a))})},clear(){return Promise.resolve().then(()=>{o().removeItem(r)})}}}function ce(){return{get(e,t,r={miss:()=>Promise.resolve()}){return t().then(i=>Promise.all([i,r.miss(i)])).then(([i])=>i)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}function C(e){let t=[...e.caches],r=t.shift();return r===void 0?ce():{get(o,i,d={miss:()=>Promise.resolve()}){return r.get(o,i,d).catch(()=>C({caches:t}).get(o,i,d))},set(o,i){return r.set(o,i).catch(()=>C({caches:t}).set(o,i))},delete(o){return r.delete(o).catch(()=>C({caches:t}).delete(o))},clear(){return r.clear().catch(()=>C({caches:t}).clear())}}}function k(e={serializable:!0}){let t={};return{get(r,o,i={miss:()=>Promise.resolve()}){let d=JSON.stringify(r);if(d in t)return Promise.resolve(e.serializable?JSON.parse(t[d]):t[d]);let c=o();return c.then(n=>i.miss(n)).then(()=>c)},set(r,o){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(o):o,Promise.resolve(o)},delete(r){return delete t[JSON.stringify(r)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}function me(e){let t={value:`Algolia for JavaScript (${e})`,add(r){let o=`; ${r.segment}${r.version!==void 0?` (${r.version})`:""}`;return t.value.indexOf(o)===-1&&(t.value=`${t.value}${o}`),t}};return t}function Y(e,t,r="WithinHeaders"){let o={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers(){return r==="WithinHeaders"?o:{}},queryParameters(){return r==="WithinQueryParameters"?o:{}}}}function Z({algoliaAgents:e,client:t,version:r}){let o=me(r).add({segment:t,version:r});return e.forEach(i=>o.add(i)),o}function ee(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var ue=10*1024*1024;async function*le(e){let t=e.getReader();try{for(;;){let{done:r,value:o}=await t.read();if(r)return;yield o}}finally{t.releaseLock()}}function de(e){return Symbol.asyncIterator in e?e:le(e)}async function*pe(e){let t=new TextDecoder("utf-8"),r=[],o=0,i=!1,d=!0;for await(let n of de(e)){let s=t.decode(n,{stream:!0}),a=0;for(i&&(i=!1,s.length>0&&s[0]===`
1
+ function V(e){let t,o=`algolia-client-js-${e.key}`;function r(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function i(){return JSON.parse(r().getItem(o)||"{}")}function d(s){r().setItem(o,JSON.stringify(s))}function c(){return new Promise(s=>setTimeout(s,0))}function n(){let s=e.timeToLive?e.timeToLive*1e3:null,a=i(),m=new Date().getTime(),f=!1;return{namespace:Object.fromEntries(Object.entries(a).filter(([,p])=>!p||p.timestamp===void 0||s&&p.timestamp+s<m?(f=!0,!1):!0)),changed:f}}return{get(s,a,m={miss:()=>Promise.resolve()}){return c().then(()=>{let{namespace:f,changed:R}=n(),p=f[JSON.stringify(s)];return R&&d(f),p?p.value:a().then(x=>m.miss(x).then(()=>x))})},set(s,a){return c().then(()=>{let m=i();return m[JSON.stringify(s)]={timestamp:new Date().getTime(),value:a},r().setItem(o,JSON.stringify(m)),a})},delete(s){return c().then(()=>{let a=i();delete a[JSON.stringify(s)],r().setItem(o,JSON.stringify(a))})},clear(){return Promise.resolve().then(()=>{r().removeItem(o)})}}}function ce(){return{get(e,t,o={miss:()=>Promise.resolve()}){return t().then(i=>Promise.all([i,o.miss(i)])).then(([i])=>i)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}function C(e){let t=[...e.caches],o=t.shift();return o===void 0?ce():{get(r,i,d={miss:()=>Promise.resolve()}){return o.get(r,i,d).catch(()=>C({caches:t}).get(r,i,d))},set(r,i){return o.set(r,i).catch(()=>C({caches:t}).set(r,i))},delete(r){return o.delete(r).catch(()=>C({caches:t}).delete(r))},clear(){return o.clear().catch(()=>C({caches:t}).clear())}}}function k(e={serializable:!0}){let t={};return{get(o,r,i={miss:()=>Promise.resolve()}){let d=JSON.stringify(o);if(d in t)return Promise.resolve(e.serializable?JSON.parse(t[d]):t[d]);let c=r();return c.then(n=>i.miss(n)).then(()=>c)},set(o,r){return t[JSON.stringify(o)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(o){return delete t[JSON.stringify(o)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}function me(e){let t={value:`Algolia for JavaScript (${e})`,add(o){let r=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return t.value.indexOf(r)===-1&&(t.value=`${t.value}${r}`),t}};return t}function Y(e,t,o="WithinHeaders"){let r={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers(){return o==="WithinHeaders"?r:{}},queryParameters(){return o==="WithinQueryParameters"?r:{}}}}function Z({algoliaAgents:e,client:t,version:o}){let r=me(o).add({segment:t,version:o});return e.forEach(i=>r.add(i)),r}function ee(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var ue=10*1024*1024;async function*le(e){let t=e.getReader();try{for(;;){let{done:o,value:r}=await t.read();if(o)return;yield r}}finally{t.releaseLock()}}function de(e){return Symbol.asyncIterator in e?e:le(e)}async function*pe(e){let t=new TextDecoder("utf-8"),o=[],r=0,i=!1,d=!0;for await(let n of de(e)){let s=t.decode(n,{stream:!0}),a=0;for(i&&(i=!1,s.length>0&&s[0]===`
2
2
  `&&(a=1));a<s.length;){let m=s.indexOf("\r",a),f=s.indexOf(`
3
- `,a);if(m===-1&&f===-1){let u=s.slice(a);if(r.push(u),o+=u.length,o>ue)throw new Error("SSE line buffer exceeded 10MB");break}let R,p;m!==-1&&(f===-1||m<f)?(R=m,m+1<s.length?p=s[m+1]===`
4
- `?2:1:(i=!0,p=1)):(R=f,p=1);let x=s.slice(a,R);r.push(x);let A=r.length===1?r[0]:r.join("");r.length=0,o=0,d&&(A.startsWith("\uFEFF")&&(A=A.slice(1)),d=!1),yield A,a=R+p}}let c=t.decode();if(c&&r.push(c),r.length>0){let n=r.join("");d&&n.startsWith("\uFEFF")&&(n=n.slice(1)),yield n}}var fe=class{data=[];eventType="";lastEventId=null;retry=null;decode(e){if(e==="")return this.dispatch();if(e[0]===":")return null;let t=e.indexOf(":"),r,o;switch(t===-1?(r=e,o=""):(r=e.slice(0,t),o=e.slice(t+1),o[0]===" "&&(o=o.slice(1))),r){case"data":this.data.push(o);break;case"event":this.eventType=o;break;case"id":o.includes("\0")||(this.lastEventId=o);break;case"retry":/^[0-9]+$/.test(o)&&(this.retry=parseInt(o,10));break}return null}dispatch(){let e=this.eventType;if(this.eventType="",this.data.length===0)return null;let t={data:this.data.join(`
5
- `),event:e,id:this.lastEventId,retry:this.retry};return this.data=[],t}};async function*he(e){let t=new fe;for await(let r of pe(e)){let o=t.decode(r);o!==null&&(yield o)}}var Re=750,J=120*1e3;function M(e,t="up"){let r=Date.now();function o(){return t==="up"||Date.now()-r>J}function i(){return t==="timed out"&&Date.now()-r<=J}return{...e,status:t,lastUpdate:r,isUp:o,isTimedOut:i}}var te=class extends Error{name="AlgoliaError";constructor(e,t){super(e),t&&(this.name=t)}};var re=class extends te{stackTrace;constructor(e,t,r){super(e,r),this.stackTrace=t}},Q=class extends re{constructor(e){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",e,"RetryError")}},j=class extends re{status;constructor(e,t,r,o="ApiError"){super(e,r,o),this.status=t}},xe=class extends te{response;constructor(e,t){super(e,"DeserializationError"),this.response=t}},ge=class extends j{error;constructor(e,t,r,o){super(e,t,o,"DetailedApiError"),this.error=r}};function oe(e){let t=e;for(let r=e.length-1;r>0;r--){let o=Math.floor(Math.random()*(r+1)),i=e[r];t[r]=e[o],t[o]=i}return t}function B(e,t,r){let o=ye(r),i=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${t.charAt(0)==="/"?t.substring(1):t}`;return o.length&&(i+=`?${o}`),i}function ye(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${t}=${encodeURIComponent(Object.prototype.toString.call(e[t])==="[object Array]"?e[t].join(","):e[t]).replace(/\+/g,"%20")}`).join("&")}function X(e,t){if(e.method==="GET"||e.data===void 0&&t.data===void 0)return;let r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}function K(e,t,r){let o={Accept:"application/json",...e,...t,...r},i={};return Object.keys(o).forEach(d=>{let c=o[d];i[d.toLowerCase()]=c}),i}function Pe(e){if(!(e.status===204||e.content.length===0))try{return JSON.parse(e.content)}catch(t){throw new xe(t.message,e)}}function Te({content:e,status:t},r){try{let o=JSON.parse(e);return"error"in o?new ge(o.message,t,o.error,r):new j(o.message,t,r)}catch{}return new j(e,t,r)}function ve({isTimedOut:e,status:t}){return!e&&~~t===0}function Ee({isTimedOut:e,status:t}){return e||ve({isTimedOut:e,status:t})||~~(t/100)!==2&&~~(t/100)!==4}function qe({status:e}){return~~(e/100)===2}function we(e){return e.map(t=>se(t))}function se(e){let t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function ne({hosts:e,hostsCache:t,baseHeaders:r,logger:o,baseQueryParameters:i,algoliaAgent:d,timeouts:c,requester:n,requestsCache:s,responsesCache:a,compress:m,compression:f}){async function R(u){let l=await Promise.all(u.map(h=>t.get(h,()=>Promise.resolve(M(h))))),q=l.filter(h=>h.isUp()),T=l.filter(h=>h.isTimedOut()),E=[...q,...T];return{hosts:E.length>0?E:u,getTimeout(h,w){return(T.length===0&&h===0?1:T.length+3+h)*w}}}async function p(u,l,q){let T=[],E=X(u,l),y=K(r,u.headers,l.headers),h=f==="gzip"&&E!==void 0&&E.length>Re&&(u.method==="POST"||u.method==="PUT");h&&m===void 0&&o.info("Compression is disabled because no compress method is available.");let w=h&&m!==void 0,_=w?await m(E):E;w&&(y["content-encoding"]="gzip");let N=u.method==="GET"?{...u.data,...l.data}:{},S={...i,...u.queryParameters,...N};if(d.value&&(S["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let P of Object.keys(l.queryParameters))!l.queryParameters[P]||Object.prototype.toString.call(l.queryParameters[P])==="[object Object]"?S[P]=l.queryParameters[P]:S[P]=l.queryParameters[P].toString();let I=0,D=async(P,L)=>{let O=P.pop();if(O===void 0)throw new Q(we(T));let H={...c,...l.timeouts},W={data:_,headers:y,method:u.method,url:B(O,u.path,S),connectTimeout:L(I,H.connect),responseTimeout:L(I,q?H.read:H.write)},F=$=>{let z={request:W,response:$,host:O,triesLeft:P.length};return T.push(z),z},b=await n.send(W);if(Ee(b)){let $=F(b);return b.isTimedOut&&I++,o.info("Retryable failure",se($)),await t.set(O,M(O,b.isTimedOut?"timed out":"down")),D(P,L)}if(qe(b))return Pe(b);throw F(b),Te(b,T)},v=e.filter(P=>P.accept==="readWrite"||(q?P.accept==="read":P.accept==="write")),G=await R(v);return D([...G.hosts].reverse(),G.getTimeout)}function x(u,l={}){let q=()=>p(u,l,T),T=u.useReadTransporter||u.method==="GET";if((l.cacheable||u.cacheable)!==!0)return q();let y={request:u,requestOptions:l,transporter:{queryParameters:i,headers:r}};return a.get(y,()=>s.get(y,()=>s.set(y,q()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,w])=>w)),{miss:h=>a.set(y,h)})}async function*A(u,l={}){if(!n.sendStream)throw new Error("This requester does not support streaming");let q=X(u,l),T=K(r,u.headers,l.headers);T.accept="text/event-stream";let E=u.method==="GET"?{...u.data,...l.data}:{},y={...i,...u.queryParameters,...E};if(d.value&&(y["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let v of Object.keys(l.queryParameters))!l.queryParameters[v]||Object.prototype.toString.call(l.queryParameters[v])==="[object Object]"?y[v]=l.queryParameters[v]:y[v]=l.queryParameters[v].toString();let h=u.useReadTransporter||u.method==="GET",w=e.filter(v=>v.accept==="readWrite"||(h?v.accept==="read":v.accept==="write")),N=(await R(w)).hosts[0];if(!N)throw new Q([]);let S={...c,...l.timeouts},I={data:q,headers:T,method:u.method,url:B(N,u.path,y),connectTimeout:S.connect,responseTimeout:h?S.read:S.write},D=await n.sendStream(I);yield*he(D)}return{hostsCache:t,requester:n,timeouts:c,logger:o,algoliaAgent:d,baseHeaders:r,baseQueryParameters:i,hosts:e,request:x,requestStream:A,requestsCache:s,responsesCache:a}}function g(e,t,r){if(r==null||typeof r=="string"&&r.length===0)throw new Error(`Parameter \`${e}\` is required when calling \`${t}\`.`)}function ae(){function e(t){return new Promise(r=>{let o=new XMLHttpRequest;o.open(t.method,t.url,!0),Object.keys(t.headers).forEach(n=>o.setRequestHeader(n,t.headers[n]));let i=(n,s)=>setTimeout(()=>{o.abort(),r({status:0,content:s,isTimedOut:!0})},n),d=i(t.connectTimeout,"Connection timeout"),c;o.onreadystatechange=()=>{o.readyState>o.OPENED&&c===void 0&&(clearTimeout(d),c=i(t.responseTimeout,"Socket timeout"))},o.onerror=()=>{o.status===0&&(clearTimeout(d),clearTimeout(c),r({content:o.responseText||"Network request failed",status:o.status,isTimedOut:!1}))},o.onload=()=>{clearTimeout(d),clearTimeout(c),r({content:o.responseText,status:o.status,isTimedOut:!1})},o.send(t.data)})}return{send:e}}var U="5.54.0";function Se(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(oe([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ie({appId:e,apiKey:t,authMode:r,algoliaAgents:o,...i}){let d=Y(e,t,r),c=ne({hosts:Se(e),...i,algoliaAgent:Z({algoliaAgents:o,client:"Recommend",version:U}),baseHeaders:{"content-type":"text/plain",...d.headers(),...i.baseHeaders},baseQueryParameters:{...d.queryParameters(),...i.baseQueryParameters}});return{transporter:c,appId:e,apiKey:t,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(n,s){c.algoliaAgent.add({segment:n,version:s})},setClientApiKey({apiKey:n}){!r||r==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=n:c.baseQueryParameters["x-algolia-api-key"]=n},batchRecommendRules({indexName:n,model:s,recommendRule:a},m){g("indexName","batchRecommendRules",n),g("model","batchRecommendRules",s);let x={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/batch".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)),queryParameters:{},headers:{},data:a||{}};return c.request(x,m)},customDelete({path:n,parameters:s},a){g("path","customDelete",n);let p={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{}};return c.request(p,a)},customGet({path:n,parameters:s},a){g("path","customGet",n);let p={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{}};return c.request(p,a)},customPost({path:n,parameters:s,body:a},m){g("path","customPost",n);let x={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{},data:a||{}};return c.request(x,m)},customPut({path:n,parameters:s,body:a},m){g("path","customPut",n);let x={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{},data:a||{}};return c.request(x,m)},deleteRecommendRule({indexName:n,model:s,objectID:a},m){g("indexName","deleteRecommendRule",n),g("model","deleteRecommendRule",s),g("objectID","deleteRecommendRule",a);let x={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(x,m)},getRecommendRule({indexName:n,model:s,objectID:a},m){g("indexName","getRecommendRule",n),g("model","getRecommendRule",s),g("objectID","getRecommendRule",a);let x={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(x,m)},getRecommendStatus({indexName:n,model:s,taskID:a},m){g("indexName","getRecommendStatus",n),g("model","getRecommendStatus",s),g("taskID","getRecommendStatus",a);let x={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)).replace("{taskID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(x,m)},getRecommendations(n,s){n&&Array.isArray(n)&&(n={requests:n}),g("getRecommendationsParams","getRecommendations",n),g("getRecommendationsParams.requests","getRecommendations",n.requests);let R={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:n,useReadTransporter:!0,cacheable:!0};return c.request(R,s)},searchRecommendRules({indexName:n,model:s,searchRecommendRulesParams:a},m){g("indexName","searchRecommendRules",n),g("model","searchRecommendRules",s);let x={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)),queryParameters:{},headers:{},data:a||{},useReadTransporter:!0,cacheable:!0};return c.request(x,m)}}}function Or(e,t,r){if(!e||typeof e!="string")throw new Error("`appId` is missing.");if(!t||typeof t!="string")throw new Error("`apiKey` is missing.");let{compression:o,...i}=r||{};return ie({appId:e,apiKey:t,timeouts:{connect:1e3,read:2e3,write:3e4},logger:ee(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:k(),requestsCache:k({serializable:!1}),hostsCache:C({caches:[V({key:`${U}-${e}`}),k()]}),...i})}export{U as apiClientVersion,Or as recommendClient};
3
+ `,a);if(m===-1&&f===-1){let u=s.slice(a);if(o.push(u),r+=u.length,r>ue)throw new Error("SSE line buffer exceeded 10MB");break}let R,p;m!==-1&&(f===-1||m<f)?(R=m,m+1<s.length?p=s[m+1]===`
4
+ `?2:1:(i=!0,p=1)):(R=f,p=1);let x=s.slice(a,R);o.push(x);let A=o.length===1?o[0]:o.join("");o.length=0,r=0,d&&(A.startsWith("\uFEFF")&&(A=A.slice(1)),d=!1),yield A,a=R+p}}let c=t.decode();if(c&&o.push(c),o.length>0){let n=o.join("");d&&n.startsWith("\uFEFF")&&(n=n.slice(1)),yield n}}var fe=class{data=[];eventType="";lastEventId=null;retry=null;decode(e){if(e==="")return this.dispatch();if(e[0]===":")return null;let t=e.indexOf(":"),o,r;switch(t===-1?(o=e,r=""):(o=e.slice(0,t),r=e.slice(t+1),r[0]===" "&&(r=r.slice(1))),o){case"data":this.data.push(r);break;case"event":this.eventType=r;break;case"id":r.includes("\0")||(this.lastEventId=r);break;case"retry":/^[0-9]+$/.test(r)&&(this.retry=parseInt(r,10));break}return null}dispatch(){let e=this.eventType;if(this.eventType="",this.data.length===0)return null;let t={data:this.data.join(`
5
+ `),event:e,id:this.lastEventId,retry:this.retry};return this.data=[],t}};async function*he(e){let t=new fe;for await(let o of pe(e)){let r=t.decode(o);r!==null&&(yield r)}}var Re=750,J=120*1e3;function M(e,t="up"){let o=Date.now();function r(){return t==="up"||Date.now()-o>J}function i(){return t==="timed out"&&Date.now()-o<=J}return{...e,status:t,lastUpdate:o,isUp:r,isTimedOut:i}}var te=class extends Error{name="AlgoliaError";constructor(e,t){super(e),t&&(this.name=t)}};var re=class extends te{stackTrace;constructor(e,t,o){super(e,o),this.stackTrace=t}},Q=class extends re{constructor(e){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",e,"RetryError")}},j=class extends re{status;constructor(e,t,o,r="ApiError"){super(e,o,r),this.status=t}},xe=class extends te{response;constructor(e,t){super(e,"DeserializationError"),this.response=t}},ge=class extends j{error;constructor(e,t,o,r){super(e,t,r,"DetailedApiError"),this.error=o}};function oe(e){let t=e;for(let o=e.length-1;o>0;o--){let r=Math.floor(Math.random()*(o+1)),i=e[o];t[o]=e[r],t[r]=i}return t}function B(e,t,o){let r=ye(o),i=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${t.charAt(0)==="/"?t.substring(1):t}`;return r.length&&(i+=`?${r}`),i}function ye(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${t}=${encodeURIComponent(Object.prototype.toString.call(e[t])==="[object Array]"?e[t].join(","):e[t]).replace(/\+/g,"%20")}`).join("&")}function X(e,t){if(e.method==="GET"||e.data===void 0&&t.data===void 0)return;let o=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(o)}function K(e,t,o){let r={Accept:"application/json",...e,...t,...o},i={};return Object.keys(r).forEach(d=>{let c=r[d];i[d.toLowerCase()]=c}),i}function Pe(e){if(!(e.status===204||e.content.length===0))try{return JSON.parse(e.content)}catch(t){throw new xe(t.message,e)}}function Te({content:e,status:t},o){try{let r=JSON.parse(e);return"error"in r?new ge(r.message,t,r.error,o):new j(r.message,t,o)}catch{}return new j(e,t,o)}function ve({isTimedOut:e,status:t}){return!e&&~~t===0}function Ee({isTimedOut:e,status:t}){return e||ve({isTimedOut:e,status:t})||~~(t/100)!==2&&~~(t/100)!==4}function qe({status:e}){return~~(e/100)===2}function we(e){return e.map(t=>se(t))}function se(e){let t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function ne({hosts:e,hostsCache:t,baseHeaders:o,logger:r,baseQueryParameters:i,algoliaAgent:d,timeouts:c,requester:n,requestsCache:s,responsesCache:a,compress:m,compression:f}){async function R(u){let l=await Promise.all(u.map(h=>t.get(h,()=>Promise.resolve(M(h))))),q=l.filter(h=>h.isUp()),T=l.filter(h=>h.isTimedOut()),E=[...q,...T];return{hosts:E.length>0?E:u,getTimeout(h,w){return(T.length===0&&h===0?1:T.length+3+h)*w}}}async function p(u,l,q){let T=[],E=X(u,l),y=K(o,u.headers,l.headers),h=f==="gzip"&&E!==void 0&&E.length>Re&&(u.method==="POST"||u.method==="PUT");h&&m===void 0&&r.info("Compression is disabled because no compress method is available.");let w=h&&m!==void 0,_=w?await m(E):E;w&&(y["content-encoding"]="gzip");let N=u.method==="GET"?{...u.data,...l.data}:{},S={...i,...u.queryParameters,...N};if(d.value&&(S["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let P of Object.keys(l.queryParameters))!l.queryParameters[P]||Object.prototype.toString.call(l.queryParameters[P])==="[object Object]"?S[P]=l.queryParameters[P]:S[P]=l.queryParameters[P].toString();let I=0,D=async(P,L)=>{let O=P.pop();if(O===void 0)throw new Q(we(T));let H={...c,...l.timeouts},W={data:_,headers:y,method:u.method,url:B(O,u.path,S),connectTimeout:L(I,H.connect),responseTimeout:L(I,q?H.read:H.write)},F=$=>{let z={request:W,response:$,host:O,triesLeft:P.length};return T.push(z),z},b=await n.send(W);if(Ee(b)){let $=F(b);return b.isTimedOut&&I++,r.info("Retryable failure",se($)),await t.set(O,M(O,b.isTimedOut?"timed out":"down")),D(P,L)}if(qe(b))return Pe(b);throw F(b),Te(b,T)},v=e.filter(P=>P.accept==="readWrite"||(q?P.accept==="read":P.accept==="write")),G=await R(v);return D([...G.hosts].reverse(),G.getTimeout)}function x(u,l={}){let q=()=>p(u,l,T),T=u.useReadTransporter||u.method==="GET";if((l.cacheable||u.cacheable)!==!0)return q();let y={request:u,requestOptions:l,transporter:{queryParameters:i,headers:o}};return a.get(y,()=>s.get(y,()=>s.set(y,q()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,w])=>w)),{miss:h=>a.set(y,h)})}async function*A(u,l={}){if(!n.sendStream)throw new Error("This requester does not support streaming");let q=X(u,l),T=K(o,u.headers,l.headers);T.accept="text/event-stream";let E=u.method==="GET"?{...u.data,...l.data}:{},y={...i,...u.queryParameters,...E};if(d.value&&(y["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let v of Object.keys(l.queryParameters))!l.queryParameters[v]||Object.prototype.toString.call(l.queryParameters[v])==="[object Object]"?y[v]=l.queryParameters[v]:y[v]=l.queryParameters[v].toString();let h=u.useReadTransporter||u.method==="GET",w=e.filter(v=>v.accept==="readWrite"||(h?v.accept==="read":v.accept==="write")),N=(await R(w)).hosts[0];if(!N)throw new Q([]);let S={...c,...l.timeouts},I={data:q,headers:T,method:u.method,url:B(N,u.path,y),connectTimeout:S.connect,responseTimeout:h?S.read:S.write},D=await n.sendStream(I);yield*he(D)}return{hostsCache:t,requester:n,timeouts:c,logger:r,algoliaAgent:d,baseHeaders:o,baseQueryParameters:i,hosts:e,request:x,requestStream:A,requestsCache:s,responsesCache:a}}function g(e,t,o){if(o==null||typeof o=="string"&&o.length===0)throw new Error(`Parameter \`${e}\` is required when calling \`${t}\`.`)}function ae(){function e(t){return new Promise(o=>{let r=new XMLHttpRequest;r.open(t.method,t.url,!0),Object.keys(t.headers).forEach(n=>r.setRequestHeader(n,t.headers[n]));let i=(n,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0})},n),d=i(t.connectTimeout,"Connection timeout"),c;r.onreadystatechange=()=>{r.readyState>r.OPENED&&c===void 0&&(clearTimeout(d),c=i(t.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(c),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(c),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(t.data)})}return{send:e}}var U="5.54.1";function Se(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(oe([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}function ie({appId:e,apiKey:t,authMode:o,algoliaAgents:r,...i}){let d=Y(e,t,o),c=ne({hosts:Se(e),...i,algoliaAgent:Z({algoliaAgents:r,client:"Recommend",version:U}),baseHeaders:{"content-type":"text/plain",...d.headers(),...i.baseHeaders},baseQueryParameters:{...d.queryParameters(),...i.baseQueryParameters}});return{transporter:c,appId:e,apiKey:t,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(n,s){c.algoliaAgent.add({segment:n,version:s})},setClientApiKey({apiKey:n}){!o||o==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=n:c.baseQueryParameters["x-algolia-api-key"]=n},batchRecommendRules({indexName:n,model:s,recommendRule:a},m){g("indexName","batchRecommendRules",n),g("model","batchRecommendRules",s);let x={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/batch".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)),queryParameters:{},headers:{},data:a||{}};return c.request(x,m)},customDelete({path:n,parameters:s},a){g("path","customDelete",n);let p={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{}};return c.request(p,a)},customGet({path:n,parameters:s},a){g("path","customGet",n);let p={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{}};return c.request(p,a)},customPost({path:n,parameters:s,body:a},m){g("path","customPost",n);let x={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{},data:a||{}};return c.request(x,m)},customPut({path:n,parameters:s,body:a},m){g("path","customPut",n);let x={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:s||{},headers:{},data:a||{}};return c.request(x,m)},deleteRecommendRule({indexName:n,model:s,objectID:a},m){g("indexName","deleteRecommendRule",n),g("model","deleteRecommendRule",s),g("objectID","deleteRecommendRule",a);let x={method:"DELETE",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(x,m)},getRecommendRule({indexName:n,model:s,objectID:a},m){g("indexName","getRecommendRule",n),g("model","getRecommendRule",s),g("objectID","getRecommendRule",a);let x={method:"GET",path:"/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(x,m)},getRecommendStatus({indexName:n,model:s,taskID:a},m){g("indexName","getRecommendStatus",n),g("model","getRecommendStatus",s),g("taskID","getRecommendStatus",a);let x={method:"GET",path:"/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)).replace("{taskID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(x,m)},getRecommendations(n,s){n&&Array.isArray(n)&&(n={requests:n}),g("getRecommendationsParams","getRecommendations",n),g("getRecommendationsParams.requests","getRecommendations",n.requests);let R={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:n,useReadTransporter:!0,cacheable:!0};return c.request(R,s)},searchRecommendRules({indexName:n,model:s,searchRecommendRulesParams:a},m){g("indexName","searchRecommendRules",n),g("model","searchRecommendRules",s);let x={method:"POST",path:"/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}",encodeURIComponent(n)).replace("{model}",encodeURIComponent(s)),queryParameters:{},headers:{},data:a||{},useReadTransporter:!0,cacheable:!0};return c.request(x,m)}}}function Or(e,t,o){if(!e||typeof e!="string")throw new Error("`appId` is missing.");if(!t||typeof t!="string")throw new Error("`apiKey` is missing.");let{compression:r,...i}=o||{};return ie({appId:e,apiKey:t,timeouts:{connect:1e3,read:2e3,write:3e4},logger:ee(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:k(),requestsCache:k({serializable:!1}),hostsCache:C({caches:[V({key:`${U}-${e}`}),k()]}),...i})}export{U as apiClientVersion,Or as recommendClient};
6
6
  //# sourceMappingURL=browser.min.js.map