@amplitude/plugin-experiment-browser 1.0.0-beta.0 → 1.0.0-beta.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Amplitude Analytics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ <p align="center">
2
+ <a href="https://amplitude.com" target="_blank" align="center">
3
+ <img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
4
+ </a>
5
+ <br />
6
+ </p>
7
+
8
+ # @amplitude/plugin-experiment-browser
9
+
10
+ Official Browser SDK plugin for Amplitude Experiment integration
11
+
12
+ ## Installation
13
+
14
+ This package is published on NPM registry and is available to be installed using npm and yarn.
15
+
16
+ ```sh
17
+ # npm
18
+ npm install @amplitude/plugin-experiment-browser
19
+
20
+ # yarn
21
+ yarn add @amplitude/plugin-experiment-browser
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ This plugin works on top of Amplitude Browser SDK and adds Amplitude Experiment integration features. To use this plugin, you need to install `@amplitude/analytics-browser` version `v2.17.5` or later.
27
+
28
+ ### 1. Import Amplitude packages
29
+
30
+ * `@amplitude/plugin-experiment-browser`
31
+
32
+ ```typescript
33
+ import { experimentPlugin } from '@amplitude/plugin-experiment-browser';
34
+ ```
35
+
36
+ ### 2. Instantiate experiment plugin
37
+
38
+ The plugin accepts an optional parameter of type `ExperimentPluginConfig` to configure the plugin based on your use case.
39
+
40
+ ```typescript
41
+ const experiment = experimentPlugin({
42
+ deploymentKey: 'DEPLOYMENT_KEY', // Optional if using the same key as analytics
43
+ // Other experiment configuration options
44
+ });
45
+ ```
46
+
47
+ #### Options
48
+
49
+ |Name|Type|Default|Description|
50
+ |-|-|-|-|
51
+ |`deploymentKey`|`string`|`undefined`|The deployment key for Amplitude Experiment. If not provided, the plugin will use the Amplitude API key.|
52
+ |`...`|`ExperimentConfig`|`{}`|All other configuration options from `@amplitude/experiment-js-client`.|
53
+
54
+ ### 3. Install plugin to Amplitude SDK
55
+
56
+ ```typescript
57
+ amplitude.add(experiment);
58
+ ```
59
+
60
+ ### 4. Initialize Amplitude SDK
61
+
62
+ ```typescript
63
+ amplitude.init('API_KEY');
64
+ ```
65
+
66
+ ## Experiment Integration
67
+
68
+ This plugin integrates Amplitude Experiment with Amplitude Analytics. The plugin:
69
+
70
+ 1. Automatically initializes the Experiment client using the Amplitude Analytics configuration
71
+ 2. Sets up the connection between Experiment and Analytics for consistent user identity
72
+ 3. Allows you to use all features of the Experiment client while maintaining the connection with Analytics
73
+
74
+ ### Accessing the Experiment client
75
+
76
+ The Experiment client is accessible through the plugin instance:
77
+
78
+ ```typescript
79
+ const plugin = experimentPlugin(config);
80
+ amplitude.add(plugin);
81
+ amplitude.init('API_KEY');
82
+
83
+ // Now you can access the Experiment client
84
+ const variant = await plugin.experiment.fetch();
85
+ ```
86
+
87
+ ## Learn More
88
+
89
+ For more information about Amplitude Experiment, visit the [official documentation](https://www.docs.developers.amplitude.com/experiment/).
@@ -1,12 +1,18 @@
1
1
  import { EnrichmentPlugin, BrowserClient, BrowserConfig } from '@amplitude/analytics-core';
2
2
  import { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';
3
+ /**
4
+ * Fallback to project API key if no experiment deployment key.
5
+ */
6
+ export type ExperimentPluginConfig = ExperimentConfig & {
7
+ deploymentKey?: string;
8
+ };
3
9
  export declare class ExperimentPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {
4
10
  static pluginName: string;
5
11
  name: string;
6
12
  experiment: IExperimentClient;
7
- config?: ExperimentConfig;
8
- constructor(config?: ExperimentConfig);
13
+ config?: ExperimentPluginConfig;
14
+ constructor(config?: ExperimentPluginConfig);
9
15
  setup(config: BrowserConfig, _client: BrowserClient): Promise<void>;
10
16
  }
11
- export declare const experimentPlugin: (config?: ExperimentConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig>;
17
+ export declare const experimentPlugin: (config?: ExperimentPluginConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig>;
12
18
  //# sourceMappingURL=experiment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE3F,OAAO,EACL,gBAAgB,EAChB,MAAM,IAAI,iBAAiB,EAE5B,MAAM,iCAAiC,CAAC;AAEzC,qBAAa,gBAAiB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACrF,MAAM,CAAC,UAAU,SAA4C;IAC7D,IAAI,SAA+B;IAGnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC;gBAEd,MAAM,CAAC,EAAE,gBAAgB;IAI/B,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa;CAG1D;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAI1G,CAAC"}
1
+ {"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE3F,OAAO,EACL,gBAAgB,EAChB,MAAM,IAAI,iBAAiB,EAE5B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,qBAAa,gBAAiB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACrF,MAAM,CAAC,UAAU,SAA4C;IAC7D,IAAI,SAA+B;IAGnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,CAAC,EAAE,sBAAsB,CAAC;gBAEpB,MAAM,CAAC,EAAE,sBAAsB;IAIrC,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa;CAG1D;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,sBAAsB,KAAK,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAIhH,CAAC"}
@@ -9,9 +9,10 @@ var ExperimentPlugin = /** @class */ (function () {
9
9
  this.config = config;
10
10
  }
11
11
  ExperimentPlugin.prototype.setup = function (config, _client) {
12
+ var _a;
12
13
  return tslib_1.__awaiter(this, void 0, void 0, function () {
13
- return tslib_1.__generator(this, function (_a) {
14
- this.experiment = (0, experiment_js_client_1.initializeWithAmplitudeAnalytics)(config.apiKey, this.config);
14
+ return tslib_1.__generator(this, function (_b) {
15
+ this.experiment = (0, experiment_js_client_1.initializeWithAmplitudeAnalytics)(((_a = this.config) === null || _a === void 0 ? void 0 : _a.deploymentKey) || config.apiKey, this.config);
15
16
  return [2 /*return*/];
16
17
  });
17
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"experiment.js","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":";;;;AAEA,wEAIyC;AAEzC;IAQE,0BAAY,MAAyB;QANrC,SAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAOjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,gCAAK,GAAX,UAAY,MAAqB,EAAE,OAAsB;;;gBACvD,IAAI,CAAC,UAAU,GAAG,IAAA,uDAAgC,EAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;KAChF;IAbM,2BAAU,GAAG,wCAAwC,CAAC;IAc/D,uBAAC;CAAA,AAfD,IAeC;AAfY,4CAAgB;AAiBtB,IAAM,gBAAgB,GAAkF,UAC7G,MAAyB;IAEzB,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B","sourcesContent":["import { EnrichmentPlugin, BrowserClient, BrowserConfig } from '@amplitude/analytics-core';\n\nimport {\n ExperimentConfig,\n Client as IExperimentClient,\n initializeWithAmplitudeAnalytics,\n} from '@amplitude/experiment-js-client';\n\nexport class ExperimentPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/experiment-analytics-plugin';\n name = ExperimentPlugin.pluginName;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n experiment: IExperimentClient;\n config?: ExperimentConfig;\n\n constructor(config?: ExperimentConfig) {\n this.config = config;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n this.experiment = initializeWithAmplitudeAnalytics(config.apiKey, this.config);\n }\n}\n\nexport const experimentPlugin: (config?: ExperimentConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig> = (\n config?: ExperimentConfig,\n) => {\n return new ExperimentPlugin(config);\n};\n"]}
1
+ {"version":3,"file":"experiment.js","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":";;;;AAEA,wEAIyC;AAOzC;IAQE,0BAAY,MAA+B;QAN3C,SAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAOjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,gCAAK,GAAX,UAAY,MAAqB,EAAE,OAAsB;;;;gBACvD,IAAI,CAAC,UAAU,GAAG,IAAA,uDAAgC,EAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,aAAa,KAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;KAC9G;IAbM,2BAAU,GAAG,wCAAwC,CAAC;IAc/D,uBAAC;CAAA,AAfD,IAeC;AAfY,4CAAgB;AAiBtB,IAAM,gBAAgB,GAAwF,UACnH,MAA+B;IAE/B,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B","sourcesContent":["import { EnrichmentPlugin, BrowserClient, BrowserConfig } from '@amplitude/analytics-core';\n\nimport {\n ExperimentConfig,\n Client as IExperimentClient,\n initializeWithAmplitudeAnalytics,\n} from '@amplitude/experiment-js-client';\n\n/**\n * Fallback to project API key if no experiment deployment key.\n */\nexport type ExperimentPluginConfig = ExperimentConfig & { deploymentKey?: string };\n\nexport class ExperimentPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/experiment-analytics-plugin';\n name = ExperimentPlugin.pluginName;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n experiment: IExperimentClient;\n config?: ExperimentPluginConfig;\n\n constructor(config?: ExperimentPluginConfig) {\n this.config = config;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n this.experiment = initializeWithAmplitudeAnalytics(this.config?.deploymentKey || config.apiKey, this.config);\n }\n}\n\nexport const experimentPlugin: (config?: ExperimentPluginConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig> = (\n config?: ExperimentPluginConfig,\n) => {\n return new ExperimentPlugin(config);\n};\n"]}
@@ -1,3 +1,3 @@
1
- export { ExperimentPlugin, experimentPlugin } from './experiment';
2
- export { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';
1
+ export { ExperimentPlugin, experimentPlugin, ExperimentPluginConfig } from './experiment';
2
+ export { Client as IExperimentClient } from '@amplitude/experiment-js-client';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAkE;AAAzD,8GAAA,gBAAgB,OAAA;AAAE,8GAAA,gBAAgB,OAAA","sourcesContent":["export { ExperimentPlugin, experimentPlugin } from './experiment';\nexport { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0F;AAAjF,8GAAA,gBAAgB,OAAA;AAAE,8GAAA,gBAAgB,OAAA","sourcesContent":["export { ExperimentPlugin, experimentPlugin, ExperimentPluginConfig } from './experiment';\nexport { Client as IExperimentClient } from '@amplitude/experiment-js-client';\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "1.0.0-beta.3";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = void 0;
4
+ // Autogenerated by `npm run version-file`. DO NOT EDIT
5
+ exports.VERSION = '1.0.0-beta.3';
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAC1C,QAAA,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// Autogenerated by `npm run version-file`. DO NOT EDIT\nexport const VERSION = '1.0.0-beta.3';\n"]}
@@ -1,12 +1,18 @@
1
1
  import { EnrichmentPlugin, BrowserClient, BrowserConfig } from '@amplitude/analytics-core';
2
2
  import { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';
3
+ /**
4
+ * Fallback to project API key if no experiment deployment key.
5
+ */
6
+ export type ExperimentPluginConfig = ExperimentConfig & {
7
+ deploymentKey?: string;
8
+ };
3
9
  export declare class ExperimentPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {
4
10
  static pluginName: string;
5
11
  name: string;
6
12
  experiment: IExperimentClient;
7
- config?: ExperimentConfig;
8
- constructor(config?: ExperimentConfig);
13
+ config?: ExperimentPluginConfig;
14
+ constructor(config?: ExperimentPluginConfig);
9
15
  setup(config: BrowserConfig, _client: BrowserClient): Promise<void>;
10
16
  }
11
- export declare const experimentPlugin: (config?: ExperimentConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig>;
17
+ export declare const experimentPlugin: (config?: ExperimentPluginConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig>;
12
18
  //# sourceMappingURL=experiment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE3F,OAAO,EACL,gBAAgB,EAChB,MAAM,IAAI,iBAAiB,EAE5B,MAAM,iCAAiC,CAAC;AAEzC,qBAAa,gBAAiB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACrF,MAAM,CAAC,UAAU,SAA4C;IAC7D,IAAI,SAA+B;IAGnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC;gBAEd,MAAM,CAAC,EAAE,gBAAgB;IAI/B,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa;CAG1D;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAI1G,CAAC"}
1
+ {"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE3F,OAAO,EACL,gBAAgB,EAChB,MAAM,IAAI,iBAAiB,EAE5B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,qBAAa,gBAAiB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACrF,MAAM,CAAC,UAAU,SAA4C;IAC7D,IAAI,SAA+B;IAGnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,CAAC,EAAE,sBAAsB,CAAC;gBAEpB,MAAM,CAAC,EAAE,sBAAsB;IAIrC,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa;CAG1D;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,sBAAsB,KAAK,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAIhH,CAAC"}
@@ -6,9 +6,10 @@ var ExperimentPlugin = /** @class */ (function () {
6
6
  this.config = config;
7
7
  }
8
8
  ExperimentPlugin.prototype.setup = function (config, _client) {
9
+ var _a;
9
10
  return __awaiter(this, void 0, void 0, function () {
10
- return __generator(this, function (_a) {
11
- this.experiment = initializeWithAmplitudeAnalytics(config.apiKey, this.config);
11
+ return __generator(this, function (_b) {
12
+ this.experiment = initializeWithAmplitudeAnalytics(((_a = this.config) === null || _a === void 0 ? void 0 : _a.deploymentKey) || config.apiKey, this.config);
12
13
  return [2 /*return*/];
13
14
  });
14
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"experiment.js","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":";AAEA,OAAO,EAGL,gCAAgC,GACjC,MAAM,iCAAiC,CAAC;AAEzC;IAQE,0BAAY,MAAyB;QANrC,SAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAOjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,gCAAK,GAAX,UAAY,MAAqB,EAAE,OAAsB;;;gBACvD,IAAI,CAAC,UAAU,GAAG,gCAAgC,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;KAChF;IAbM,2BAAU,GAAG,wCAAwC,CAAC;IAc/D,uBAAC;CAAA,AAfD,IAeC;SAfY,gBAAgB;AAiB7B,MAAM,CAAC,IAAM,gBAAgB,GAAkF,UAC7G,MAAyB;IAEzB,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["import { EnrichmentPlugin, BrowserClient, BrowserConfig } from '@amplitude/analytics-core';\n\nimport {\n ExperimentConfig,\n Client as IExperimentClient,\n initializeWithAmplitudeAnalytics,\n} from '@amplitude/experiment-js-client';\n\nexport class ExperimentPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/experiment-analytics-plugin';\n name = ExperimentPlugin.pluginName;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n experiment: IExperimentClient;\n config?: ExperimentConfig;\n\n constructor(config?: ExperimentConfig) {\n this.config = config;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n this.experiment = initializeWithAmplitudeAnalytics(config.apiKey, this.config);\n }\n}\n\nexport const experimentPlugin: (config?: ExperimentConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig> = (\n config?: ExperimentConfig,\n) => {\n return new ExperimentPlugin(config);\n};\n"]}
1
+ {"version":3,"file":"experiment.js","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":";AAEA,OAAO,EAGL,gCAAgC,GACjC,MAAM,iCAAiC,CAAC;AAOzC;IAQE,0BAAY,MAA+B;QAN3C,SAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAOjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,gCAAK,GAAX,UAAY,MAAqB,EAAE,OAAsB;;;;gBACvD,IAAI,CAAC,UAAU,GAAG,gCAAgC,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,aAAa,KAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;KAC9G;IAbM,2BAAU,GAAG,wCAAwC,CAAC;IAc/D,uBAAC;CAAA,AAfD,IAeC;SAfY,gBAAgB;AAiB7B,MAAM,CAAC,IAAM,gBAAgB,GAAwF,UACnH,MAA+B;IAE/B,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["import { EnrichmentPlugin, BrowserClient, BrowserConfig } from '@amplitude/analytics-core';\n\nimport {\n ExperimentConfig,\n Client as IExperimentClient,\n initializeWithAmplitudeAnalytics,\n} from '@amplitude/experiment-js-client';\n\n/**\n * Fallback to project API key if no experiment deployment key.\n */\nexport type ExperimentPluginConfig = ExperimentConfig & { deploymentKey?: string };\n\nexport class ExperimentPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {\n static pluginName = '@amplitude/experiment-analytics-plugin';\n name = ExperimentPlugin.pluginName;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n experiment: IExperimentClient;\n config?: ExperimentPluginConfig;\n\n constructor(config?: ExperimentPluginConfig) {\n this.config = config;\n }\n\n async setup(config: BrowserConfig, _client: BrowserClient) {\n this.experiment = initializeWithAmplitudeAnalytics(this.config?.deploymentKey || config.apiKey, this.config);\n }\n}\n\nexport const experimentPlugin: (config?: ExperimentPluginConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig> = (\n config?: ExperimentPluginConfig,\n) => {\n return new ExperimentPlugin(config);\n};\n"]}
@@ -1,3 +1,3 @@
1
- export { ExperimentPlugin, experimentPlugin } from './experiment';
2
- export { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';
1
+ export { ExperimentPlugin, experimentPlugin, ExperimentPluginConfig } from './experiment';
2
+ export { Client as IExperimentClient } from '@amplitude/experiment-js-client';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { ExperimentPlugin, experimentPlugin } from './experiment';\nexport { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAA0B,MAAM,cAAc,CAAC","sourcesContent":["export { ExperimentPlugin, experimentPlugin, ExperimentPluginConfig } from './experiment';\nexport { Client as IExperimentClient } from '@amplitude/experiment-js-client';\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "1.0.0-beta.3";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Autogenerated by `npm run version-file`. DO NOT EDIT
2
+ export var VERSION = '1.0.0-beta.3';
3
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,CAAC,IAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// Autogenerated by `npm run version-file`. DO NOT EDIT\nexport const VERSION = '1.0.0-beta.3';\n"]}
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";function t(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((i=i.apply(e,t||[])).next())}))}function r(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return o=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},o.apply(this,arguments)};function a(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((i=i.apply(e,t||[])).next())}))}function s(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function c(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var f="is",h="is not",d="contains",p="does not contain",v="less",y="less or equal",g="greater",b="greater or equal",m="version less",w="version less or equal",x="version greater",S="version greater or equal",k="set is",P="set is not",C="set contains",I="set does not contain",A="set contains any",_="set does not contain any",O="regex match",E="regex does not match",T=-862048943,M=461845907,V=function(e,t){void 0===t&&(t=0);for(var r=function(e){for(var t=[],r=0,i=0;i<e.length;i++){var n=e.charCodeAt(i);n<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&i+1<e.length&&56320==(64512&e.charCodeAt(i+1))?(n=65536+((1023&n)<<10)+(1023&e.charCodeAt(++i)),t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128)}return Uint8Array.from(t)}(e),i=r.length,n=i>>2,o=t,a=0;a<n;a++){var s=F(r,a<<2);o=U(s,o)}var u=n<<2,l=0;switch(i-u){case 3:l^=r[u+2]<<16,l^=r[u+1]<<8,l^=r[u],l=Math.imul(l,T),l=j(l,15),o^=l=Math.imul(l,M);break;case 2:l^=r[u+1]<<8,l^=r[u],l=Math.imul(l,T),l=j(l,15),o^=l=Math.imul(l,M);break;case 1:l^=r[u],l=Math.imul(l,T),l=j(l,15),o^=l=Math.imul(l,M)}return N(o^=i)>>>0},U=function(e,t){var r=e,i=t;return r=Math.imul(r,T),r=j(r,15),r=Math.imul(r,M),i=j(i^=r,13),(i=Math.imul(i,5))+-430675100|0},N=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},j=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<<t|(e&4294967295<<r-t>>>0)>>>0>>>r-t>>>0)>>>0},F=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return R(r)},R=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},q=function(e,t){var r,i;if(t&&0!==t.length){try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(!a||!e||"object"!=typeof e)return;e=e[a]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return e||void 0}},K="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),D=function(){function e(e,t,r,i){void 0===i&&(i=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=i}return e.parse=function(t){if(t){var r=new RegExp(K).exec(t);if(r){var i=Number(r[1]),n=Number(r[2]);if(!isNaN(i)&&!isNaN(n))return new e(i,n,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},e}(),L=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,i,n={},o={context:e,result:n};try{for(var a=u(t),s=a.next();!s.done;s=a.next()){var l=s.value,c=this.evaluateFlag(o,l);c&&(n[l.key]=c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return n},e.prototype.evaluateFlag=function(e,t){var r,i,n;try{for(var a=u(t.segments),s=a.next();!s.done;s=a.next()){var l=s.value;if(n=this.evaluateSegment(e,t,l)){var c=o(o(o({},t.metadata),l.metadata),n.metadata);n=o(o({},n),{metadata:c});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return n},e.prototype.evaluateSegment=function(e,t,r){var i;return r.conditions?this.evaluateConditions(e,r.conditions)&&void 0!==(i=this.bucket(e,r))?t.variants[i]:void 0:void 0!==(i=this.bucket(e,r))?t.variants[i]:void 0},e.prototype.evaluateConditions=function(e,t){var r,i,n,o;try{for(var a=u(t),s=a.next();!s.done;s=a.next()){var l=s.value,c=!0;try{for(var f=(n=void 0,u(l)),h=f.next();!h.done;h=f.next()){var d=h.value;if(!(c=this.matchCondition(e,d)))break}}catch(e){n={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}if(c)return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return!1},e.prototype.matchCondition=function(e,t){var r=q(e,t.selector);if(r){if(this.isSetOperator(t.op)){var i=this.coerceStringArray(r);return!!i&&this.matchSet(i,t.op,t.values)}var n=this.coerceString(r);return void 0!==n&&this.matchString(n,t.op,t.values)}return this.matchNull(t.op,t.values)},e.prototype.getHash=function(e){return V(e)},e.prototype.bucket=function(e,t){var r,i,n,o;if(!t.bucket)return t.variant;var a=this.coerceString(q(e,t.bucket.selector));if(!a||0===a.length)return t.variant;var s="".concat(t.bucket.salt,"/").concat(a),l=this.getHash(s),c=l%100,f=Math.floor(l/100);try{for(var h=u(t.bucket.allocations),d=h.next();!d.done;d=h.next()){var p=d.value,v=p.range[0],y=p.range[1];if(c>=v&&c<y)try{for(var g=(n=void 0,u(p.distributions)),b=g.next();!b.done;b=g.next()){var m=b.value,w=m.range[0],x=m.range[1];if(f>=w&&f<x)return m.variant}}catch(e){n={error:e}}finally{try{b&&!b.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case f:case d:case v:case y:case g:case b:case m:case w:case x:case S:case k:case C:case A:return r;case h:case p:case I:case _:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case k:return this.setEquals(e,r);case P:return!this.setEquals(e,r);case C:return this.matchesSetContainsAll(e,r);case I:return!this.matchesSetContainsAll(e,r);case A:return this.matchesSetContainsAny(e,r);case _:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var i=this;switch(t){case f:return this.matchesIs(e,r);case h:return!this.matchesIs(e,r);case d:return this.matchesContains(e,r);case p:return!this.matchesContains(e,r);case v:case y:case g:case b:return this.matchesComparable(e,t,r,(function(e){return i.parseNumber(e)}),this.comparator);case m:case w:case x:case S:return this.matchesComparable(e,t,r,(function(e){return D.parse(e)}),this.versionComparator);case O:return this.matchesRegex(e,r);case E:return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some((function(e){return e.toLowerCase()===r}))}return t.some((function(t){return e===t}))},e.prototype.matchesContains=function(e,t){var r,i;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(e.toLowerCase().includes(a.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,i,n){var o=this,a=i(e),s=r.map((function(e){return i(e)})).filter((function(e){return void 0!==e}));return void 0===a||0===s.length?r.some((function(r){return o.comparator(e,t,r)})):s.some((function(e){return n(a,t,e)}))},e.prototype.comparator=function(e,t,r){switch(t){case v:case m:return e<r;case y:case w:return e<=r;case g:case x:return e>r;case b:case S:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var i=e.compareTo(r);switch(t){case v:case m:return i<0;case y:case w:return i<=0;case g:case x:return i>0;case b:case S:return i>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some((function(t){return Boolean(new RegExp(t).exec(e))}))},e.prototype.containsNone=function(e){return e.some((function(e){return"(none)"===e}))},e.prototype.containsBooleans=function(e){return e.some((function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}}))},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map((function(e){return t.coerceString(e)})).filter(Boolean);var r=String(e);try{var i=JSON.parse(r);return Array.isArray(i)?e.map((function(e){return t.coerceString(e)})).filter(Boolean):(n=this.coerceString(r))?[n]:void 0}catch(e){var n;return(n=this.coerceString(r))?[n]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case k:case P:case C:case I:case A:case _:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),i=new Set(t);return r.size===i.size&&c([],l(i),!1).every((function(e){return r.has(e)}))},e.prototype.matchesSetContainsAll=function(e,t){var r,i;if(e.length<t.length)return!1;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(!this.matchesIs(a,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,i;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(this.matchesIs(a,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!1},e}(),B=function(e,t,r){var i,n;void 0===r&&(r=[]);var o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];r.push(o.key);var a=[],s=function(e){if(r.some((function(t){return t===e})))throw Error("Detected a cycle between flags ".concat(r));var i=B(e,t,r);i&&a.push.apply(a,c([],l(i),!1))};try{for(var f=u(o.dependencies),h=f.next();!h.done;h=f.next()){s(h.value)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(i)throw i.error}}return a.push(o),r.pop(),delete t[o.key],a}};const z="function"==typeof btoa,J="function"==typeof Buffer,Q=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),W=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),X=((e=>{let t={};e.forEach(((e,r)=>t[e]=r))})(W),String.fromCharCode.bind(String)),$=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),H=e=>{let t,r,i,n,o="";const a=e.length%3;for(let a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(i=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=r<<16|i<<8|n,o+=W[t>>18&63]+W[t>>12&63]+W[t>>6&63]+W[63&t]}return a?o.slice(0,a-3)+"===".substring(a):o},G=z?e=>btoa(e):J?e=>Buffer.from(e,"binary").toString("base64"):H,Z=J?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,i=e.length;r<i;r+=4096)t.push(X.apply(null,e.subarray(r,r+4096)));return G(t.join(""))},Y=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?X(192|t>>>6)+X(128|63&t):X(224|t>>>12&15)+X(128|t>>>6&63)+X(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return X(240|t>>>18&7)+X(128|t>>>12&63)+X(128|t>>>6&63)+X(128|63&t)},ee=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,te=e=>e.replace(ee,Y),re=J?e=>Buffer.from(e,"utf8").toString("base64"):Q?e=>Z(Q.encode(e)):e=>G(te(e)),ie=(e,t=!1)=>t?$(re(e)):re(e),ne=e=>ie(e,!0),oe=ne;var ae=function(e){function t(r,i){var n=e.call(this,i)||this;return n.statusCode=r,Object.setPrototypeOf(n,t.prototype),n}return n(t,e),t}(Error),se=function(e){function t(r){var i=e.call(this,r)||this;return Object.setPrototypeOf(i,t.prototype),i}return n(t,e),t}(Error),ue=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return a(this,void 0,void 0,(function(){var r,i,n,o;return s(this,(function(a){switch(a.label){case 0:return r=oe(JSON.stringify(e)),i={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(i["X-Amp-Exp-Flag-Keys"]=oe(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(i["X-Amp-Exp-Track"]=t.trackingOption),n=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&n.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&n.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:n.toString(),method:"GET",headers:i,timeoutMillis:null==t?void 0:t.timeoutMillis})];case 1:if(200!=(o=a.sent()).status)throw new ae(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}}))}))},e}(),le=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return a(this,void 0,void 0,(function(){var t,r;return s(this,(function(i){switch(i.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=oe(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=i.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce((function(e,t){return e[t.key]=t,e}),{})]}}))}))},e}(),ce="undefined"!=typeof globalThis?globalThis:global||self,fe=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},he=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=ce.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(ce.clearInterval(this.poller),this.poller=void 0)},e}(),de=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:pe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),pe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ve=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),ye=function(){return ye=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ye.apply(this,arguments)};function ge(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function be(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}"function"==typeof SuppressedError&&SuppressedError;var me=function(e,t){var r,i,n=typeof e;if(n!==typeof t)return!1;try{for(var o=ge(["string","number","boolean","undefined"]),a=o.next();!a.done;a=o.next()){if(a.value===n)return e===t}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),u=Array.isArray(t);if(s!==u)return!1;if(!s||!u){var l=Object.keys(e).sort(),c=Object.keys(t).sort();if(!me(l,c))return!1;var f=!0;return Object.keys(e).forEach((function(r){me(e[r],t[r])||(f=!1)})),f}for(var h=0;h<e.length;h++)if(!me(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i});var we=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ye({},this.identity.userProperties),r=ye(ye({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,i,n,o,a,s,u=r.userProperties||{};try{for(var l=ge(Object.entries(e)),c=l.next();!c.done;c=l.next()){var f=be(c.value,2),h=f[0],d=f[1];switch(h){case"$set":try{for(var p=(n=void 0,ge(Object.entries(d))),v=p.next();!v.done;v=p.next()){var y=be(v.value,2),g=y[0],b=y[1];u[g]=b}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}break;case"$unset":try{for(var m=(a=void 0,ge(Object.keys(d))),w=m.next();!w.done;w=m.next()){delete u[g=w.value]}}catch(e){a={error:e}}finally{try{w&&!w.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(t)throw t.error}}return r.userProperties=u,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return ye({},this.identity)},e.prototype.setIdentity=function(e){var t=ye({},this.identity);this.identity=ye({},e),me(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,Se=function(){function e(){this.identityStore=new we,this.eventBridge=new ve,this.applicationContextProvider=new de}return e.getInstance=function(t){return xe.analyticsConnectorInstances||(xe.analyticsConnectorInstances={}),xe.analyticsConnectorInstances[t]||(xe.analyticsConnectorInstances[t]=new e),xe.analyticsConnectorInstances[t]},e}(),ke="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Pe={exports:{}};!function(e,t){!function(r,i){var n="function",o="undefined",a="object",s="string",u="model",l="name",c="type",f="vendor",h="version",d="architecture",p="console",v="mobile",y="tablet",g="smarttv",b="wearable",m="embedded",w="Amazon",x="Apple",S="ASUS",k="BlackBerry",P="Browser",C="Chrome",I="Firefox",A="Google",_="Huawei",O="LG",E="Microsoft",T="Motorola",M="Opera",V="Samsung",U="Sony",N="Xiaomi",j="Zebra",F="Facebook",R=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},q=function(e,t){return typeof e===s&&-1!==K(t).indexOf(K(e))},K=function(e){return e.toLowerCase()},D=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,275)},L=function(e,t){for(var r,o,s,u,l,c,f=0;f<t.length&&!l;){var h=t[f],d=t[f+1];for(r=o=0;r<h.length&&!l;)if(l=h[r++].exec(e))for(s=0;s<d.length;s++)c=l[++o],typeof(u=d[s])===a&&u.length>0?2===u.length?typeof u[1]==n?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==n||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):i:this[u[0]]=c?u[1].call(this,c,u[2]):i:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):i):this[u]=c||i;f+=2}},B=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(q(t[r][n],e))return"?"===r?i:r}else if(q(t[r],e))return"?"===r?i:r;return e},z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,h],[/opios[\/ ]+([\w\.]+)/i],[h,[l,M+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[l,M]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[l,"UC"+P]],[/\bqbcore\/([\w\.]+)/i],[h,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+P],h],[/\bfocus\/([\w\.]+)/i],[h,[l,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[l,M+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[l,M+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[l,"MIUI "+P]],[/fxios\/([-\w\.]+)/i],[h,[l,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+P]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+P],h],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,F],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[l,C+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,C+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[l,"Android "+P]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,h],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[h,[l,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[h,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[h,B,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[l,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,h]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[d,"amd64"]],[/(ia32(?=;))/i],[[d,K]],[/((?:i[346]|x)86)[;\)]/i],[[d,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[d,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[d,"armhf"]],[/windows (ce|mobile); ppc;/i],[[d,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[d,/ower/,"",K]],[/(sun4\w)[;\)]/i],[[d,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[d,K]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[f,V],[c,y]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[f,V],[c,v]],[/((ipod|iphone)\d+,\d+)/i],[u,[f,x],[c,v]],[/(ipad\d+,\d+)/i],[u,[f,x],[c,y]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[f,x],[c,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[f,x],[c,y]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[f,_],[c,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[f,_],[c,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[f,N],[c,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[f,N],[c,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[f,"OPPO"],[c,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[f,"Vivo"],[c,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[f,"Realme"],[c,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[f,T],[c,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[f,T],[c,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[f,O],[c,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[f,O],[c,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[f,"Lenovo"],[c,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[f,"Nokia"],[c,v]],[/(pixel c)\b/i],[u,[f,A],[c,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[f,A],[c,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[f,U],[c,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[f,U],[c,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[f,"OnePlus"],[c,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[f,w],[c,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[f,w],[c,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,f,[c,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[f,k],[c,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[f,S],[c,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[f,S],[c,v]],[/(nexus 9)/i],[u,[f,"HTC"],[c,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[u,/_/g," "],[c,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[f,"Acer"],[c,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[f,"Meizu"],[c,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[f,"Sharp"],[c,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,u,[c,v]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,u,[c,y]],[/(surface duo)/i],[u,[f,E],[c,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[f,"Fairphone"],[c,v]],[/(u304aa)/i],[u,[f,"AT&T"],[c,v]],[/\bsie-(\w*)/i],[u,[f,"Siemens"],[c,v]],[/\b(rct\w+) b/i],[u,[f,"RCA"],[c,y]],[/\b(venue[\d ]{2,7}) b/i],[u,[f,"Dell"],[c,y]],[/\b(q(?:mv|ta)\w+) b/i],[u,[f,"Verizon"],[c,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[f,"Barnes & Noble"],[c,y]],[/\b(tm\d{3}\w+) b/i],[u,[f,"NuVision"],[c,y]],[/\b(k88) b/i],[u,[f,"ZTE"],[c,y]],[/\b(nx\d{3}j) b/i],[u,[f,"ZTE"],[c,v]],[/\b(gen\d{3}) b.+49h/i],[u,[f,"Swiss"],[c,v]],[/\b(zur\d{3}) b/i],[u,[f,"Swiss"],[c,y]],[/\b((zeki)?tb.*\b) b/i],[u,[f,"Zeki"],[c,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],u,[c,y]],[/\b(ns-?\w{0,9}) b/i],[u,[f,"Insignia"],[c,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[f,"NextBook"],[c,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],u,[c,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],u,[c,v]],[/\b(ph-1) /i],[u,[f,"Essential"],[c,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[f,"Envizen"],[c,y]],[/\b(trio[-\w\. ]+) b/i],[u,[f,"MachSpeed"],[c,y]],[/\btu_(1491) b/i],[u,[f,"Rotor"],[c,y]],[/(shield[\w ]+) b/i],[u,[f,"Nvidia"],[c,y]],[/(sprint) (\w+)/i],[f,u,[c,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[f,E],[c,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[f,j],[c,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[f,j],[c,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,u,[c,p]],[/droid.+; (shield) bui/i],[u,[f,"Nvidia"],[c,p]],[/(playstation [345portablevi]+)/i],[u,[f,U],[c,p]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[f,E],[c,p]],[/smart-tv.+(samsung)/i],[f,[c,g]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[f,V],[c,g]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,O],[c,g]],[/(apple) ?tv/i],[f,[u,x+" TV"],[c,g]],[/crkey/i],[[u,C+"cast"],[f,A],[c,g]],[/droid.+aft(\w)( bui|\))/i],[u,[f,w],[c,g]],[/\(dtv[\);].+(aquos)/i],[u,[f,"Sharp"],[c,g]],[/(bravia[\w- ]+) bui/i],[u,[f,U],[c,g]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[f,D],[u,D],[c,g]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,g]],[/((pebble))app/i],[f,u,[c,b]],[/droid.+; (glass) \d/i],[u,[f,A],[c,b]],[/droid.+; (wt63?0{2,3})\)/i],[u,[f,j],[c,b]],[/(quest( 2)?)/i],[u,[f,F],[c,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[c,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[c,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[c,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,y]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[c,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[l,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[h,B,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[h,B,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[h,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,h],[/\(bb(10);/i],[h,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[l,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[l,C+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,h],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[l,h]]},Q=function(e,t){if(typeof e===a&&(t=e,e=i),!(this instanceof Q))return new Q(e,t).getResult();var n=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),p=t?function(e,t){var r={};for(var i in e)t[i]&&t[i].length%2==0?r[i]=t[i].concat(e[i]):r[i]=e[i];return r}(J,t):J;return this.getBrowser=function(){var e={};return e[l]=i,e[h]=i,L.call(e,n,p.browser),e.major=function(e){return typeof e===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e.version),e},this.getCPU=function(){var e={};return e[d]=i,L.call(e,n,p.cpu),e},this.getDevice=function(){var e={};return e[f]=i,e[u]=i,e[c]=i,L.call(e,n,p.device),e},this.getEngine=function(){var e={};return e[l]=i,e[h]=i,L.call(e,n,p.engine),e},this.getOS=function(){var e={};return e[l]=i,e[h]=i,L.call(e,n,p.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===s&&e.length>275?D(e,275):e,this},this.setUA(n),this};Q.VERSION="0.7.31",Q.BROWSER=R([l,h,"major"]),Q.CPU=R([d]),Q.DEVICE=R([u,f,c,p,v,g,y,b,m]),Q.ENGINE=Q.OS=R([l,h]),e.exports&&(t=e.exports=Q),t.UAParser=Q;var W=typeof r!==o&&(r.jQuery||r.Zepto);if(W&&!W.ua){var X=new Q;W.ua=X.getResult(),W.ua.get=function(){return X.getUA()},W.ua.set=function(e){X.setUA(e);var t=X.getResult();for(var r in t)W.ua[r]=t[r]}}}("object"==typeof window?window:ke)}(Pe,Pe.exports);var Ce=function(){return Ce=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ce.apply(this,arguments)};function Ie(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((i=i.apply(e,t||[])).next())}))}function Ae(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function _e(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Oe(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function Ee(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Te=function(e,t){var r,i;void 0===t&&(t=!1);var n=Me(e,t),o=void 0,a=ce.document.cookie.split("; ");try{for(var s=_e(a),u=s.next();!u.done;u=s.next()){var l=Oe(u.value.split("=",2),2),c=l[0],f=l[1];c===n&&(o=decodeURIComponent(f))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var d=o.split("."),p=void 0;return d.length>=2&&d[1]&&(p=atob(d[1])),{deviceId:d[0],userId:p}}catch(e){return}},Me=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},Ve=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return Ie(this,void 0,void 0,(function(){return Ae(this,(function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener((function(){null==t||t.fetch()})),[2,this.waitForConnectorIdentity(this.timeoutMillis)]}))}))},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=Te(this.apiKey,!0);return(e||(e=Te(this.apiKey,!1))||(e=function(e){var t=Me(e,!0);try{var r=ce.localStorage.getItem(t);if(!r)return;var i=JSON.parse(r);if("object"!=typeof i)return;return i}catch(e){return}}(this.apiKey))||!!(e=function(e){var t=Me(e,!0);try{var r=ce.sessionStorage.getItem(t);if(!r)return;var i=JSON.parse(r);if("object"!=typeof i)return;return i}catch(e){return}}(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return Ie(this,void 0,void 0,(function(){var t,r=this;return Ae(this,(function(i){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise((function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)})),new Promise((function(t,r){ce.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")}))])]}))}))},e}();var Ue,Ne,je=ce.fetch||function(e,t){return t=t||{},new Promise((function(r,i){var n=new XMLHttpRequest,o=[],a=[],s={},u=function(){return{ok:2==(n.status/100|0),statusText:n.statusText,status:n.status,url:n.responseURL,text:function(){return Promise.resolve(n.responseText)},json:function(){return Promise.resolve(JSON.parse(n.responseText))},blob:function(){return Promise.resolve(new Blob([n.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var l in n.open(t.method||"get",e,!0),n.onload=function(){n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){o.push(t=t.toLowerCase()),a.push([t,r]),s[t]=s[t]?s[t]+","+r:r})),r(u())},n.onerror=i,n.withCredentials="include"==t.credentials,t.headers)n.setRequestHeader(l,t.headers[l]);n.send(t.body||null)}))},Fe=function(){function e(e){this.client=e}return e.prototype.request=function(e){return Ie(this,void 0,void 0,(function(){return Ae(this,(function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}}))}))},e}(),Re={request:function(e,t,r,i,n){return function(e,t){return null==t||t<=0?e:new Promise((function(r,i){ce.setTimeout((function(){i(new se("Request timeout after "+t+" milliseconds"))}),t),e.then(r,i)}))}(Ie(void 0,void 0,void 0,(function(){var n,o;return Ae(this,(function(a){switch(a.label){case 0:return[4,je(e,{method:t,headers:r,body:i})];case 1:return n=a.sent(),o={status:n.status},[4,n.text()];case 2:return o.body=a.sent(),[2,o]}}))})),n)}};!function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(Ue||(Ue={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(Ne||(Ne={}));var qe=function(e){return!e||e===Ne.FallbackInline||e===Ne.FallbackConfig||e===Ne.SecondaryInitialVariants},Ke={debug:!1,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:Ue.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:Re},De="1.15.5",Le=function(){function e(e,t){var r,i=this;this.isReady=new Promise((function(e){i.resolve=e})),this.config=e,this.client=t;var n=null!==(r=e.instanceName)&&void 0!==r?r:Ke.instanceName;this.queue=new ze(n),this.cache=new Be(n)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then((function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}),(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()})):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},e.prototype.getExposureEvent=function(e){var t,r,i,n={eventType:"$exposure",eventProperties:e};return(null===(t=e.metadata)||void 0===t?void 0:t.exposureEvent)?n={eventType:null===(r=e.metadata)||void 0===r?void 0:r.exposureEvent,eventProperties:e}:"web"===(null===(i=e.metadata)||void 0===i?void 0:i.deliveryMethod)&&(n={eventType:"$impression",eventProperties:e}),n},e}(),Be=function(){function e(e){this.isSessionStorageAvailable=Je(),this.inMemoryCache={},this.storageKey="EXP_sent_v2_".concat(e),this.isSessionStorageAvailable&&ce.sessionStorage.removeItem("EXP_sent_".concat(e))}return e.prototype.shouldTrack=function(e){var t;if("web"===(null===(t=e.metadata)||void 0===t?void 0:t.deliveryMethod))return!0;this.loadCache();var r=this.inMemoryCache[e.flag_key],i=!1;return r&&r.variant===e.variant||(i=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),i},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=ce.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&ce.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),ze=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=function(){var e=fe();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1}(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=ce.setInterval((function(){t.loadFlushStore()}),1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&0!==this.inMemoryQueue.length){try{for(var r=_e(this.inMemoryQueue),i=r.next();!i.done;i=r.next()){var n=i.value;if(!this.tracker(n))return}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&(ce.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=ce.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),ce.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),Je=function(){var e=fe();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1},Qe=function(){function e(){this.globalScope=fe()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)},e}(),We=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return Ce({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var i=_e(Object.keys(e)),n=i.next();!n.done;n=i.next()){var o=n.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,i=this.storage.get(this.namespace);try{r=JSON.parse(i)||{}}catch(e){return}var n={};try{for(var o=_e(Object.keys(r)),a=o.next();!a.done;a=o.next()){var s=a.value;try{var u=void 0;(u=this.transformer?this.transformer(r[s]):r[s])&&(n[s]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(n)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),Xe=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,i=e.payload,n=e.metadata,o=e.expKey;n&&n.experimentKey?o=n.experimentKey:o&&((n=n||{}).experimentKey=o);var a={};return t?a.key=t:r&&(a.key=r),r&&(a.value=r),n&&(a.metadata=n),i&&(a.payload=i),o&&(a.expKey=o),a}},$e=function(){function e(){this.globalScope=fe()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)},e}(),He=function(e){return null==e},Ge=function(e){return!!He(e)||e&&0===Object.keys(e).length},Ze=function(e){var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)},Ye=function(){function e(e,t,r,i){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=i}return e.prototype.start=function(e){return Ie(this,void 0,void 0,(function(){return Ae(this,(function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}}))}))},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return Ie(this,void 0,void 0,(function(){var i=this;return Ae(this,(function(n){return this.done||(this.timeoutHandle=ce.setTimeout((function(){return Ie(i,void 0,void 0,(function(){var i,n;return Ae(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(i=t+1)<this.attempts&&(n=Math.min(r*this.scalar,this.max),this.backoff(e,i,n)),[3,3];case 3:return[2]}}))}))}),r)),[2]}))}))},e}(),et=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},tt=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r},rt=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),it=function(){function e(e){this.tracked={},this.exposureTrackingProvider=e}return e.prototype.track=function(e){var t=this.tracked[e.flag_key];t&&t.variant===e.variant||(this.tracked[e.flag_key]=e,this.exposureTrackingProvider.track(e))},e}(),nt=function(){function e(e,t){var r,i,n,o,a=this;this.engine=new L,this.isRunning=!1,this.apiKey=e,this.config=Ce(Ce(Ce({},Ke),t),{serverUrl:(null==t?void 0:t.serverUrl)||("eu"===(null===(r=null==t?void 0:t.serverZone)||void 0===r?void 0:r.toLowerCase())?"https://api.lab.eu.amplitude.com":Ke.serverUrl),flagsServerUrl:(null==t?void 0:t.flagsServerUrl)||("eu"===(null===(i=null==t?void 0:t.serverZone)||void 0===i?void 0:i.toLowerCase())?"https://flag.lab.eu.amplitude.com":Ke.flagsServerUrl),flagConfigPollingIntervalMillis:t.flagConfigPollingIntervalMillis<6e4?6e4:null!==(n=t.flagConfigPollingIntervalMillis)&&void 0!==n?n:Ke.flagConfigPollingIntervalMillis});var s=null===(o=this.config)||void 0===o?void 0:o.internalInstanceNameSuffix;if(this.isWebExperiment="web"===s,this.poller=new he((function(){return a.doFlags()}),this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var u in this.config.initialVariants)this.config.initialVariants[u]=Xe(this.config.initialVariants[u]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new rt(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.exposureTrackingProvider=new it(this.config.exposureTrackingProvider)),this.integrationManager=new Le(this.config,this);var l,c=new Fe(this.config.httpClient||Re);this.flagApi=new le(this.apiKey,this.config.flagsServerUrl,c),this.evaluationApi=new ue(this.apiKey,this.config.serverUrl,c);var f=s?"".concat(this.config.instanceName,"-").concat(s):this.config.instanceName;l=this.isWebExperiment?new $e:new Qe,this.variants=function(e,t,r){var i=e.substring(e.length-6),n="amp-exp-".concat(t,"-").concat(i);return new We(n,r,Xe)}(this.apiKey,f,l),this.flags=function(e,t,r){void 0===r&&(r=new Qe);var i=e.substring(e.length-6),n="amp-exp-".concat(t,"-").concat(i,"-flags");return new We(n,r)}(this.apiKey,f,l);try{this.flags.load(),this.variants.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){var t;return Ie(this,void 0,void 0,(function(){var r;return Ae(this,(function(i){switch(i.label){case 0:return this.isRunning?[2]:(this.isRunning=!0,this.setUser(e),r=this.doFlags(),null===(t=this.config.fetchOnStart)||void 0===t||t?[4,Promise.all([this.fetch(e),r])]:[3,2]);case 1:return i.sent(),[3,4];case 2:return[4,r];case 3:i.sent(),i.label=4;case 4:return this.config.pollOnStart&&this.poller.start(),[2]}}))}))},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(e,t){return void 0===e&&(e=this.user),Ie(this,void 0,void 0,(function(){var r;return Ae(this,(function(i){switch(i.label){case 0:this.setUser(e||{}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),this.config.debug&&(r instanceof se?console.debug(r):console.error(r)),[3,4];case 4:return[2,this]}}))}))},e.prototype.variant=function(e,t){var r,i;if(!this.apiKey)return{value:void 0};var n=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,n),this.debug("[Experiment] variant for ".concat(e," is ").concat((null===(r=n.variant)||void 0===r?void 0:r.key)||(null===(i=n.variant)||void 0===i?void 0:i.value))),n.variant||{}},e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e){var r=this.flags.get(t);Ze(r)||delete e[t]}return Ce(Ce(Ce({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){var e;if(!this.user)return this.user;if(null===(e=this.user)||void 0===e?void 0:e.user_properties){var t=Ce({},this.user.user_properties);return Ce(Ce({},this.user),{user_properties:t})}return Ce({},this.user)},e.prototype.setUser=function(e){var t;if(e)if(null===(t=this.user)||void 0===t?void 0:t.user_properties){var r=Ce({},e.user_properties);this.user=Ce(Ce({},e),{user_properties:r})}else this.user=Ce({},e);else this.user=null},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach((function(t){e.flags.get(t.key)||e.flags.put(t.key,t)}))},e.prototype.evaluate=function(e){var t,r,i=this.addContext(this.user),n=function(e,t){var r,i,n=o({},e),a=[],s=t||Object.keys(n);try{for(var f=u(s),h=f.next();!h.done;h=f.next()){var d=h.value,p=B(d,n);p&&a.push.apply(a,c([],l(p),!1))}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}return a}(this.flags.getAll(),e),a=function(e){var t,r,i,n;if(!e)return{};var o={user:e},a=fe();a&&(o.page={url:a.location.href});var s={};if(!e.groups)return o;try{for(var u=_e(Object.keys(e.groups)),l=u.next();!l.done;l=u.next()){var c=l.value,f=e.groups[c];if(f.length>0&&f[0]){var h=f[0],d={group_name:h},p=null===(n=null===(i=e.group_properties)||void 0===i?void 0:i[c])||void 0===n?void 0:n[h];p&&Object.keys(p).length>0&&(d.group_properties=p),s[c]=d}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return Object.keys(s).length>0&&(o.groups=s),delete o.user.groups,delete o.user.group_properties,o}(i),s=this.engine.evaluate(a,n),f={};try{for(var h=_e(Object.keys(s)),d=h.next();!d.done;d=h.next()){var p=d.value;f[p]=tt(s[p])}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}return f},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===Ue.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===Ue.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var i=this.flags.get(e);return(Ze(i)||!r.variant&&i)&&(r=this.localEvaluationVariantAndSource(e,i,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var i,n={},o=this.evaluate([t.key])[e],a=Ne.LocalEvaluation,s=null===(i=null==o?void 0:o.metadata)||void 0===i?void 0:i.default;if(!He(o)&&!s)return{variant:et(o),source:a,hasDefaultVariant:!1};if(s&&(n={variant:et(o),source:a,hasDefaultVariant:!0}),!He(r))return{variant:et(r),source:Ne.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var u=this.config.initialVariants[e];if(!He(u))return{variant:et(u),source:Ne.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var l=et(this.config.fallbackVariant),c={variant:l,source:Ne.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return Ge(l)?n:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,i={},n=this.variants.get(e),o=null===(r=null==n?void 0:n.metadata)||void 0===r?void 0:r.default;if(!He(n)&&!o)return{variant:et(n),source:Ne.LocalStorage,hasDefaultVariant:!1};if(o&&(i={variant:et(n),source:Ne.LocalStorage,hasDefaultVariant:!0}),!He(t))return{variant:et(t),source:Ne.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var a=this.config.initialVariants[e];if(!He(a))return{variant:et(a),source:Ne.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var s=et(this.config.fallbackVariant),u={variant:s,source:Ne.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return Ge(s)?i:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,i={},n=this.config.initialVariants[e];if(!He(n))return{variant:et(n),source:Ne.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),a=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!He(o)&&!a)return{variant:et(o),source:Ne.LocalStorage,hasDefaultVariant:!1};if(a&&(i={variant:et(o),source:Ne.LocalStorage,hasDefaultVariant:!0}),!He(t))return{variant:et(t),source:Ne.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var s=et(this.config.fallbackVariant),u={variant:s,source:Ne.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return Ge(s)?i:u},e.prototype.fetchInternal=function(e,t,r,i){return Ie(this,void 0,void 0,(function(){var n,o;return Ae(this,(function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,i)];case 2:return n=a.sent(),[4,this.storeVariants(n,i)];case 3:return a.sent(),[2,n];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,i),o;case 5:return[2]}}))}))},e.prototype.cleanUserPropsForFetch=function(e){var t=Ce({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return Ie(this,void 0,void 0,(function(){var i,n,o,a,s,u,l;return Ae(this,(function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,Ce({timeoutMillis:t},r))];case 2:i=c.sent(),n={};try{for(o=_e(Object.keys(i)),a=o.next();!a.done;a=o.next())s=a.value,n[s]=tt(i[s])}catch(e){u={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.debug("[Experiment] Received variants: ",n),[2,n]}}))}))},e.prototype.doFlags=function(){return Ie(this,void 0,void 0,(function(){var e,t,r;return Ae(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e=void 0,this.isWebExperiment?[4,this.addContextOrWait(this.getUser())]:[3,2];case 1:e=i.sent(),i.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:De,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=i.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if(!((r=i.sent())instanceof se))throw r;return this.config.debug&&console.debug(r),[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}}))}))},e.prototype.storeVariants=function(e,t){return Ie(this,void 0,void 0,(function(){var r,i,n,o;return Ae(this,(function(a){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),i=function(t){r=r.filter((function(e){return e!==t})),n.variants.put(t,e[t])},n=this,e)i(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.debug("[Experiment] Stored variants: ",e),[2]}))}))},e.prototype.startRetries=function(e,t){return Ie(this,void 0,void 0,(function(){var r=this;return Ae(this,(function(i){return this.debug("[Experiment] Retry fetch"),this.retriesBackoff=new Ye(8,500,1e4,1.5),this.retriesBackoff.start((function(){return Ie(r,void 0,void 0,(function(){return Ae(this,(function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}}))}))})),[2]}))}))},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),i=this.integrationManager.getUser(),n=Ce(Ce(Ce({},null==r?void 0:r.user_properties),i.user_properties),null==e?void 0:e.user_properties);return Ce(Ce(Ce(Ce({library:"experiment-js-client/".concat(De)},r),i),e),{user_properties:n})},e.prototype.addContextOrWait=function(e){return Ie(this,void 0,void 0,(function(){return Ae(this,(function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}}))}))},e.prototype.sourceVariants=function(){return this.config.source==Ue.LocalStorage?this.variants.getAll():this.config.source==Ue.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==Ue.LocalStorage?this.config.initialVariants:this.config.source==Ue.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){var r,i,n,o,a,s,u,l,c;if(null===(n=null===(i=null===(r=t.variant)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.trackExposure)||void 0===n||n){this.legacyExposureInternal(e,t.variant,t.source);var f={flag_key:e},h=qe(t.source);if(!h||t.hasDefaultVariant){(null===(o=t.variant)||void 0===o?void 0:o.expKey)&&(f.experiment_key=null===(a=t.variant)||void 0===a?void 0:a.expKey);var d=null===(s=t.variant)||void 0===s?void 0:s.metadata;h||(null==d?void 0:d.default)||((null===(u=t.variant)||void 0===u?void 0:u.key)?f.variant=t.variant.key:(null===(l=t.variant)||void 0===l?void 0:l.value)&&(f.variant=t.variant.value)),d&&(f.metadata=d),null===(c=this.exposureTrackingProvider)||void 0===c||c.track(f),this.integrationManager.track(f)}}},e.prototype.legacyExposureInternal=function(e,t,r){var i,n,o,a,s;if(this.analyticsProvider){var u=function(e,t,r,i){var n,o=null==r?void 0:r.value,a="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:a,properties:{key:t,variant:o,source:i},userProperties:(n={},n[a]=o,n)}}(this.addContext(this.getUser()),e,t,r);qe(r)||!(null==t?void 0:t.value)?null===(n=null===(i=this.analyticsProvider)||void 0===i?void 0:i.unsetUserProperty)||void 0===n||n.call(i,u):(null==t?void 0:t.value)&&(null===(a=null===(o=this.analyticsProvider)||void 0===o?void 0:o.setUserProperty)||void 0===a||a.call(o,u),null===(s=this.analyticsProvider)||void 0===s||s.track(u))}},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.config.debug&&console.debug.apply(console,Ee([e],Oe(t),!1))},e.prototype.shouldRetryFetch=function(e){return!(e instanceof ae)||(e.statusCode<400||e.statusCode>=500||429===e.statusCode)},e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),ot=function(){function e(e,t){var r,i,n;this.globalScope=fe(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(i=this.globalScope)||void 0===i?void 0:i.navigator.userAgent:void 0,this.ua=new Pe.exports.UAParser(this.userAgent).getResult(),this.localStorage=new Qe,this.sessionStorage=new $e,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null===(n=this.apiKey)||void 0===n?void 0:n.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,i,n,o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Ce({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(r=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==r?r:"desktop",referring_url:null===(n=null===(i=this.globalScope)||void 0===i?void 0:i.document)||void 0===n?void 0:n.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(r=e.browser)||void 0===r?void 0:r.major].filter((function(e){return null!=e})).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,i,n;if(null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.document)||void 0===t?void 0:t.cookie)return Object.fromEntries(null===(n=null===(i=null===(r=this.globalScope)||void 0===r?void 0:r.document)||void 0===i?void 0:i.cookie)||void 0===n?void 0:n.split("; ").map((function(e){return e.split("=")})))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){var e,t,r;if(this.globalScope){var i={};try{var n=new URL(this.globalScope.location.href);try{for(var o=_e(n.searchParams),a=o.next();!a.done;a=o.next()){var s=Oe(a.value,2),u=s[0],l=s[1];i[u]=Ee(Ee([],Oe(null!==(r=i[u])&&void 0!==r?r:[]),!1),Oe(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(i).reduce((function(e,t){var r=Oe(t,2),i=r[0],n=r[1];return e[i]=1==n.length?n[0]:n,e}),{})}},e}();ce.experimentInstances={};var at=ce.experimentInstances,st=function(e){return(null==e?void 0:e.instanceName)||Ke.instanceName},ut=function(e,t,r){var i=function(e,t){var r=st(t),i=null==t?void 0:t.internalInstanceNameSuffix;return i?"".concat(r,".").concat(e,".").concat(i):"".concat(r,".").concat(e)}(e,t),n=at[i];return n||(n=function(e,t){return new nt(e,Ce(Ce({},t),{userProvider:new ot(null==t?void 0:t.userProvider,e)}))}(e,t),r&&n.addPlugin(r()),at[i]=n,n)},lt=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,i){return t(this,void 0,void 0,(function(){return r(this,(function(t){return this.experiment=function(e,t){return ut(e,t,(function(){return new Ve(e,Se.getInstance(st(t)),1e4)}))}(e.apiKey,this.config),[2]}))}))},e.pluginName="@amplitude/experiment-analytics-plugin",e}();e.ExperimentPlugin=lt,e.experimentPlugin=function(e){return new lt(e)},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,function(e){"use strict";function t(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((i=i.apply(e,t||[])).next())})}function r(e,t){var r,i,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},i(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return o=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},o.apply(this,arguments)};function a(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((i=i.apply(e,t||[])).next())})}function s(e,t){var r,i,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function c(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var f="is",h="is not",p="contains",d="does not contain",v="less",y="less or equal",g="greater",b="greater or equal",m="version less",w="version less or equal",x="version greater",S="version greater or equal",k="set is",I="set is not",P="set contains",O="set does not contain",E="set contains any",C="set does not contain any",A="regex match",_="regex does not match",T=-862048943,V=461845907,M=function(e,t){void 0===t&&(t=0);for(var r=function(e){for(var t=[],r=0,i=0;i<e.length;i++){var n=e.charCodeAt(i);n<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&i+1<e.length&&56320==(64512&e.charCodeAt(i+1))?(n=65536+((1023&n)<<10)+(1023&e.charCodeAt(++i)),t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128)}return Uint8Array.from(t)}(e),i=r.length,n=i>>2,o=t,a=0;a<n;a++){var s=F(r,a<<2);o=N(s,o)}var u=n<<2,l=0;switch(i-u){case 3:l^=r[u+2]<<16,l^=r[u+1]<<8,l^=r[u],l=Math.imul(l,T),l=j(l,15),o^=l=Math.imul(l,V);break;case 2:l^=r[u+1]<<8,l^=r[u],l=Math.imul(l,T),l=j(l,15),o^=l=Math.imul(l,V);break;case 1:l^=r[u],l=Math.imul(l,T),l=j(l,15),o^=l=Math.imul(l,V)}return U(o^=i)>>>0},N=function(e,t){var r=e,i=t;return r=Math.imul(r,T),r=j(r,15),r=Math.imul(r,V),i=j(i^=r,13),(i=Math.imul(i,5))+-430675100|0},U=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},j=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<<t|(e&4294967295<<r-t>>>0)>>>0>>>r-t>>>0)>>>0},F=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return L(r)},L=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},R=function(e,t){var r,i;if(t&&0!==t.length){try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(!a||!e||"object"!=typeof e)return;e=e[a]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return null==e?void 0:e}},q="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),D=function(){function e(e,t,r,i){void 0===i&&(i=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=i}return e.parse=function(t){if(t){var r=new RegExp(q).exec(t);if(r){var i=Number(r[1]),n=Number(r[2]);if(!isNaN(i)&&!isNaN(n))return new e(i,n,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch||this.preRelease&&!e.preRelease?-1:!this.preRelease&&e.preRelease?1:this.preRelease&&e.preRelease?this.preRelease>e.preRelease?1:this.preRelease<e.preRelease?-1:0:0},e}(),K=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,i,n={},o={context:e,result:n};try{for(var a=u(t),s=a.next();!s.done;s=a.next()){var l=s.value,c=this.evaluateFlag(o,l);c&&(n[l.key]=c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return n},e.prototype.evaluateFlag=function(e,t){var r,i,n;try{for(var a=u(t.segments),s=a.next();!s.done;s=a.next()){var l=s.value;if(n=this.evaluateSegment(e,t,l)){var c=o(o(o({},t.metadata),l.metadata),n.metadata);n=o(o({},n),{metadata:c});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return n},e.prototype.evaluateSegment=function(e,t,r){var i;return r.conditions?this.evaluateConditions(e,r.conditions)&&void 0!==(i=this.bucket(e,r))?t.variants[i]:void 0:void 0!==(i=this.bucket(e,r))?t.variants[i]:void 0},e.prototype.evaluateConditions=function(e,t){var r,i,n,o;try{for(var a=u(t),s=a.next();!s.done;s=a.next()){var l=s.value,c=!0;try{for(var f=(n=void 0,u(l)),h=f.next();!h.done;h=f.next()){var p=h.value;if(!(c=this.matchCondition(e,p)))break}}catch(e){n={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}if(c)return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return!1},e.prototype.matchCondition=function(e,t){var r=R(e,t.selector);if(null==r)return this.matchNull(t.op,t.values);if(this.isSetOperator(t.op)){var i=this.coerceStringArray(r);return!!i&&this.matchSet(i,t.op,t.values)}var n=this.coerceString(r);return void 0!==n&&this.matchString(n,t.op,t.values)},e.prototype.getHash=function(e){return M(e)},e.prototype.bucket=function(e,t){var r,i,n,o;if(!t.bucket)return t.variant;var a=this.coerceString(R(e,t.bucket.selector));if(!a||0===a.length)return t.variant;var s="".concat(t.bucket.salt,"/").concat(a),l=this.getHash(s),c=l%100,f=Math.floor(l/100);try{for(var h=u(t.bucket.allocations),p=h.next();!p.done;p=h.next()){var d=p.value,v=d.range[0],y=d.range[1];if(c>=v&&c<y)try{for(var g=(n=void 0,u(d.distributions)),b=g.next();!b.done;b=g.next()){var m=b.value,w=m.range[0],x=m.range[1];if(f>=w&&f<x)return m.variant}}catch(e){n={error:e}}finally{try{b&&!b.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case f:case p:case v:case y:case g:case b:case m:case w:case x:case S:case k:case P:case E:return r;case h:case d:case O:case C:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case k:return this.setEquals(e,r);case I:return!this.setEquals(e,r);case P:return this.matchesSetContainsAll(e,r);case O:return!this.matchesSetContainsAll(e,r);case E:return this.matchesSetContainsAny(e,r);case C:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var i=this;switch(t){case f:return this.matchesIs(e,r);case h:return!this.matchesIs(e,r);case p:return this.matchesContains(e,r);case d:return!this.matchesContains(e,r);case v:case y:case g:case b:return this.matchesComparable(e,t,r,function(e){return i.parseNumber(e)},this.comparator);case m:case w:case x:case S:return this.matchesComparable(e,t,r,function(e){return D.parse(e)},this.versionComparator);case A:return this.matchesRegex(e,r);case _:return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,i;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(e.toLowerCase().includes(a.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,i,n){var o=this,a=i(e),s=r.map(function(e){return i(e)}).filter(function(e){return void 0!==e});return void 0===a||0===s.length?r.some(function(r){return o.comparator(e,t,r)}):s.some(function(e){return n(a,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case v:case m:return e<r;case y:case w:return e<=r;case g:case x:return e>r;case b:case S:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var i=e.compareTo(r);switch(t){case v:case m:return i<0;case y:case w:return i<=0;case g:case x:return i>0;case b:case S:return i>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return Boolean(new RegExp(t).exec(e))})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map(function(e){return t.coerceString(e)}).filter(Boolean);var r=String(e);try{var i=JSON.parse(r);return Array.isArray(i)?e.map(function(e){return t.coerceString(e)}).filter(Boolean):(n=this.coerceString(r))?[n]:void 0}catch(e){var n;return(n=this.coerceString(r))?[n]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case k:case I:case P:case O:case E:case C:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),i=new Set(t);return r.size===i.size&&c([],l(i),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,i;if(e.length<t.length)return!1;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(!this.matchesIs(a,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,i;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(this.matchesIs(a,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!1},e}(),z=function(e,t,r){var i,n;void 0===r&&(r=[]);var o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];r.push(o.key);var a=[],s=function(e){if(r.some(function(t){return t===e}))throw Error("Detected a cycle between flags ".concat(r));var i=z(e,t,r);i&&a.push.apply(a,c([],l(i),!1))};try{for(var f=u(o.dependencies),h=f.next();!h.done;h=f.next()){s(h.value)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(i)throw i.error}}return a.push(o),r.pop(),delete t[o.key],a}};const B="function"==typeof Buffer,J=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),W=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Q=(e=>{let t={};return e.forEach((e,r)=>t[e]=r),t})(W),X=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,$=String.fromCharCode.bind(String),Z=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_")),H=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),G=e=>{let t,r,i,n,o="";const a=e.length%3;for(let a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(i=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=r<<16|i<<8|n,o+=W[t>>18&63]+W[t>>12&63]+W[t>>6&63]+W[63&t]}return a?o.slice(0,a-3)+"===".substring(a):o},Y="function"==typeof btoa?e=>btoa(e):B?e=>Buffer.from(e,"binary").toString("base64"):G,ee=B?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,i=e.length;r<i;r+=4096)t.push($.apply(null,e.subarray(r,r+4096)));return Y(t.join(""))},te=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?$(192|t>>>6)+$(128|63&t):$(224|t>>>12&15)+$(128|t>>>6&63)+$(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return $(240|t>>>18&7)+$(128|t>>>12&63)+$(128|t>>>6&63)+$(128|63&t)},re=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ie=e=>e.replace(re,te),ne=B?e=>Buffer.from(e,"utf8").toString("base64"):J?e=>ee(J.encode(e)):e=>Y(ie(e)),oe=(e,t=!1)=>t?Z(ne(e)):ne(e),ae=e=>oe(e,!0),se=e=>{if(e=e.replace(/\s+/g,""),!X.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,i,n="";for(let o=0;o<e.length;)t=Q[e.charAt(o++)]<<18|Q[e.charAt(o++)]<<12|(r=Q[e.charAt(o++)])<<6|(i=Q[e.charAt(o++)]),n+=64===r?$(t>>16&255):64===i?$(t>>16&255,t>>8&255):$(t>>16&255,t>>8&255,255&t);return n},ue=ae;var le=function(e){function t(r,i){var n=e.call(this,i)||this;return n.statusCode=r,Object.setPrototypeOf(n,t.prototype),n}return n(t,e),t}(Error),ce=function(e){function t(r){var i=e.call(this,r)||this;return Object.setPrototypeOf(i,t.prototype),i}return n(t,e),t}(Error),fe=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return a(this,void 0,void 0,function(){var r,i,n,o;return s(this,function(a){switch(a.label){case 0:return r=ue(JSON.stringify(e)),i={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(i["X-Amp-Exp-Flag-Keys"]=ue(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(i["X-Amp-Exp-Track"]=t.trackingOption),n=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&n.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&n.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:n.toString(),method:"GET",headers:i,timeoutMillis:null==t?void 0:t.timeoutMillis})];case 1:if(200!=(o=a.sent()).status)throw new le(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),he=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return a(this,void 0,void 0,function(){var t,r;return s(this,function(i){switch(i.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=ue(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=i.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),pe="undefined"!=typeof globalThis?globalThis:global||self,de=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},ve=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=pe.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(pe.clearInterval(this.poller),this.poller=void 0)},e}(),ye=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:ge(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),ge=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},be=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),me=function(){return me=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},me.apply(this,arguments)};function we(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function xe(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}"function"==typeof SuppressedError&&SuppressedError;var Se=function(e,t){var r,i,n=typeof e;if(n!==typeof t)return!1;try{for(var o=we(["string","number","boolean","undefined"]),a=o.next();!a.done;a=o.next()){if(a.value===n)return e===t}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),u=Array.isArray(t);if(s!==u)return!1;if(!s||!u){var l=Object.keys(e).sort(),c=Object.keys(t).sort();if(!Se(l,c))return!1;var f=!0;return Object.keys(e).forEach(function(r){Se(e[r],t[r])||(f=!1)}),f}for(var h=0;h<e.length;h++)if(!Se(e[h],t[h]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i});var ke=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=me({},this.identity.userProperties),r=me(me({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,i,n,o,a,s,u=r.userProperties||{};try{for(var l=we(Object.entries(e)),c=l.next();!c.done;c=l.next()){var f=xe(c.value,2),h=f[0],p=f[1];switch(h){case"$set":try{for(var d=(n=void 0,we(Object.entries(p))),v=d.next();!v.done;v=d.next()){var y=xe(v.value,2),g=y[0],b=y[1];u[g]=b}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}break;case"$unset":try{for(var m=(a=void 0,we(Object.keys(p))),w=m.next();!w.done;w=m.next()){delete u[g=w.value]}}catch(e){a={error:e}}finally{try{w&&!w.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(t)throw t.error}}return r.userProperties=u,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return me({},this.identity)},e.prototype.setIdentity=function(e){var t=me({},this.identity);this.identity=me({},e),Se(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),Ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,Pe=function(){function e(){this.identityStore=new ke,this.eventBridge=new be,this.applicationContextProvider=new ye}return e.getInstance=function(t){return Ie.analyticsConnectorInstances||(Ie.analyticsConnectorInstances={}),Ie.analyticsConnectorInstances[t]||(Ie.analyticsConnectorInstances[t]=new e),Ie.analyticsConnectorInstances[t]},e}(),Oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ee={};!function(e,t){!function(r,i){var n="function",o="undefined",a="object",s="string",u="model",l="name",c="type",f="vendor",h="version",p="architecture",d="console",v="mobile",y="tablet",g="smarttv",b="wearable",m="embedded",w="Amazon",x="Apple",S="ASUS",k="BlackBerry",I="Browser",P="Chrome",O="Firefox",E="Google",C="Huawei",A="LG",_="Microsoft",T="Motorola",V="Opera",M="Samsung",N="Sharp",U="Sony",j="Xiaomi",F="Zebra",L="Facebook",R=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},q=function(e,t){return typeof e===s&&-1!==D(t).indexOf(D(e))},D=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},z=function(e,t){for(var r,o,s,u,l,c,f=0;f<t.length&&!l;){var h=t[f],p=t[f+1];for(r=o=0;r<h.length&&!l;)if(l=h[r++].exec(e))for(s=0;s<p.length;s++)c=l[++o],typeof(u=p[s])===a&&u.length>0?2===u.length?typeof u[1]==n?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==n||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):i:this[u[0]]=c?u[1].call(this,c,u[2]):i:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):i):this[u]=c||i;f+=2}},B=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(q(t[r][n],e))return"?"===r?i:r}else if(q(t[r],e))return"?"===r?i:r;return e},J={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,h],[/opios[\/ ]+([\w\.]+)/i],[h,[l,V+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[l,V]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[l,"UC"+I]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+I],h],[/\bfocus\/([\w\.]+)/i],[h,[l,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[l,V+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[l,V+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[l,"MIUI "+I]],[/fxios\/([-\w\.]+)/i],[h,[l,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+I]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+I],h],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,L],h],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[l,P+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,P+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[l,"Android "+I]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[h,B,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[l,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,h],[/(cobalt)\/([\w\.]+)/i],[l,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,D]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",D]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,D]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[f,M],[c,y]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[f,M],[c,v]],[/((ipod|iphone)\d+,\d+)/i],[u,[f,x],[c,v]],[/(ipad\d+,\d+)/i],[u,[f,x],[c,y]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[f,x],[c,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[f,x],[c,y]],[/(macintosh);/i],[u,[f,x]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[f,C],[c,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[f,C],[c,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[f,j],[c,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[f,j],[c,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[f,"OPPO"],[c,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[f,"Vivo"],[c,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[f,"Realme"],[c,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[f,T],[c,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[f,T],[c,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[f,A],[c,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[f,A],[c,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[f,"Lenovo"],[c,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[f,"Nokia"],[c,v]],[/(pixel c)\b/i],[u,[f,E],[c,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[f,E],[c,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[f,U],[c,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[f,U],[c,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[f,"OnePlus"],[c,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[f,w],[c,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[f,w],[c,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,f,[c,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[f,k],[c,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[f,S],[c,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[f,S],[c,v]],[/(nexus 9)/i],[u,[f,"HTC"],[c,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[u,/_/g," "],[c,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[f,"Acer"],[c,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[f,"Meizu"],[c,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[f,N],[c,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,u,[c,v]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,u,[c,y]],[/(surface duo)/i],[u,[f,_],[c,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[f,"Fairphone"],[c,v]],[/(u304aa)/i],[u,[f,"AT&T"],[c,v]],[/\bsie-(\w*)/i],[u,[f,"Siemens"],[c,v]],[/\b(rct\w+) b/i],[u,[f,"RCA"],[c,y]],[/\b(venue[\d ]{2,7}) b/i],[u,[f,"Dell"],[c,y]],[/\b(q(?:mv|ta)\w+) b/i],[u,[f,"Verizon"],[c,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[f,"Barnes & Noble"],[c,y]],[/\b(tm\d{3}\w+) b/i],[u,[f,"NuVision"],[c,y]],[/\b(k88) b/i],[u,[f,"ZTE"],[c,y]],[/\b(nx\d{3}j) b/i],[u,[f,"ZTE"],[c,v]],[/\b(gen\d{3}) b.+49h/i],[u,[f,"Swiss"],[c,v]],[/\b(zur\d{3}) b/i],[u,[f,"Swiss"],[c,y]],[/\b((zeki)?tb.*\b) b/i],[u,[f,"Zeki"],[c,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],u,[c,y]],[/\b(ns-?\w{0,9}) b/i],[u,[f,"Insignia"],[c,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[f,"NextBook"],[c,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],u,[c,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],u,[c,v]],[/\b(ph-1) /i],[u,[f,"Essential"],[c,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[f,"Envizen"],[c,y]],[/\b(trio[-\w\. ]+) b/i],[u,[f,"MachSpeed"],[c,y]],[/\btu_(1491) b/i],[u,[f,"Rotor"],[c,y]],[/(shield[\w ]+) b/i],[u,[f,"Nvidia"],[c,y]],[/(sprint) (\w+)/i],[f,u,[c,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[f,_],[c,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[f,F],[c,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[f,F],[c,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,u,[c,d]],[/droid.+; (shield) bui/i],[u,[f,"Nvidia"],[c,d]],[/(playstation [345portablevi]+)/i],[u,[f,U],[c,d]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[f,_],[c,d]],[/smart-tv.+(samsung)/i],[f,[c,g]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[f,M],[c,g]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,A],[c,g]],[/(apple) ?tv/i],[f,[u,x+" TV"],[c,g]],[/crkey/i],[[u,P+"cast"],[f,E],[c,g]],[/droid.+aft(\w)( bui|\))/i],[u,[f,w],[c,g]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[f,N],[c,g]],[/(bravia[\w ]+)( bui|\))/i],[u,[f,U],[c,g]],[/(mitv-\w{5}) bui/i],[u,[f,j],[c,g]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[f,K],[u,K],[c,g]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,g]],[/((pebble))app/i],[f,u,[c,b]],[/droid.+; (glass) \d/i],[u,[f,E],[c,b]],[/droid.+; (wt63?0{2,3})\)/i],[u,[f,F],[c,b]],[/(quest( 2)?)/i],[u,[f,L],[c,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[c,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[c,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[c,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[l,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[h,B,J]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[h,B,J]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,h],[/\(bb(10);/i],[h,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[l,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[h,[l,P+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,h],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[l,h]]},Q=function(e,t){if(typeof e===a&&(t=e,e=i),!(this instanceof Q))return new Q(e,t).getResult();var n=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),d=t?function(e,t){var r={};for(var i in e)t[i]&&t[i].length%2==0?r[i]=t[i].concat(e[i]):r[i]=e[i];return r}(W,t):W;return this.getBrowser=function(){var e={};return e[l]=i,e[h]=i,z.call(e,n,d.browser),e.major=function(e){return typeof e===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e.version),e},this.getCPU=function(){var e={};return e[p]=i,z.call(e,n,d.cpu),e},this.getDevice=function(){var e={};return e[f]=i,e[u]=i,e[c]=i,z.call(e,n,d.device),e},this.getEngine=function(){var e={};return e[l]=i,e[h]=i,z.call(e,n,d.engine),e},this.getOS=function(){var e={};return e[l]=i,e[h]=i,z.call(e,n,d.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===s&&e.length>350?K(e,350):e,this},this.setUA(n),this};Q.VERSION="0.7.33",Q.BROWSER=R([l,h,"major"]),Q.CPU=R([p]),Q.DEVICE=R([u,f,c,d,v,g,y,b,m]),Q.ENGINE=Q.OS=R([l,h]),e.exports&&(t=e.exports=Q),t.UAParser=Q;var X=typeof r!==o&&(r.jQuery||r.Zepto);if(X&&!X.ua){var $=new Q;X.ua=$.getResult(),X.ua.get=function(){return $.getUA()},X.ua.set=function(e){$.setUA(e);var t=$.getResult();for(var r in t)X.ua[r]=t[r]}}}("object"==typeof window?window:Oe)}({get exports(){return Ee},set exports(e){Ee=e}},Ee);var Ce=function(){return Ce=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ce.apply(this,arguments)};function Ae(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((i=i.apply(e,t||[])).next())})}function _e(e,t){var r,i,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function Te(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ve(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function Me(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Ne=function(e,t){var r,i;void 0===t&&(t=!1);var n=Ue(e,t),o=void 0,a=pe.document.cookie.split("; ");try{for(var s=Te(a),u=s.next();!u.done;u=s.next()){var l=Ve(u.value.split("=",2),2),c=l[0],f=l[1];c===n&&(o=decodeURIComponent(f))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var p=o.split("."),d=void 0;return p.length>=2&&p[1]&&(d=atob(p[1])),{deviceId:p[0],userId:d}}catch(e){return}},Ue=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},je=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return Ae(this,void 0,void 0,function(){return _e(this,function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(function(){null==t||t.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=Ne(this.apiKey,!0);return(e||(e=Ne(this.apiKey,!1))||(e=function(e){var t=Ue(e,!0);try{var r=pe.localStorage.getItem(t);if(!r)return;var i=JSON.parse(r);if("object"!=typeof i)return;return i}catch(e){return}}(this.apiKey))||!!(e=function(e){var t=Ue(e,!0);try{var r=pe.sessionStorage.getItem(t);if(!r)return;var i=JSON.parse(r);if("object"!=typeof i)return;return i}catch(e){return}}(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return Ae(this,void 0,void 0,function(){var t,r=this;return _e(this,function(i){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise(function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)}),new Promise(function(t,r){pe.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}();var Fe,Le,Re,qe=pe.fetch||function(e,t){return t=t||{},new Promise(function(r,i){var n=new XMLHttpRequest,o=[],a=[],s={},u=function(){return{ok:2==(n.status/100|0),statusText:n.statusText,status:n.status,url:n.responseURL,text:function(){return Promise.resolve(n.responseText)},json:function(){return Promise.resolve(JSON.parse(n.responseText))},blob:function(){return Promise.resolve(new Blob([n.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var l in n.open(t.method||"get",e,!0),n.onload=function(){n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,r){o.push(t=t.toLowerCase()),a.push([t,r]),s[t]=s[t]?s[t]+","+r:r}),r(u())},n.onerror=i,n.withCredentials="include"==t.credentials,t.headers)n.setRequestHeader(l,t.headers[l]);n.send(t.body||null)})},De=function(){function e(e){this.client=e}return e.prototype.request=function(e){return Ae(this,void 0,void 0,function(){return _e(this,function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}})})},e}(),Ke={request:function(e,t,r,i,n){return function(e,t){return null==t||t<=0?e:new Promise(function(r,i){pe.setTimeout(function(){i(new ce("Request timeout after "+t+" milliseconds"))},t),e.then(r,i)})}(Ae(void 0,void 0,void 0,function(){var n,o;return _e(this,function(a){switch(a.label){case 0:return[4,qe(e,{method:t,headers:r,body:i})];case 1:return n=a.sent(),o={status:n.status},[4,n.text()];case 2:return o.body=a.sent(),[2,o]}})}),n)}};!function(e){e[e.Disable=0]="Disable",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose"}(Fe||(Fe={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(Le||(Le={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(Re||(Re={}));var ze=function(e){return!e||e===Re.FallbackInline||e===Re.FallbackConfig||e===Re.SecondaryInitialVariants},Be={debug:!1,logLevel:Fe.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:Le.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:Ke},Je="1.20.0",We=function(){function e(e,t){var r,i=this;this.isReady=new Promise(function(e){i.resolve=e}),this.config=e,this.client=t;var n=null!==(r=e.instanceName)&&void 0!==r?r:Be.instanceName;this.queue=new Xe(n),this.cache=new Qe(n)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()},function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},e.prototype.getExposureEvent=function(e){var t,r,i,n={eventType:"$exposure",eventProperties:e};return(null===(t=e.metadata)||void 0===t?void 0:t.exposureEvent)?n={eventType:null===(r=e.metadata)||void 0===r?void 0:r.exposureEvent,eventProperties:e}:"web"===(null===(i=e.metadata)||void 0===i?void 0:i.deliveryMethod)&&(n={eventType:"$impression",eventProperties:e}),n},e}(),Qe=function(){function e(e){this.isSessionStorageAvailable=$e(),this.inMemoryCache={},this.storageKey="EXP_sent_v2_".concat(e),this.isSessionStorageAvailable&&pe.sessionStorage.removeItem("EXP_sent_".concat(e))}return e.prototype.shouldTrack=function(e){var t;if("web"===(null===(t=e.metadata)||void 0===t?void 0:t.deliveryMethod))return!0;this.loadCache();var r=this.inMemoryCache[e.flag_key],i=!1;return r&&r.variant===e.variant||(i=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),i},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=pe.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&pe.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),Xe=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=function(){var e=de();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1}(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=pe.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&0!==this.inMemoryQueue.length){try{for(var r=Te(this.inMemoryQueue),i=r.next();!i.done;i=r.next()){var n=i.value;try{if(!this.tracker(n))return}catch(e){return}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&(pe.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=pe.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),pe.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),$e=function(){var e=de();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1},Ze=function(){function e(e,t){void 0===t&&(t=Fe.Error),this.logger=e,this.logLevel=t}return e.prototype.error=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=Fe.Error&&(t=this.logger).error.apply(t,Me([e],Ve(r),!1))},e.prototype.warn=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=Fe.Warn&&(t=this.logger).warn.apply(t,Me([e],Ve(r),!1))},e.prototype.info=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=Fe.Info&&(t=this.logger).info.apply(t,Me([e],Ve(r),!1))},e.prototype.debug=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=Fe.Debug&&(t=this.logger).debug.apply(t,Me([e],Ve(r),!1))},e.prototype.verbose=function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.logLevel>=Fe.Verbose&&(t=this.logger).verbose.apply(t,Me([e],Ve(r),!1))},e}(),He=function(){function e(){}return e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.error.apply(console,Me([e],Ve(t),!1))},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,Me([e],Ve(t),!1))},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.info.apply(console,Me([e],Ve(t),!1))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,Me([e],Ve(t),!1))},e.prototype.verbose=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,Me([e],Ve(t),!1))},e}(),Ge=function(){function e(){this.globalScope=de()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)},e}(),Ye=function(){function e(e,t){this.namespace=e,this.storage=t}return e.prototype.get=function(){return this.value},e.prototype.put=function(e){this.value=e},e.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},e.prototype.store=function(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},e}(),et=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return Ce({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var i=Te(Object.keys(e)),n=i.next();!n.done;n=i.next()){var o=n.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,i=this.storage.get(this.namespace);try{r=JSON.parse(i)||{}}catch(e){return}var n={};try{for(var o=Te(Object.keys(r)),a=o.next();!a.done;a=o.next()){var s=a.value;try{var u=void 0;(u=this.transformer?this.transformer(r[s]):r[s])&&(n[s]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(n)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),tt=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,i=e.payload,n=e.metadata,o=e.expKey;n&&n.experimentKey?o=n.experimentKey:o&&((n=n||{}).experimentKey=o);var a={};return t?a.key=t:r&&(a.key=r),r&&(a.value=r),n&&(a.metadata=n),i&&(a.payload=i),o&&(a.expKey=o),a}},rt=function(){function e(){this.globalScope=de()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)},e}(),it=function(e){return null==e},nt=function(e){return!!it(e)||e&&0===Object.keys(e).length},ot=function(e){var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)},at=function(){function e(e,t,r,i){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=i}return e.prototype.start=function(e){return Ae(this,void 0,void 0,function(){return _e(this,function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}})})},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return Ae(this,void 0,void 0,function(){var i=this;return _e(this,function(n){return this.done||(this.timeoutHandle=pe.setTimeout(function(){return Ae(i,void 0,void 0,function(){var i,n;return _e(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(i=t+1)<this.attempts&&(n=Math.min(r*this.scalar,this.max),this.backoff(e,i,n)),[3,3];case 3:return[2]}})})},r)),[2]})})},e}(),st=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},ut=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r},lt=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),ct=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var r={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,r)||(this.tracked={}),this.identity=r;var i=e.flag_key in this.tracked,n=this.tracked[e.flag_key];i&&n===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))},e.prototype.identityEquals=function(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId},e}(),ft=function(){function e(t,r){var i,n,o,a,s=this;this.engine=new K,this.isRunning=!1,this.apiKey=t,r=function(e){var t,r;if(!e||"object"!=typeof e)return{};var i={};try{for(var n=Te(Object.entries(e)),o=n.next();!o.done;o=n.next()){var a=Ve(o.value,2),s=a[0],u=a[1];it(u)||(i[s]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i}(r),this.config=Ce(Ce(Ce({},Be),r),{serverUrl:(null==r?void 0:r.serverUrl)||("eu"===(null===(i=null==r?void 0:r.serverZone)||void 0===i?void 0:i.toLowerCase())?"https://api.lab.eu.amplitude.com":Be.serverUrl),flagsServerUrl:(null==r?void 0:r.flagsServerUrl)||("eu"===(null===(n=null==r?void 0:r.serverZone)||void 0===n?void 0:n.toLowerCase())?"https://flag.lab.eu.amplitude.com":Be.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<6e4?6e4:null!==(o=r.flagConfigPollingIntervalMillis)&&void 0!==o?o:Be.flagConfigPollingIntervalMillis}),this.logger=new Ze(this.config.loggerProvider||new He,e.getLogLevel(r));var u=null===(a=this.config)||void 0===a?void 0:a.internalInstanceNameSuffix;if(this.isWebExperiment="web"===u,this.poller=new ve(function(){return s.doFlags()},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var l in this.config.initialVariants)this.config.initialVariants[l]=tt(this.config.initialVariants[l]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new lt(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new ct(this.config.exposureTrackingProvider)),this.integrationManager=new We(this.config,this);var c,f=new De(this.config.httpClient||Ke);this.flagApi=new he(this.apiKey,this.config.flagsServerUrl,f),this.evaluationApi=new fe(this.apiKey,this.config.serverUrl,f);var h=u?"".concat(this.config.instanceName,"-").concat(u):this.config.instanceName;c=this.isWebExperiment?new rt:new Ge,this.variants=function(e,t,r){var i=e.substring(e.length-6),n="amp-exp-".concat(t,"-").concat(i);return new et(n,r,tt)}(this.apiKey,h,c),this.flags=function(e,t,r){void 0===r&&(r=new Ge);var i=e.substring(e.length-6),n="amp-exp-".concat(t,"-").concat(i,"-flags");return new et(n,r)}(this.apiKey,h,c),this.fetchVariantsOptions=function(e,t,r){void 0===r&&(r=new Ge);var i=e.substring(e.length-6),n="amp-exp-".concat(t,"-").concat(i,"-variants-options");return new Ye(n,r)}(this.apiKey,h,c);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return Ae(this,void 0,void 0,function(){var t,r,i;return _e(this,function(n){switch(n.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),n.label=1;case 1:return n.trys.push([1,6,,7]),t=this.doFlags(),null===(i=this.config.fetchOnStart)||void 0===i||i?[4,Promise.all([this.fetch(e),t])]:[3,3];case 2:return n.sent(),[3,5];case 3:return[4,t];case 4:n.sent(),n.label=5;case 5:return[3,7];case 6:if(r=n.sent(),this.config.throwOnError)throw r;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(){return Ae(this,arguments,void 0,function(e,t){var r;return void 0===e&&(e=this.user),_e(this,function(i){switch(i.label){case 0:this.setUser(e||{}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return i.sent(),[3,4];case 3:if(r=i.sent(),this.config.throwOnError)throw r;return r instanceof ce?this.logger.debug(r):this.logger.error(r),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){var r,i;if(!this.apiKey)return{value:void 0};var n=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,n),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat((null===(r=n.variant)||void 0===r?void 0:r.key)||(null===(i=n.variant)||void 0===i?void 0:i.value))),n.variant||{}},e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e){var r=this.flags.get(t);ot(r)||delete e[t]}return Ce(Ce(Ce({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){var e;if(!this.user)return this.user;if(null===(e=this.user)||void 0===e?void 0:e.user_properties){var t=Ce({},this.user.user_properties);return Ce(Ce({},this.user),{user_properties:t})}return Ce({},this.user)},e.prototype.setUser=function(e){var t;if(e)if(null===(t=this.user)||void 0===t?void 0:t.user_properties){var r=Ce({},e.user_properties);this.user=Ce(Ce({},e),{user_properties:r})}else this.user=Ce({},e);else this.user=null},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach(function(t){e.flags.get(t.key)||e.flags.put(t.key,t)})},e.prototype.evaluate=function(e){var t,r,i=this.addContext(this.user),n=function(e,t){var r,i,n=o({},e),a=[],s=t||Object.keys(n);try{for(var f=u(s),h=f.next();!h.done;h=f.next()){var p=h.value,d=z(p,n);d&&a.push.apply(a,c([],l(d),!1))}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}return a}(this.flags.getAll(),e),a=function(e){var t,r,i,n;if(!e)return{};var o={user:e},a=de();a&&(o.page={url:a.location.href});var s={};if(!e.groups)return o;try{for(var u=Te(Object.keys(e.groups)),l=u.next();!l.done;l=u.next()){var c=l.value,f=e.groups[c];if(f.length>0&&f[0]){var h=f[0],p={group_name:h},d=null===(n=null===(i=e.group_properties)||void 0===i?void 0:i[c])||void 0===n?void 0:n[h];d&&Object.keys(d).length>0&&(p.group_properties=d),s[c]=p}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return Object.keys(s).length>0&&(o.groups=s),delete o.user.groups,delete o.user.group_properties,o}(i),s=this.engine.evaluate(a,n),f={};try{for(var h=Te(Object.keys(s)),p=h.next();!p.done;p=h.next()){var d=p.value;f[d]=ut(s[d])}}catch(e){t={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}return f},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===Le.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===Le.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var i=this.flags.get(e);return(ot(i)||!r.variant&&i)&&(r=this.localEvaluationVariantAndSource(e,i,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var i,n={},o=this.evaluate([t.key])[e],a=Re.LocalEvaluation,s=null===(i=null==o?void 0:o.metadata)||void 0===i?void 0:i.default;if(!it(o)&&!s)return{variant:st(o),source:a,hasDefaultVariant:!1};if(s&&(n={variant:st(o),source:a,hasDefaultVariant:!0}),!it(r))return{variant:st(r),source:Re.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var u=this.config.initialVariants[e];if(!it(u))return{variant:st(u),source:Re.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var l=st(this.config.fallbackVariant),c={variant:l,source:Re.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return nt(l)?n:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,i={},n=this.variants.get(e),o=null===(r=null==n?void 0:n.metadata)||void 0===r?void 0:r.default;if(!it(n)&&!o)return{variant:st(n),source:Re.LocalStorage,hasDefaultVariant:!1};if(o&&(i={variant:st(n),source:Re.LocalStorage,hasDefaultVariant:!0}),!it(t))return{variant:st(t),source:Re.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var a=this.config.initialVariants[e];if(!it(a))return{variant:st(a),source:Re.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var s=st(this.config.fallbackVariant),u={variant:s,source:Re.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return nt(s)?i:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,i={},n=this.config.initialVariants[e];if(!it(n))return{variant:st(n),source:Re.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),a=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!it(o)&&!a)return{variant:st(o),source:Re.LocalStorage,hasDefaultVariant:!1};if(a&&(i={variant:st(o),source:Re.LocalStorage,hasDefaultVariant:!0}),!it(t))return{variant:st(t),source:Re.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var s=st(this.config.fallbackVariant),u={variant:s,source:Re.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return nt(s)?i:u},e.prototype.fetchInternal=function(e,t,r,i){return Ae(this,void 0,void 0,function(){var n,o,a;return _e(this,function(s){switch(s.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),s.label=1;case 1:return s.trys.push([1,4,,5]),[4,this.doFetch(e,t,Ce({trackingOption:null===(a=this.fetchVariantsOptions.get())||void 0===a?void 0:a.trackingOption},i))];case 2:return n=s.sent(),[4,this.storeVariants(n,i)];case 3:return s.sent(),[2,n];case 4:throw o=s.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,i),o;case 5:return[2]}})})},e.prototype.setTracksAssignment=function(e){return Ae(this,void 0,void 0,function(){return _e(this,function(t){return this.fetchVariantsOptions.put(Ce(Ce({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=Ce({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return Ae(this,void 0,void 0,function(){var i,n,o,a,s,u,l;return _e(this,function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,Ce({timeoutMillis:t},r))];case 2:i=c.sent(),n={};try{for(o=Te(Object.keys(i)),a=o.next();!a.done;a=o.next())s=a.value,n[s]=ut(i[s])}catch(e){u={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.logger.debug("[Experiment] Received variants: ",n),[2,n]}})})},e.prototype.doFlags=function(){return Ae(this,void 0,void 0,function(){var e,t,r;return _e(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e=void 0,this.isWebExperiment?[4,this.addContextOrWait(this.getUser())]:[3,2];case 1:e=i.sent(),i.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:Je,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=i.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if(!((r=i.sent())instanceof ce))throw r;if(this.logger.debug(r),this.config.throwOnError)throw r;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return Ae(this,void 0,void 0,function(){var r,i,n,o;return _e(this,function(a){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),i=function(t){r=r.filter(function(e){return e!==t}),n.variants.put(t,e[t])},n=this,e)i(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},e.prototype.startRetries=function(e,t){return Ae(this,void 0,void 0,function(){var r=this;return _e(this,function(i){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new at(8,500,1e4,1.5),this.retriesBackoff.start(function(){return Ae(r,void 0,void 0,function(){return _e(this,function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}})})}),[2]})})},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),i=this.integrationManager.getUser(),n=Ce(Ce(Ce({},null==r?void 0:r.user_properties),i.user_properties),null==e?void 0:e.user_properties);return Ce(Ce(Ce(Ce({library:"experiment-js-client/".concat(Je)},r),i),e),{user_properties:n})},e.prototype.addContextOrWait=function(e){return Ae(this,void 0,void 0,function(){return _e(this,function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}})})},e.prototype.sourceVariants=function(){return this.config.source==Le.LocalStorage?this.variants.getAll():this.config.source==Le.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==Le.LocalStorage?this.config.initialVariants:this.config.source==Le.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){var r,i,n,o,a,s,u,l,c;if(null===(n=null===(i=null===(r=t.variant)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.trackExposure)||void 0===n||n){this.legacyExposureInternal(e,t.variant,t.source);var f={flag_key:e},h=ze(t.source);if(!h||t.hasDefaultVariant){(null===(o=t.variant)||void 0===o?void 0:o.expKey)&&(f.experiment_key=null===(a=t.variant)||void 0===a?void 0:a.expKey);var p=null===(s=t.variant)||void 0===s?void 0:s.metadata;if(h||(null==p?void 0:p.default)||((null===(u=t.variant)||void 0===u?void 0:u.key)?f.variant=t.variant.key:(null===(l=t.variant)||void 0===l?void 0:l.value)&&(f.variant=t.variant.value)),p&&(f.metadata=p),this.isWebExperiment&&(f.time=Date.now()),this.isWebExperiment){var d=de();if(null==d?void 0:d.location)try{var v=d.location.href;f.metadata.url=v.split("?")[0]||""}catch(e){}}var y=this.addContext(this.getUser());null===(c=this.userSessionExposureTracker)||void 0===c||c.track(f,y),this.integrationManager.track(f)}}},e.prototype.legacyExposureInternal=function(e,t,r){var i,n,o,a,s;if(this.analyticsProvider){var u=function(e,t,r,i){var n,o=null==r?void 0:r.value,a="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:a,properties:{key:t,variant:o,source:i},userProperties:(n={},n[a]=o,n)}}(this.addContext(this.getUser()),e,t,r);ze(r)||!(null==t?void 0:t.value)?null===(n=null===(i=this.analyticsProvider)||void 0===i?void 0:i.unsetUserProperty)||void 0===n||n.call(i,u):(null==t?void 0:t.value)&&(null===(a=null===(o=this.analyticsProvider)||void 0===o?void 0:o.setUserProperty)||void 0===a||a.call(o,u),null===(s=this.analyticsProvider)||void 0===s||s.track(u))}},e.getLogLevel=function(e){var t;return!0===e.debug?Fe.Debug:null!==(t=e.logLevel)&&void 0!==t?t:Fe.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof le)||(e.statusCode<400||e.statusCode>=500||429===e.statusCode)},e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),ht=function(){function e(e,t){var r,i,n;this.globalScope=de(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(i=this.globalScope)||void 0===i?void 0:i.navigator.userAgent:void 0,this.ua=new Ee.UAParser(this.userAgent).getResult(),this.localStorage=new Ge,this.sessionStorage=new rt,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null===(n=this.apiKey)||void 0===n?void 0:n.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,i,n,o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Ce({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(r=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==r?r:"desktop",referring_url:null===(n=null===(i=this.globalScope)||void 0===i?void 0:i.document)||void 0===n?void 0:n.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(r=e.browser)||void 0===r?void 0:r.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,i,n;if(null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.document)||void 0===t?void 0:t.cookie)return Object.fromEntries(null===(n=null===(i=null===(r=this.globalScope)||void 0===r?void 0:r.document)||void 0===i?void 0:i.cookie)||void 0===n?void 0:n.split("; ").map(function(e){return e.split("=")}))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){var e,t,r;if(this.globalScope){var i={};try{var n=new URL(this.globalScope.location.href);try{for(var o=Te(n.searchParams),a=o.next();!a.done;a=o.next()){var s=Ve(a.value,2),u=s[0],l=s[1];i[u]=Me(Me([],Ve(null!==(r=i[u])&&void 0!==r?r:[]),!1),Ve(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(i).reduce(function(e,t){var r=Ve(t,2),i=r[0],n=r[1];return e[i]=1==n.length?n[0]:n,e},{})}},e}();pe.experimentInstances={};var pt=pe.experimentInstances,dt=function(e){return(null==e?void 0:e.instanceName)||Be.instanceName},vt=function(e,t,r){var i=function(e,t){var r=dt(t),i=null==t?void 0:t.internalInstanceNameSuffix;return i?"".concat(r,".").concat(e,".").concat(i):"".concat(r,".").concat(e)}(e,t),n=pt[i];return n||(n=function(e,t){return new ft(e,Ce(Ce({},t),{userProvider:new ht(null==t?void 0:t.userProvider,e)}))}(e,t),r&&n.addPlugin(r()),pt[i]=n,n)},yt=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,i){return t(this,void 0,void 0,function(){var t;return r(this,function(r){return this.experiment=function(e,t){return vt(e,t,function(){return new je(e,Pe.getInstance(dt(t)),1e4)})}((null===(t=this.config)||void 0===t?void 0:t.deploymentKey)||e.apiKey,this.config),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}();e.ExperimentPlugin=yt,e.experimentPlugin=function(e){return new yt(e)},Object.defineProperty(e,"__esModule",{value:!0})});
Binary file
@@ -1,12 +1,18 @@
1
1
  import { EnrichmentPlugin, BrowserClient, BrowserConfig } from '@amplitude/analytics-core';
2
2
  import { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';
3
+ /**
4
+ * Fallback to project API key if no experiment deployment key.
5
+ */
6
+ export type ExperimentPluginConfig = ExperimentConfig & {
7
+ deploymentKey?: string;
8
+ };
3
9
  export declare class ExperimentPlugin implements EnrichmentPlugin<BrowserClient, BrowserConfig> {
4
10
  static pluginName: string;
5
11
  name: string;
6
12
  experiment: IExperimentClient;
7
- config?: ExperimentConfig;
8
- constructor(config?: ExperimentConfig);
13
+ config?: ExperimentPluginConfig;
14
+ constructor(config?: ExperimentPluginConfig);
9
15
  setup(config: BrowserConfig, _client: BrowserClient): Promise<void>;
10
16
  }
11
- export declare const experimentPlugin: (config?: ExperimentConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig>;
17
+ export declare const experimentPlugin: (config?: ExperimentPluginConfig) => EnrichmentPlugin<BrowserClient, BrowserConfig>;
12
18
  //# sourceMappingURL=experiment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE3F,OAAO,EACL,gBAAgB,EAChB,MAAM,IAAI,iBAAiB,EAE5B,MAAM,iCAAiC,CAAC;AAEzC,qBAAa,gBAAiB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACrF,MAAM,CAAC,UAAU,SAA4C;IAC7D,IAAI,SAA+B;IAGnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,CAAC,EAAE,gBAAgB,CAAC;gBAEd,MAAM,CAAC,EAAE,gBAAgB;IAI/B,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa;CAG1D;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAI1G,CAAC"}
1
+ {"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/experiment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE3F,OAAO,EACL,gBAAgB,EAChB,MAAM,IAAI,iBAAiB,EAE5B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,qBAAa,gBAAiB,YAAW,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC;IACrF,MAAM,CAAC,UAAU,SAA4C;IAC7D,IAAI,SAA+B;IAGnC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,MAAM,CAAC,EAAE,sBAAsB,CAAC;gBAEpB,MAAM,CAAC,EAAE,sBAAsB;IAIrC,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa;CAG1D;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,sBAAsB,KAAK,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAIhH,CAAC"}
@@ -1,3 +1,3 @@
1
- export { ExperimentPlugin, experimentPlugin } from './experiment';
2
- export { ExperimentConfig, Client as IExperimentClient } from '@amplitude/experiment-js-client';
1
+ export { ExperimentPlugin, experimentPlugin, ExperimentPluginConfig } from './experiment';
2
+ export { Client as IExperimentClient } from '@amplitude/experiment-js-client';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "1.0.0-beta.3";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/plugin-experiment-browser",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,25 +21,29 @@
21
21
  "files": [
22
22
  "lib"
23
23
  ],
24
+ "dependencies": {
25
+ "@amplitude/experiment-js-client": "^1.15.5",
26
+ "@amplitude/analytics-core": "2.36.1"
27
+ },
28
+ "devDependencies": {
29
+ "rollup": "^2.79.1"
30
+ },
24
31
  "scripts": {
25
- "build": "yarn bundle && yarn build:es5 && yarn build:esm",
32
+ "build": "pnpm bundle && pnpm build:es5 && pnpm build:esm",
26
33
  "bundle": "rollup --config rollup.config.js",
27
34
  "build:es5": "tsc -p ./tsconfig.es5.json",
28
35
  "build:esm": "tsc -p ./tsconfig.esm.json",
36
+ "watch": "tsc -p ./tsconfig.esm.json --watch",
29
37
  "clean": "rimraf node_modules lib coverage",
30
- "fix": "yarn fix:eslint & yarn fix:prettier",
38
+ "fix": "pnpm fix:eslint & pnpm fix:prettier",
31
39
  "fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
32
40
  "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
33
- "lint": "yarn lint:eslint & yarn lint:prettier",
41
+ "lint": "pnpm lint:eslint & pnpm lint:prettier",
34
42
  "lint:eslint": "eslint '{src,test}/**/*.ts'",
35
43
  "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
36
44
  "test": "jest",
37
45
  "typecheck": "tsc -p ./tsconfig.json",
38
- "version": "yarn version-file yarn build",
39
- "version-file": "echo '// Autogenerated by `yarn version-file`. DO NOT EDIT' > src/version.ts && node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" >> src/version.ts"
40
- },
41
- "dependencies": {
42
- "@amplitude/analytics-core": "^2.10.0",
43
- "@amplitude/experiment-js-client": "^1.15.5"
46
+ "version": "pnpm version-file && pnpm build",
47
+ "version-file": "echo '// Autogenerated by `npm run version-file`. DO NOT EDIT' > src/version.ts && node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" >> src/version.ts"
44
48
  }
45
- }
49
+ }