@pendo/agent 2.268.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -0
- package/bin/cli.js +181 -0
- package/dist/debugger-plugin.min.js +1 -0
- package/dist/guide.css +756 -0
- package/dist/pendo.debugger.min.js +48 -0
- package/dist/pendo.module.js +49982 -0
- package/dist/pendo.module.min.js +4 -0
- package/dist/pendo.preview.min.js +42 -0
- package/dist/replay.worker.min.js +4 -0
- package/dist/servers.json +26 -0
- package/index.js +10 -0
- package/package.json +16 -0
- package/setup.js +95 -0
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Pendo Agent
|
|
2
|
+
|
|
3
|
+
This package is for Pendo customers who want to host the Pendo agent on their own infrastructure.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @pendo/agent
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Import the package into your application code and create the Pendo agent using your own settings:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import { initialize, TextCapture } from '@pendo/agent';
|
|
19
|
+
import pendoConfig from '../pendo.config.json';
|
|
20
|
+
|
|
21
|
+
const pendo = await initialize({
|
|
22
|
+
apiKey: 'YOUR_API_KEY',
|
|
23
|
+
env: 'YOUR_PENDO_ENVIRONMENT',
|
|
24
|
+
visitor: {
|
|
25
|
+
id: 'THE_VISITOR_ID'
|
|
26
|
+
},
|
|
27
|
+
account: {
|
|
28
|
+
id: 'THE_ACCOUNT_ID'
|
|
29
|
+
},
|
|
30
|
+
globalKey: 'pendo',
|
|
31
|
+
plugins: [ TextCapture ],
|
|
32
|
+
config: pendoConfig,
|
|
33
|
+
assets: {
|
|
34
|
+
host: 'https://mycdn.com',
|
|
35
|
+
path: 'public',
|
|
36
|
+
localOnly: false
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
The object returned by calling `initialize` is the same as a snippet install of the Pendo Agent and has access to all public functions found in the public function [documentation pages](https://agent.pendo.io/public/agent).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Parameters
|
|
44
|
+
|
|
45
|
+
| key | required? | type | description |
|
|
46
|
+
| --- | --------- | ---- | ---------- |
|
|
47
|
+
| apiKey | required | string | Your specific application `apiKey` can be found by going to the application details page in the Pendo App for your application. It will be a 32-digit code that identifies that application and connects it to Pendo. |
|
|
48
|
+
| env | required | string | The environment that your Pendo subscription resides in. `io` is the default US environment and environments other than that can be found in the url that you use to access Pendo (e.g. app.`eu`.pendo.io). One of: ['io', 'eu', 'jpn', 'us1', 'au']. |
|
|
49
|
+
| visitor | optional | object | The visitor information for the current user of your application. This includes the `id` and any other metadata you want attached to the visitor. If not provided the visitor will be treated as an anonymous visitor. |
|
|
50
|
+
| account | optional | object | The account information for the current user of your application if applicable. If not provided the visitor will not be assigned to an account. |
|
|
51
|
+
| globalKey | optional | string | The key where you would like the global `pendo` object to be stored after initialization. By default this will be stored on `window.pendo` but this allows it to change to a different name if desired. |
|
|
52
|
+
| plugins | optional | array | A list of imported plugins to enable additional features in the Pendo Agent. More information can be found [below](#Plugins). |
|
|
53
|
+
| config | optional | object | An object that contains the entire server configuration for your application may be passed. By default, the Agent will download the latest configuration upon initialization if not passed in. More information can be found [below](#Config). |
|
|
54
|
+
| assets | optional | object | Configuration for the host and path to support including Agent static assets in your application code. More information can be found [below](#Assets). |
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
In addition to the above parameters, any additional options that can normally be provided to `pendo.initialize` may be included. See [our documentation](https://agent.pendo.io/config/) for the full list of options that can be passed to `initialize`.
|
|
58
|
+
|
|
59
|
+
### Additional Information
|
|
60
|
+
|
|
61
|
+
#### Assets
|
|
62
|
+
|
|
63
|
+
During runtime, the Pendo Agent occassionally needs to download additional script files to provide functionality that is not bundled into the Agent. This functionality is mostly meant for admins that need to design and preview guides as well as debug Pendo within their application. By default the Agent in this package will download those assets from Pendo's CDN when needed. If you would prefer to include these scripts in your application code instead of downloading them from Pendo at runtime, you can provide a host and path to where these files can be loaded from. The host can be your own CDN or other location and if
|
|
64
|
+
|
|
65
|
+
| name | type | description |
|
|
66
|
+
| ---- | ---- | ----------- |
|
|
67
|
+
| host | string | domain host for where your assets will be hosted, if this value is an empty string, the assets will be loaded using a relative url. |
|
|
68
|
+
| path | string | additional path to add to the url before the filename. Useful if your assets are served from a path of `public` or something similar. If left blank, no additional path will be added to the urls. |
|
|
69
|
+
| localOnly | boolean | serve all possible assets from the given asset host. This will prevent the use of things that are unable to be self served, like the Visual Design Studio and guide code blocks. To be able to use guide code blocks you will need to allow remote scripts. The designer will not launch at all and will print a log message instead if this is set to true. Defaults to false. |
|
|
70
|
+
|
|
71
|
+
The [CLI](#CLI) below can be used to copy these static files from this package to your application code.
|
|
72
|
+
|
|
73
|
+
#### Config
|
|
74
|
+
|
|
75
|
+
By default, the Pendo Agent will use the provided apiKey and environment to download the latest version of the configuration for that application. This includes what settings have been enabled/disabled as well as any configured historical metadata fields and feature event properties. This ensures that the latest configuration is always being used without you requiring to redeploy your application. If you would prefer to not download the latest configuration and instead use a local static version, you can pass the JSON object to the `config` property instead. This will mean however, that to take advantage of any changes made to settings in the Pendo UI or to your historical metadata fields and feature event properties you will need to download a new version of the config and redeploy your application.
|
|
76
|
+
|
|
77
|
+
The [CLI](#CLI) below can be used to easily download and save a new version of that configuration.
|
|
78
|
+
|
|
79
|
+
#### Plugins
|
|
80
|
+
|
|
81
|
+
Pendo has a subset of features that need to be manually enabled or are part of separate purchases. By default the functionality for these features is not included in the Agent. When using this package when there is a need to enable these features requires passing in the desired plugins. These plugins are available to be imported just like the `initialize` function and can then be passed directly into an array using the `plugins` property. Any plugin that also requires an additional purchase or package can still be included but will not function without configuration inside of your subscription.
|
|
82
|
+
|
|
83
|
+
The current list of available plugins and their export names are:
|
|
84
|
+
- Text Capture (TextCapture)
|
|
85
|
+
- Feedback (Feedback)
|
|
86
|
+
- Session Replay (Replay)
|
|
87
|
+
- Guide Logic (GuideMarkdown)
|
|
88
|
+
- Voice of the Customer Portal (VocPortal)
|
|
89
|
+
|
|
90
|
+
## CLI
|
|
91
|
+
|
|
92
|
+
The Pendo package includes a CLI tool to be able to simplify a few actions providing greater control of the Pendo Agent in your application. Once you have installed `@pendo/agent` in your application, you will have access to the `pendo` script from your terminal (you can also use a tool like `npx` to make use of the `pendo` script without installing the package if desired by using `npx pendo`). The usage of this script can be found below or by typing `pendo` or `pendo help` into your terminal where the package is installed:
|
|
93
|
+
|
|
94
|
+
### Help
|
|
95
|
+
```
|
|
96
|
+
Usage: pendo <command>
|
|
97
|
+
|
|
98
|
+
CLI for @pendo/agent to assist in integrating the Pendo Agent into your application.
|
|
99
|
+
|
|
100
|
+
Commands:
|
|
101
|
+
pendo config download a new Pendo Agent configuration file for your application
|
|
102
|
+
pendo copy copy static assets for the Pendo Agent to a static folder
|
|
103
|
+
pendo help provide help for how to use the Pendo CLI
|
|
104
|
+
pendo help <command> search for help on a specific <command>
|
|
105
|
+
pendo version show the current version of the Pendo Agent
|
|
106
|
+
|
|
107
|
+
Documentation for the Pendo Agent can be found at:
|
|
108
|
+
https://agent.pendo.io
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Config
|
|
112
|
+
```
|
|
113
|
+
Usage: pendo config --apiKey=<application_api_key> --env=<subscription_environment> [--output=<filename>]
|
|
114
|
+
|
|
115
|
+
Download a new configuration file for a specific application built from the most recent subscription and application settings.
|
|
116
|
+
|
|
117
|
+
Options:
|
|
118
|
+
--apiKey required, the api key for your Pendo application, found in the application settings page in the Pendo app
|
|
119
|
+
--env required, the Pendo environment for your subscription, allowed environments: [${environments}]
|
|
120
|
+
--output optional, the name of where to save the config, defaults to "pendo.config.json"
|
|
121
|
+
|
|
122
|
+
Examples:
|
|
123
|
+
Download and save the configuration file from the default US environment
|
|
124
|
+
$ pendo config --apiKey=dd753dfd-ac99-4c5c-48ad-6eb18190cf77 --env=io --output=pendo.config.json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Copy
|
|
128
|
+
```
|
|
129
|
+
Usage: pendo copy --dest=<destination_folder> [--src=<node_module_folder>]
|
|
130
|
+
|
|
131
|
+
Copy static Pendo Agent files into a local folder for self hosting. Includes guide styles, scripts for the debugger and preview mode, and the worker file for Session Replay.
|
|
132
|
+
|
|
133
|
+
Options:
|
|
134
|
+
--dest required, the destination folder to copy the static files to, usually the "public" folder of your application
|
|
135
|
+
--src optional, the location of the @pendo/agent dist folder, defaults to "./node_modules/@pendo/agent/dist"
|
|
136
|
+
|
|
137
|
+
Examples:
|
|
138
|
+
Copy from the default location to your public folder
|
|
139
|
+
$ pendo copy --dest=public
|
|
140
|
+
```
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import minimist from 'minimist';
|
|
4
|
+
import https from 'https';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
|
|
8
|
+
const options = minimist(process.argv.slice(2));
|
|
9
|
+
|
|
10
|
+
function config() {
|
|
11
|
+
const servers = JSON.parse(fs.readFileSync(new URL('../dist/servers.json', import.meta.url), 'utf8'));
|
|
12
|
+
if (!options.apiKey || typeof options.apiKey !== 'string') {
|
|
13
|
+
console.error('Missing required option "apiKey", please provide the api key for your application using the "--apiKey=" parameter');
|
|
14
|
+
console.error('\nExample: $ pendo config --apiKey=3d0ffbc4-bd4d-438f-69b5-354efd574672');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
if (!options.env || !servers.ENV[options.env]) {
|
|
18
|
+
console.error('Missing or invalid option "env", please provide a valid environment for your subscription using the "--env=" parameter');
|
|
19
|
+
console.error('\nExample: $ pendo config --env=io');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
if (!options.output || typeof options.output !== 'string') {
|
|
23
|
+
console.debug('No "output" name provided, using default of "pendo.config.json"');
|
|
24
|
+
options.output = 'pendo.config.json';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const file = fs.createWriteStream(options.output);
|
|
28
|
+
const url = new URL(`agent/static/${options.apiKey}/config.json`, `https://${servers.assetHost[options.env]}`).toString();
|
|
29
|
+
try {
|
|
30
|
+
https.get(url, function(response) {
|
|
31
|
+
let data = '';
|
|
32
|
+
response.on('data', (chunk) => {
|
|
33
|
+
data += chunk;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
response.on('end', () => {
|
|
37
|
+
const config = JSON.parse(data);
|
|
38
|
+
delete config.stagingAgentUrl;
|
|
39
|
+
delete config.stagingServerHashes;
|
|
40
|
+
delete config.stagingServers;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
response.pipe(file);
|
|
44
|
+
|
|
45
|
+
file.on('finish', () => {
|
|
46
|
+
file.close();
|
|
47
|
+
console.debug('Pendo Agent config downloaded successfully');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.error(`Unable to download new Pendo Agent config file, please confirm the apiKey and contentHost. apiKey=${options.apiKey}, contentHost=${options.contentHost}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function configHelp() {
|
|
56
|
+
const environments = Object.keys(JSON.parse(fs.readFileSync(new URL('../dist/servers.json', import.meta.url), 'utf8')).ENV);
|
|
57
|
+
console.log(`Usage: pendo config --apiKey=<application_api_key> --env=<subscription_environment> [--output=<filename>]
|
|
58
|
+
|
|
59
|
+
Download a new configuration file for a specific application built from the most recent subscription and application settings.
|
|
60
|
+
|
|
61
|
+
Options:
|
|
62
|
+
--apiKey required, the api key for your Pendo application, found in the application settings page in the Pendo app
|
|
63
|
+
--env required, the Pendo environment for your subscription, allowed environments: [${environments}]
|
|
64
|
+
--output optional, the name of where to save the config, defaults to "pendo.config.json"
|
|
65
|
+
|
|
66
|
+
Examples:
|
|
67
|
+
Download and save the configuration file from the default US environment
|
|
68
|
+
$ pendo config --apiKey=dd753dfd-ac99-4c5c-48ad-6eb18190cf77 --env=io --output=pendo.config.json`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function copy() {
|
|
72
|
+
const fsp = fs.promises;
|
|
73
|
+
|
|
74
|
+
if (!options.dest || typeof options.dest !== 'string') {
|
|
75
|
+
console.error('Missing required option "dest" to copy static files to, please provide the destination folder for your project using the "--dest=" parameter.');
|
|
76
|
+
console.error('\nExample: $ pendo copy --dest=public');
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!options.src || typeof options.src !== 'string') {
|
|
81
|
+
console.debug('No "src" provided, using default of "node_modules/@pendo/agent/dist"');
|
|
82
|
+
options.src = './node_modules/@pendo/agent/dist';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function copyFiles(srcDir, destDir, files) {
|
|
86
|
+
return Promise.all(files.map(f => {
|
|
87
|
+
return fsp.copyFile(path.join(srcDir, f), path.join(destDir, f));
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
copyFiles(options.src, options.dest, ['guide.css', 'pendo.debugger.min.js', 'debugger-plugin.min.js', 'pendo.preview.min.js', 'replay.worker.min.js']).then(() => {
|
|
92
|
+
console.debug('Copied all static Pendo Agent files successfully');
|
|
93
|
+
}).catch(err => { // eslint-disable-line dot-notation
|
|
94
|
+
console.error('Unable to copy static Pendo Agent files', err);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function copyHelp() {
|
|
99
|
+
console.log(`Usage: pendo copy --dest=<destination_folder> [--src=<node_module_folder>]
|
|
100
|
+
|
|
101
|
+
Copy static Pendo Agent files into a local folder for self hosting. Includes guide styles, scripts for the debugger and preview mode, and the worker file for Session Replay.
|
|
102
|
+
|
|
103
|
+
Options:
|
|
104
|
+
--dest required, the destination folder to copy the static files to, usually the "public" folder of your application
|
|
105
|
+
--src optional, the location of the @pendo/agent dist folder, defaults to "./node_modules/@pendo/agent/dist"
|
|
106
|
+
|
|
107
|
+
Examples:
|
|
108
|
+
Copy from the default location to your public folder
|
|
109
|
+
$ pendo copy --dest=public`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function version() {
|
|
113
|
+
const packageFile = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
114
|
+
console.log(packageFile.version);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function versionHelp() {
|
|
118
|
+
console.log(`Usage: pendo version
|
|
119
|
+
|
|
120
|
+
Show the current version of the Pendo Agent installed.`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const helpers = {
|
|
124
|
+
'config': configHelp,
|
|
125
|
+
'copy': copyHelp,
|
|
126
|
+
'version': versionHelp
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
function help() {
|
|
130
|
+
const subCommand = options._[1];
|
|
131
|
+
|
|
132
|
+
if (!subCommand) {
|
|
133
|
+
console.log(`Usage: pendo <command>
|
|
134
|
+
|
|
135
|
+
CLI for @pendo/agent to assist in integrating the Pendo Agent into your application.
|
|
136
|
+
|
|
137
|
+
Commands:
|
|
138
|
+
pendo config download a new Pendo Agent configuration file for your application
|
|
139
|
+
pendo copy copy static assets for the Pendo Agent to a static folder
|
|
140
|
+
pendo help provide help for how to use the Pendo CLI
|
|
141
|
+
pendo help <command> search for help on a specific <command>
|
|
142
|
+
pendo version show the current version of the Pendo Agent
|
|
143
|
+
|
|
144
|
+
Documentation for the Pendo Agent can be found at:
|
|
145
|
+
https://agent.pendo.io`);
|
|
146
|
+
} else if (helpers[subCommand]) {
|
|
147
|
+
helpers[subCommand]();
|
|
148
|
+
} else {
|
|
149
|
+
console.error(`Unknown command to find help for: "${subCommand}"`);
|
|
150
|
+
console.error('');
|
|
151
|
+
console.error('To see a list of supported pendo commands, run:');
|
|
152
|
+
console.error(' pendo help');
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const commands = {
|
|
158
|
+
config,
|
|
159
|
+
copy,
|
|
160
|
+
help,
|
|
161
|
+
version
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const cmdText = options._[0];
|
|
165
|
+
|
|
166
|
+
if (!cmdText) {
|
|
167
|
+
help();
|
|
168
|
+
process.exit(0);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const command = commands[cmdText];
|
|
172
|
+
|
|
173
|
+
if (!command) {
|
|
174
|
+
console.error(`Unknown command: "${cmdText}"`);
|
|
175
|
+
console.error('');
|
|
176
|
+
console.error('To see a list of supported pendo commands, run:');
|
|
177
|
+
console.error(' pendo help');
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
command();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){"use strict";class t{constructor(t,e){this.path=t,this.handler=e}}class e{routes={};addRoute(e,n){this.routes[e]||(this.routes[e]=[]),this.routes[e].unshift(new t(e,n))}removeRoute(t){this.routes[t].shift()}lookupRouteProvider(){return t=>this.routes[t]?this.routes[t][0].handler:void 0}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var o=Array.isArray,i="object"==typeof n&&n&&n.Object===Object&&n,a=i,s="object"==typeof self&&self&&self.Object===Object&&self,c=a||s||Function("return this")(),u=c.Symbol,d=u,l=Object.prototype,p=l.hasOwnProperty,f=l.toString,h=d?d.toStringTag:void 0;var g=function(t){var e=p.call(t,h),n=t[h];try{t[h]=void 0;var r=!0}catch(t){}var o=f.call(t);return r&&(e?t[h]=n:delete t[h]),o},v=Object.prototype.toString;var b=g,y=function(t){return v.call(t)},m=u?u.toStringTag:void 0;var w=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":m&&m in Object(t)?b(t):y(t)};var j=function(t){return null!=t&&"object"==typeof t},_=w,T=j;var P=function(t){return"symbol"==typeof t||T(t)&&"[object Symbol]"==_(t)},O=o,I=P,A=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,C=/^\w*$/;var E=function(t,e){if(O(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!I(t))||(C.test(t)||!A.test(t)||null!=e&&t in Object(e))};var S=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},x=w,R=S;var z,N=function(t){if(!R(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},D=r(N),M=c["__core-js_shared__"],$=(z=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+z:"";var H=function(t){return!!$&&$ in t},k=Function.prototype.toString;var W=function(t){if(null!=t){try{return k.call(t)}catch(t){}try{return t+""}catch(t){}}return""},L=N,U=H,F=S,G=W,B=/^\[object .+?Constructor\]$/,q=Function.prototype,Q=Object.prototype,V=q.toString,K=Q.hasOwnProperty,J=RegExp("^"+V.call(K).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var X=function(t){return!(!F(t)||U(t))&&(L(t)?J:B).test(G(t))},Y=function(t,e){return null==t?void 0:t[e]};var Z=function(t,e){var n=Y(t,e);return X(n)?n:void 0},tt=Z(Object,"create"),et=tt;var nt=function(){this.__data__=et?et(null):{},this.size=0};var rt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ot=tt,it=Object.prototype.hasOwnProperty;var at=function(t){var e=this.__data__;if(ot){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return it.call(e,t)?e[t]:void 0},st=tt,ct=Object.prototype.hasOwnProperty;var ut=tt;var dt=nt,lt=rt,pt=at,ft=function(t){var e=this.__data__;return st?void 0!==e[t]:ct.call(e,t)},ht=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ut&&void 0===e?"__lodash_hash_undefined__":e,this};function gt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}gt.prototype.clear=dt,gt.prototype.delete=lt,gt.prototype.get=pt,gt.prototype.has=ft,gt.prototype.set=ht;var vt=gt;var bt=function(){this.__data__=[],this.size=0};var yt=function(t,e){return t===e||t!=t&&e!=e},mt=yt;var wt=function(t,e){for(var n=t.length;n--;)if(mt(t[n][0],e))return n;return-1},jt=wt,_t=Array.prototype.splice;var Tt=wt;var Pt=wt;var Ot=wt;var It=bt,At=function(t){var e=this.__data__,n=jt(e,t);return!(n<0)&&(n==e.length-1?e.pop():_t.call(e,n,1),--this.size,!0)},Ct=function(t){var e=this.__data__,n=Tt(e,t);return n<0?void 0:e[n][1]},Et=function(t){return Pt(this.__data__,t)>-1},St=function(t,e){var n=this.__data__,r=Ot(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function xt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}xt.prototype.clear=It,xt.prototype.delete=At,xt.prototype.get=Ct,xt.prototype.has=Et,xt.prototype.set=St;var Rt=xt,zt=Z(c,"Map"),Nt=vt,Dt=Rt,Mt=zt;var $t=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Ht=function(t,e){var n=t.__data__;return $t(e)?n["string"==typeof e?"string":"hash"]:n.map},kt=Ht;var Wt=Ht;var Lt=Ht;var Ut=Ht;var Ft=function(){this.size=0,this.__data__={hash:new Nt,map:new(Mt||Dt),string:new Nt}},Gt=function(t){var e=kt(this,t).delete(t);return this.size-=e?1:0,e},Bt=function(t){return Wt(this,t).get(t)},qt=function(t){return Lt(this,t).has(t)},Qt=function(t,e){var n=Ut(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Vt.prototype.clear=Ft,Vt.prototype.delete=Gt,Vt.prototype.get=Bt,Vt.prototype.has=qt,Vt.prototype.set=Qt;var Kt=Vt,Jt=Kt;function Xt(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Xt.Cache||Jt),n}Xt.Cache=Jt;var Yt=Xt;var Zt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/\\(\\)?/g,ee=function(t){var e=Yt(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Zt,(function(t,n,r,o){e.push(r?o.replace(te,"$1"):n||t)})),e}));var ne=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o},re=ne,oe=o,ie=P,ae=u?u.prototype:void 0,se=ae?ae.toString:void 0;var ce=function t(e){if("string"==typeof e)return e;if(oe(e))return re(e,t)+"";if(ie(e))return se?se.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n},ue=ce;var de=function(t){return null==t?"":ue(t)},le=o,pe=E,fe=ee,he=de;var ge=function(t,e){return le(t)?t:pe(t,e)?[t]:fe(he(t))},ve=P;var be=function(t){if("string"==typeof t||ve(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e},ye=ge,me=be;var we=function(t,e){for(var n=0,r=(e=ye(e,t)).length;null!=t&&n<r;)t=t[me(e[n++])];return n&&n==r?t:void 0},je=we;var _e=r((function(t,e,n){var r=null==t?void 0:je(t,e);return void 0===r?n:r}));class Te{app=null;router=null;destination=window.parent||window.top;origin="*";constructor(t,e={}){this.app=t,this.router=t.router,this.config=e,this.events=t.PluginAPI.getEventable()}getConfig(t,e){return _e(this.config,t,e)}getDestinationProvider(){return()=>this.destination}getOriginProvider(){return()=>this.origin}triggerOpened(){this.events.trigger("opened",{containerType:this.type})}triggerClosed(){this.events.trigger("closed",{containerType:this.type})}}var Pe={padding:"0 !important",margin:"0 !important","box-sizing":"border-box !important",border:"none !important"},Oe=2147483647,Ie={WINDOW_MARGIN:10,HEADER_HEIGHT:50,TOP:100,LEFT:100,HEIGHT:700,WIDTH:500,MIN_HEIGHT:500,MIN_WIDTH:500};const{MIN_HEIGHT:Ae,MIN_WIDTH:Ce,WINDOW_MARGIN:Ee}=Ie;function Se(t,e,n,r,o){let i=0,a=0,s=0,c=0;function u(n){n.preventDefault(),e.css({visibility:"hidden"}),t.releasePointerCapture(n.pointerId),t.removeEventListener("pointermove",d),o()}function d(t){-1===t.button&&0!==t.buttons?(t.preventDefault(),s=i-t.clientX,c=a-t.clientY,i=t.clientX,a=t.clientY,r(s,c)):u(t)}t.addEventListener("pointerdown",(function(r){if(0!==r.button)return;r.preventDefault(),e.css({visibility:"visible"}),i=r.clientX,a=r.clientY,t.setPointerCapture(r.pointerId),t.addEventListener("pointermove",d),n()})),t.addEventListener("pointerup",u),t.addEventListener("pointerout",u)}function xe(t,e){const n=t.offsetLeft-e,r=window.innerWidth-t.offsetWidth-Ee;return n<Ee||r<Ee?Ee:n>r?r:n}function Re(t,e){const n=t.offsetTop-e,r=window.innerHeight-t.offsetHeight-Ee;return n<Ee||r<Ee?Ee:n>r?r:n}function ze(t,e){const n=t.offsetWidth-e,r=window.innerWidth-t.offsetLeft-Ee;return n>r?r:n<Ce?Ce:n}function Ne(t,e){const n=t.offsetHeight-e,r=window.innerHeight-t.offsetTop-Ee;return n>r?r:n<Ae?Ae:n}class De extends Te{type="frame";destination=window.parent||window.top;origin=window.location.origin;constructor(t,e){super(t,e);const{pendo:n,PluginAPI:r}=t,o=this.getConfig("containerId","pendo-client-app");this.container=n.dom(`<div id="${o}" class="pendo-ignore">`).css({...Pe,height:t.state.height,width:t.state.width,"z-index":Oe-1,"background-color":"#FFFFFF",position:"fixed","box-shadow":"rgb(136, 136, 136) 0px 0px 20px 0px",overflow:"hidden"}),this.handle=n.dom('<div id="pendo-app-draggable-handle">').css({...Pe,"z-index":Oe,height:Ie.HEADER_HEIGHT,width:"calc(100% - 100px)",position:"absolute",cursor:"grab"}).on("dblclick",(()=>{t.state.minimized||(this.container.css({height:Ie.HEIGHT,width:Ie.WIDTH,transition:"all 250ms linear"}),setTimeout((()=>{this.container&&(this.container.css({transition:"none"}),this.saveSize())}),250))})).appendTo(this.container),this.resizeHandle=n.dom('<div id="pendo-app-resize-handle">').css({...Pe,"z-index":Oe,height:0,width:0,"border-left":"10px solid transparent","border-bottom":"10px solid rgb(136, 136, 136)",cursor:"nwse-resize",position:"absolute",bottom:0,right:0}).appendTo(this.container),this.frame=n.dom('<iframe id="pendo-agent-application" src="about:blank">').css({...Pe,height:"100%",width:"100%"}).on("load",(()=>{const e=this.frame[0].contentDocument.createElement.bind(this.frame[0].contentDocument);this.frame[0].contentDocument.createElement=(t,...n)=>{const o=e(t,...n);if("style"===t){const t=r.ConfigReader.get("inlineStyleNonce");t&&o.setAttribute("nonce",t)}return o};const o=document.createElement("script");var i;o.src=(i=n,i&&i.trustedTypesPolicy?i.trustedTypesPolicy:{createScriptURL:t=>t}).createScriptURL(r.getAssetUrl(t.assetName)),this.frame[0].contentDocument.body.appendChild(o),this.frame[0].contentWindow.ignoreIframeMonitor=!0,this.triggerOpened()})).appendTo(this.container),this.blockout=n.dom('<div id="pendo-app-dragging-blockout">').css({"z-index":Oe-2,position:"absolute",height:"100%",width:"100%",top:0,left:0,visibility:"hidden"}).appendTo(n.dom.getBody()),this.elements=[this.container,this.blockout],this.positionFrame=t=>{let{left:e,top:n,height:r}=t;const{minimized:o,width:i}=t;e=e||Ie.LEFT,n=n||Ie.TOP,r=o?Ie.HEADER_HEIGHT:r,e=xe({offsetLeft:e,offsetWidth:i},0),n=Re({offsetTop:n,offsetHeight:r},0),this.container.css({left:e,top:n,height:r}),this.savePosition()},this.saveSize=()=>{const{offsetHeight:t,offsetWidth:e}=this.container[0];t&&e&&this.app.setProperties({height:t,width:e})},this.savePosition=()=>{const{offsetLeft:t,offsetTop:e}=this.container[0];t&&e&&this.app.setProperties({left:t,top:e})},this.toggleMinimize=()=>{this.app.setProperties({minimized:!this.app.state.minimized}),this.resizeHandle.css({visibility:this.app.state.minimized?"hidden":"visible"}),this.positionFrame(this.app.state)},this.positionFrame(this.app.state),function(t,e){const n=t.handle[0],r=t.container[0];Se(n,t.blockout,(function(){n.style.cursor="grabbing"}),(function(t,e){r.style.left=`${xe(r,t)}px`,r.style.top=`${Re(r,e)}px`}),(function(){n.style.cursor="grab",e()}))}(this,this.savePosition),function(t,e){const n=t.resizeHandle[0],r=t.container[0];Se(n,t.blockout,(()=>{}),(function(t,e){r.style.width=`${ze(r,t)}px`,r.style.height=`${Ne(r,e)}px`}),e)}(this,this.saveSize),window.addEventListener("resize",s),this.listeners=[["resize",s]];const i=n._.throttle((()=>function(t){const e=t.offsetLeft+t.offsetWidth+Ee-window.innerWidth;e>0&&(t.style.left=`${xe(t,e)}px`,t.offsetWidth>Ce&&(t.style.width=`${ze(t,e)}px`));const n=t.offsetTop+t.offsetHeight+Ee-window.innerHeight;n>0&&(t.style.top=`${Re(t,n)}px`,t.offsetHeight>Ae&&(t.style.height=`${Ne(t,n)}px`))}(this.container[0])),10),a=n._.debounce((()=>{this.savePosition(),this.saveSize()}),1e3);function s(){i(),a()}}open(){return this.router.addRoute("app::toggleMinimize",this.toggleMinimize),this.container.appendTo(this.app.pendo.dom.getBody()),Promise.resolve()}close(){this.router.removeRoute("app::toggleMinimize"),this.listeners.forEach((([t,e])=>window.removeEventListener(t,e))),this.elements.forEach((t=>t.remove())),this.triggerClosed()}}var Me=c,$e=/\s/;var He=function(t){for(var e=t.length;e--&&$e.test(t.charAt(e)););return e},ke=/^\s+/;var We=function(t){return t?t.slice(0,He(t)+1).replace(ke,""):t},Le=S,Ue=P,Fe=/^[-+]0x[0-9a-f]+$/i,Ge=/^0b[01]+$/i,Be=/^0o[0-7]+$/i,qe=parseInt;var Qe=S,Ve=function(){return Me.Date.now()},Ke=function(t){if("number"==typeof t)return t;if(Ue(t))return NaN;if(Le(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Le(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=We(t);var n=Ge.test(t);return n||Be.test(t)?qe(t.slice(2),n?2:8):Fe.test(t)?NaN:+t},Je=Math.max,Xe=Math.min;var Ye=function(t,e,n){var r,o,i,a,s,c,u=0,d=!1,l=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var n=r,i=o;return r=o=void 0,u=e,a=t.apply(i,n)}function h(t){var n=t-c;return void 0===c||n>=e||n<0||l&&t-u>=i}function g(){var t=Ve();if(h(t))return v(t);s=setTimeout(g,function(t){var n=e-(t-c);return l?Xe(n,i-(t-u)):n}(t))}function v(t){return s=void 0,p&&r?f(t):(r=o=void 0,a)}function b(){var t=Ve(),n=h(t);if(r=arguments,o=this,c=t,n){if(void 0===s)return function(t){return u=t,s=setTimeout(g,e),d?f(t):a}(c);if(l)return clearTimeout(s),s=setTimeout(g,e),f(c)}return void 0===s&&(s=setTimeout(g,e)),a}return e=Ke(e)||0,Qe(n)&&(d=!!n.leading,i=(l="maxWait"in n)?Je(Ke(n.maxWait)||0,e):i,p="trailing"in n?!!n.trailing:p),b.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=c=o=s=void 0},b.flush=function(){return void 0===s?a:v(Ve())},b},Ze=Ye,tn=S;var en=r((function(t,e,n){var r=!0,o=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return tn(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),Ze(t,e,{leading:r,maxWait:e,trailing:o})})),nn=de,rn=0;var on=r((function(t){var e=++rn;return nn(t)+e})),an=Rt;var sn=Rt,cn=zt,un=Kt;var dn=Rt,ln=function(){this.__data__=new an,this.size=0},pn=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},fn=function(t){return this.__data__.get(t)},hn=function(t){return this.__data__.has(t)},gn=function(t,e){var n=this.__data__;if(n instanceof sn){var r=n.__data__;if(!cn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new un(r)}return n.set(t,e),this.size=n.size,this};function vn(t){var e=this.__data__=new dn(t);this.size=e.size}vn.prototype.clear=ln,vn.prototype.delete=pn,vn.prototype.get=fn,vn.prototype.has=hn,vn.prototype.set=gn;var bn=vn;var yn=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t},mn=Z,wn=function(){try{var t=mn(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),jn=wn;var _n=function(t,e,n){"__proto__"==e&&jn?jn(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},Tn=_n,Pn=yt,On=Object.prototype.hasOwnProperty;var In=function(t,e,n){var r=t[e];On.call(t,e)&&Pn(r,n)&&(void 0!==n||e in t)||Tn(t,e,n)},An=In,Cn=_n;var En=function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,a=e.length;++i<a;){var s=e[i],c=r?r(n[s],t[s],s,n,t):void 0;void 0===c&&(c=t[s]),o?Cn(n,s,c):An(n,s,c)}return n};var Sn=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r},xn=w,Rn=j;var zn=function(t){return Rn(t)&&"[object Arguments]"==xn(t)},Nn=j,Dn=Object.prototype,Mn=Dn.hasOwnProperty,$n=Dn.propertyIsEnumerable,Hn=zn(function(){return arguments}())?zn:function(t){return Nn(t)&&Mn.call(t,"callee")&&!$n.call(t,"callee")},kn=Hn,Wn={exports:{}};var Ln=function(){return!1};!function(t,e){var n=c,r=Ln,o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;t.exports=s}(Wn,Wn.exports);var Un=Wn.exports,Fn=/^(?:0|[1-9]\d*)$/;var Gn=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Fn.test(t))&&t>-1&&t%1==0&&t<e};var Bn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},qn=w,Qn=Bn,Vn=j,Kn={};Kn["[object Float32Array]"]=Kn["[object Float64Array]"]=Kn["[object Int8Array]"]=Kn["[object Int16Array]"]=Kn["[object Int32Array]"]=Kn["[object Uint8Array]"]=Kn["[object Uint8ClampedArray]"]=Kn["[object Uint16Array]"]=Kn["[object Uint32Array]"]=!0,Kn["[object Arguments]"]=Kn["[object Array]"]=Kn["[object ArrayBuffer]"]=Kn["[object Boolean]"]=Kn["[object DataView]"]=Kn["[object Date]"]=Kn["[object Error]"]=Kn["[object Function]"]=Kn["[object Map]"]=Kn["[object Number]"]=Kn["[object Object]"]=Kn["[object RegExp]"]=Kn["[object Set]"]=Kn["[object String]"]=Kn["[object WeakMap]"]=!1;var Jn=function(t){return Vn(t)&&Qn(t.length)&&!!Kn[qn(t)]};var Xn=function(t){return function(e){return t(e)}},Yn={exports:{}};!function(t,e){var n=i,r=e&&!e.nodeType&&e,o=r&&t&&!t.nodeType&&t,a=o&&o.exports===r&&n.process,s=function(){try{var t=o&&o.require&&o.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=s}(Yn,Yn.exports);var Zn=Yn.exports,tr=Jn,er=Xn,nr=Zn&&Zn.isTypedArray,rr=nr?er(nr):tr,or=Sn,ir=kn,ar=o,sr=Un,cr=Gn,ur=rr,dr=Object.prototype.hasOwnProperty;var lr=function(t,e){var n=ar(t),r=!n&&ir(t),o=!n&&!r&&sr(t),i=!n&&!r&&!o&&ur(t),a=n||r||o||i,s=a?or(t.length,String):[],c=s.length;for(var u in t)!e&&!dr.call(t,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||cr(u,c))||s.push(u);return s},pr=Object.prototype;var fr=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||pr)};var hr=function(t,e){return function(n){return t(e(n))}},gr=hr(Object.keys,Object),vr=fr,br=gr,yr=Object.prototype.hasOwnProperty;var mr=N,wr=Bn;var jr=function(t){return null!=t&&wr(t.length)&&!mr(t)},_r=lr,Tr=function(t){if(!vr(t))return br(t);var e=[];for(var n in Object(t))yr.call(t,n)&&"constructor"!=n&&e.push(n);return e},Pr=jr;var Or=function(t){return Pr(t)?_r(t):Tr(t)},Ir=En,Ar=Or;var Cr=function(t,e){return t&&Ir(e,Ar(e),t)};var Er=S,Sr=fr,xr=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Rr=Object.prototype.hasOwnProperty;var zr=lr,Nr=function(t){if(!Er(t))return xr(t);var e=Sr(t),n=[];for(var r in t)("constructor"!=r||!e&&Rr.call(t,r))&&n.push(r);return n},Dr=jr;var Mr=function(t){return Dr(t)?zr(t,!0):Nr(t)},$r=En,Hr=Mr;var kr=function(t,e){return t&&$r(e,Hr(e),t)},Wr={exports:{}};!function(t,e){var n=c,r=e&&!e.nodeType&&e,o=r&&t&&!t.nodeType&&t,i=o&&o.exports===r?n.Buffer:void 0,a=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}}(Wr,Wr.exports);var Lr=Wr.exports;var Ur=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e};var Fr=function(){return[]},Gr=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i},Br=Fr,qr=Object.prototype.propertyIsEnumerable,Qr=Object.getOwnPropertySymbols,Vr=Qr?function(t){return null==t?[]:(t=Object(t),Gr(Qr(t),(function(e){return qr.call(t,e)})))}:Br,Kr=En,Jr=Vr;var Xr=function(t,e){return Kr(t,Jr(t),e)};var Yr=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t},Zr=hr(Object.getPrototypeOf,Object),to=Yr,eo=Zr,no=Vr,ro=Fr,oo=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)to(e,no(t)),t=eo(t);return e}:ro,io=En,ao=oo;var so=function(t,e){return io(t,ao(t),e)},co=Yr,uo=o;var lo=function(t,e,n){var r=e(t);return uo(t)?r:co(r,n(t))},po=lo,fo=Vr,ho=Or;var go=function(t){return po(t,ho,fo)},vo=lo,bo=oo,yo=Mr;var mo=function(t){return vo(t,yo,bo)},wo=Z(c,"DataView"),jo=zt,_o=Z(c,"Promise"),To=Z(c,"Set"),Po=Z(c,"WeakMap"),Oo=w,Io=W,Ao="[object Map]",Co="[object Promise]",Eo="[object Set]",So="[object WeakMap]",xo="[object DataView]",Ro=Io(wo),zo=Io(jo),No=Io(_o),Do=Io(To),Mo=Io(Po),$o=Oo;(wo&&$o(new wo(new ArrayBuffer(1)))!=xo||jo&&$o(new jo)!=Ao||_o&&$o(_o.resolve())!=Co||To&&$o(new To)!=Eo||Po&&$o(new Po)!=So)&&($o=function(t){var e=Oo(t),n="[object Object]"==e?t.constructor:void 0,r=n?Io(n):"";if(r)switch(r){case Ro:return xo;case zo:return Ao;case No:return Co;case Do:return Eo;case Mo:return So}return e});var Ho=$o,ko=Object.prototype.hasOwnProperty;var Wo=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&ko.call(t,"index")&&(n.index=t.index,n.input=t.input),n},Lo=c.Uint8Array;var Uo=function(t){var e=new t.constructor(t.byteLength);return new Lo(e).set(new Lo(t)),e},Fo=Uo;var Go=function(t,e){var n=e?Fo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)},Bo=/\w*$/;var qo=function(t){var e=new t.constructor(t.source,Bo.exec(t));return e.lastIndex=t.lastIndex,e},Qo=u?u.prototype:void 0,Vo=Qo?Qo.valueOf:void 0;var Ko=Uo;var Jo=Uo,Xo=Go,Yo=qo,Zo=function(t){return Vo?Object(Vo.call(t)):{}},ti=function(t,e){var n=e?Ko(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var ei=function(t,e,n){var r=t.constructor;switch(e){case"[object ArrayBuffer]":return Jo(t);case"[object Boolean]":case"[object Date]":return new r(+t);case"[object DataView]":return Xo(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ti(t,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(t);case"[object RegExp]":return Yo(t);case"[object Symbol]":return Zo(t)}},ni=S,ri=Object.create,oi=function(){function t(){}return function(e){if(!ni(e))return{};if(ri)return ri(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),ii=Zr,ai=fr;var si=function(t){return"function"!=typeof t.constructor||ai(t)?{}:oi(ii(t))},ci=Ho,ui=j;var di=function(t){return ui(t)&&"[object Map]"==ci(t)},li=Xn,pi=Zn&&Zn.isMap,fi=pi?li(pi):di,hi=Ho,gi=j;var vi=function(t){return gi(t)&&"[object Set]"==hi(t)},bi=Xn,yi=Zn&&Zn.isSet,mi=yi?bi(yi):vi,wi=bn,ji=yn,_i=In,Ti=Cr,Pi=kr,Oi=Lr,Ii=Ur,Ai=Xr,Ci=so,Ei=go,Si=mo,xi=Ho,Ri=Wo,zi=ei,Ni=si,Di=o,Mi=Un,$i=fi,Hi=S,ki=mi,Wi=Or,Li=Mr,Ui="[object Arguments]",Fi="[object Function]",Gi="[object Object]",Bi={};Bi[Ui]=Bi["[object Array]"]=Bi["[object ArrayBuffer]"]=Bi["[object DataView]"]=Bi["[object Boolean]"]=Bi["[object Date]"]=Bi["[object Float32Array]"]=Bi["[object Float64Array]"]=Bi["[object Int8Array]"]=Bi["[object Int16Array]"]=Bi["[object Int32Array]"]=Bi["[object Map]"]=Bi["[object Number]"]=Bi[Gi]=Bi["[object RegExp]"]=Bi["[object Set]"]=Bi["[object String]"]=Bi["[object Symbol]"]=Bi["[object Uint8Array]"]=Bi["[object Uint8ClampedArray]"]=Bi["[object Uint16Array]"]=Bi["[object Uint32Array]"]=!0,Bi["[object Error]"]=Bi[Fi]=Bi["[object WeakMap]"]=!1;var qi=function t(e,n,r,o,i,a){var s,c=1&n,u=2&n,d=4&n;if(r&&(s=i?r(e,o,i,a):r(e)),void 0!==s)return s;if(!Hi(e))return e;var l=Di(e);if(l){if(s=Ri(e),!c)return Ii(e,s)}else{var p=xi(e),f=p==Fi||"[object GeneratorFunction]"==p;if(Mi(e))return Oi(e,c);if(p==Gi||p==Ui||f&&!i){if(s=u||f?{}:Ni(e),!c)return u?Ci(e,Pi(s,e)):Ai(e,Ti(s,e))}else{if(!Bi[p])return i?e:{};s=zi(e,p,c)}}a||(a=new wi);var h=a.get(e);if(h)return h;a.set(e,s),ki(e)?e.forEach((function(o){s.add(t(o,n,r,o,e,a))})):$i(e)&&e.forEach((function(o,i){s.set(i,t(o,n,r,i,e,a))}));var g=l?void 0:(d?u?Si:Ei:u?Li:Wi)(e);return ji(g||e,(function(o,i){g&&(o=e[i=o]),_i(s,i,t(o,n,r,i,e,a))})),s};var Qi=function(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(o);++r<o;)i[r]=t[r+e];return i},Vi=we,Ki=Qi;var Ji=ge,Xi=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},Yi=function(t,e){return e.length<2?t:Vi(t,Ki(e,0,-1))},Zi=be;var ta=function(t,e){return e=Ji(e,t),null==(t=Yi(t,e))||delete t[Zi(Xi(e))]},ea=w,na=Zr,ra=j,oa=Function.prototype,ia=Object.prototype,aa=oa.toString,sa=ia.hasOwnProperty,ca=aa.call(Object);var ua=function(t){if(!ra(t)||"[object Object]"!=ea(t))return!1;var e=na(t);if(null===e)return!0;var n=sa.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&aa.call(n)==ca};var da=function(t){return ua(t)?void 0:t},la=kn,pa=o,fa=u?u.isConcatSpreadable:void 0;var ha=Yr,ga=function(t){return pa(t)||la(t)||!!(fa&&t&&t[fa])};var va=function t(e,n,r,o,i){var a=-1,s=e.length;for(r||(r=ga),i||(i=[]);++a<s;){var c=e[a];n>0&&r(c)?n>1?t(c,n-1,r,o,i):ha(i,c):o||(i[i.length]=c)}return i},ba=va;var ya=function(t){return(null==t?0:t.length)?ba(t,1):[]};var ma=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},wa=Math.max;var ja=function(t,e,n){return e=wa(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=wa(r.length-e,0),a=Array(i);++o<i;)a[o]=r[e+o];o=-1;for(var s=Array(e+1);++o<e;)s[o]=r[o];return s[e]=n(a),ma(t,this,s)}};var _a=function(t){return t},Ta=function(t){return function(){return t}},Pa=wn,Oa=Pa?function(t,e){return Pa(t,"toString",{configurable:!0,enumerable:!1,value:Ta(e),writable:!0})}:_a,Ia=Date.now;var Aa=function(t){var e=0,n=0;return function(){var r=Ia(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}},Ca=Aa(Oa),Ea=ya,Sa=ja,xa=Ca;var Ra=ne,za=qi,Na=ta,Da=ge,Ma=En,$a=da,Ha=mo,ka=r(function(t){return xa(Sa(t,void 0,Ea),t+"")}((function(t,e){var n={};if(null==t)return n;var r=!1;e=Ra(e,(function(e){return e=Da(e,t),r||(r=e.length>1),e})),Ma(t,Ha(t),n),r&&(n=za(n,7,$a));for(var o=e.length;o--;)Na(n,e[o]);return n})));const Wa="promise";function La(t,e,n){this.name=t,this.type=e,this.data=n}La.prototype.toString=function(){return`Message.${this.type} - ${this.name}`};const Ua=t=>{try{const{name:e,type:n,isResponse:r,data:o,requestId:i,sender:a}=t.data||{},s=new La(e,n,null!=o?JSON.parse(o):void 0);return s.requestId=i,s.sender=a,s.destination=t.source,s.isResponse=r,s}catch(t){return!1}},Fa=t=>(t.isResponse=!0,t),Ga=(...t)=>e=>[].concat(t).reduce(((t,n,r,o)=>{const i=n(t,e);return i||o.splice(r,o.length-r),i}),e);var Ba=function(t){return function(e,n,r){for(var o=-1,i=Object(e),a=r(e),s=a.length;s--;){var c=a[t?s:++o];if(!1===n(i[c],c,i))break}return e}}(),qa=Or;var Qa=jr;var Va=function(t,e){return function(n,r){if(null==n)return n;if(!Qa(n))return t(n,r);for(var o=n.length,i=e?o:-1,a=Object(n);(e?i--:++i<o)&&!1!==r(a[i],i,a););return n}}((function(t,e){return t&&Ba(t,e,qa)})),Ka=_a;var Ja=yn,Xa=Va,Ya=function(t){return"function"==typeof t?t:Ka},Za=o;var ts=r((function(t,e){return(Za(t)?Ja:Xa)(t,Ya(e))}));const es="disconnected",ns={lastMessageReceivedAt:0,currentConnectionQuality:es,changeCallbacks:{},evalCallbacks:{}},rs=t=>{t!==ns.currentConnectionQuality&&(ns.currentConnectionQuality=t,ts(ns.changeCallbacks,(t=>{t(ns.currentConnectionQuality)})))},os=()=>{if(0===ns.lastMessageReceivedAt)return void rs(es);const t=Date.now()-ns.lastMessageReceivedAt;t<1e4?rs("connected"):(t=>t>1e4)(t)&&((t=>t>3e4)(t)?rs("dead_connection"):rs(es)),ts(ns.evalCallbacks,(t=>{t(ns.currentConnectionQuality)}))};let is;let as=0;const ss=()=>{ns.currentConnectionQuality=es,ns.lastMessageReceivedAt=0},cs={appName:void 0,connectionName:void 0,frameId:void 0,pendingRequests:{},topics:{},senderIds:{},originProvider:void 0,destinationProvider:void 0},us=()=>`${cs.appName}${cs.connectionName}(${cs.frameId})`,ds=t=>{t.sender||(t.sender=us());const e=t.destination||cs.destinationProvider(),n=(t=>{const e=ka(t,["destination","toString","data"]);return e.data=JSON.stringify(t.data,((t,e)=>"function"==typeof e||e instanceof RegExp?e.toString?e.toString():void 0:e)),e})(t),r=fs(t.sender),o=hs(t.sender);if(r||o)r?r.postMessage(n):e.postMessage(n,cs.originProvider());else{const r=new MessageChannel;_s(r.port1,t.sender),e.postMessage(n,cs.originProvider(),[r.port2])}},ls=(t,e,n=1e3)=>new Promise(((r,o)=>{const i=((t,e,n)=>{const r=new La(t,e,n);return e===Wa&&(r.requestId=on()),r})(t,Wa,e),a=setTimeout((()=>{o(`${t} timeout`),vs(i),Ps(i)}),n);gs(i,(()=>clearTimeout(a)),r,o),ds(i)})),ps=t=>(cs.senderIds[t]||(t=>{cs.senderIds[t]||(cs.senderIds[t]={port:void 0,hasTriedToUpgradeToMessageChannel:!1})})(t),cs.senderIds[t]),fs=t=>ps(t).port,hs=t=>ps(t).hasTriedToUpgradeToMessageChannel,gs=(t,e,n,r)=>{cs.pendingRequests[t.requestId]={message:t,clearTimeoutfn:e,resolve:n,reject:r}},vs=t=>{const{requestId:e}=t;return cs.pendingRequests[e].clearTimeoutfn(),delete cs.pendingRequests[e],t},bs="message::ping",ys=Ga((t=>{const e=cs.pendingRequests[t.requestId];return e&&(e.resolve(t.data),vs(t)),t}),(t=>{const e=cs.topics[t.name];return e&&e.forEach((e=>e(t.data))),t}),(t=>{if(!t)return t;if(t.isResponse)return t;if(t.name===bs)return ds(Fa(t)),t;const e=cs.routeHandlerLookup(t.name);if(e){const n=e=>{t.data=e,ds(Fa(t))};e(t,n)}else console.log(us(),`No route handler for ${t.name}`,t);return t}),(ms=()=>{((t=Date.now())=>{ns.lastMessageReceivedAt=t})()},(t,...e)=>(ms(t,...e),t)));var ms;const ws=t=>("*"===cs.originProvider()||t.origin===cs.originProvider())&&t,js=t=>{const e=_e(t,"data.sender");return!(!e||"string"!=typeof e)&&(!!e.includes(cs.appName)&&t)},_s=(t,e)=>{const n=ps(e);n.port=t,n.hasTriedToUpgradeToMessageChannel=!0,n.port.onmessage=Ga(Ua,ys)},Ts=(t,e)=>(!ps(t.sender).hasTriedToUpgradeToMessageChannel&&e.ports&&e.ports[0]&&_s(e.ports[0],t.sender),t),Ps=t=>{(t=>{const e=ps(t);e.port=void 0,e.hasTriedToUpgradeToMessageChannel=!1})(t.sender)};let Os=()=>{};const Is=()=>{Os(),Os=()=>{},is&&is(),ss()},As=en((t=>{"connected"!==t&&cs.usePingAutoReconnect&&ls(bs).catch((()=>{console.log("message::ping timedout")}))}),1e3),Cs=(t,e,n,r,o,i=!1,a)=>{if(!window.addEventListener)return;cs.appName=t,cs.frameId=e,cs.routeHandlerLookup=n,cs.usePingAutoReconnect=i,cs.connectionName=a||"",cs.originProvider=r||(()=>window.location.origin||"*"),cs.destinationProvider=o||(()=>window.parent||window.top),((t={})=>{const e=setInterval(os,100);is=()=>clearInterval(e)})(),(t=>{if(!D(t))return;const e=as++;ns.evalCallbacks[e]=t})(As);const s=Ga(ws,js,Ua,Ts,ys);window.addEventListener("message",s),Os=()=>window.removeEventListener("message",s)},Es=t=>{(t=>{if(!D(t))return;const e=as++;ns.changeCallbacks[e]=t})(t)};function Ss(){return(new Date).getTime()}class xs extends Te{type="window";testUrl="";realUrl=void 0;getTitle(){return this.getConfig("title",this.getName())}getName(){return this.getConfig("name","Agent_Application")}open(){return this.router.addRoute("app::windowClosed",(()=>{this.app.setProperties({containerType:"frame"}),this.app.stop()})),this.testConnection().then((()=>{this.triggerOpened()})).catch((()=>{return this.createWindow(),t=this.app,e=1e3,new Promise(((n,r)=>{const o=Ss(),i=()=>{t.getConnectionStatus()?n():Ss()-o>e?r():setTimeout(i,50)};i()}));var t,e}))}testConnection(){return this.destination=window.open(this.testUrl,this.getName(),`width=${this.app.state.width},height=${this.app.state.height},resizable=yes,scrollbars=yes,status=yes,location=no`),ls("app::reconnect")}createWindow(){this.realUrl&&(this.destination=window.open(this.realUrl,this.getName(),`width=${this.app.state.width},height=${this.app.state.height},resizable=yes,scrollbars=yes,status=yes,location=no`));const t=document.createElement("script");t.src=this.app.PluginAPI.getAssetUrl(this.app.assetName),this.destination.document.body.appendChild(t),this.destination.document.title=this.getTitle()}close(){this.router.removeRoute("app::windowClosed"),this.destination.close(),this.triggerClosed()}}const Rs=()=>({});class zs{defaultState={containerType:"frame",minimized:!1,height:500,width:500,left:100,top:100};state={};containerClosedCallbacks=[];container=null;isConnected=!1;constructor(t,n,r,o,i,a=Rs,s=Rs){this.appName=t,this.assetName=n,this.assetStorageKey=r,this.connectionName=o,this.frameConfigProvider=a,this.windowConfigProvider=s,i&&Object.assign(this.defaultState,i),this.router=new e}init(t,e){this.pendo=t,this.PluginAPI=e,this.events=e.getEventable(),this.router.addRoute("app::ping",((t,e)=>{e()})),this.router.addRoute("app::setProperties",(({data:t})=>{this.setProperties(t)})),this.router.addRoute("app::toggleContainer",(()=>{this.setProperties({minimized:!1}),this.toggleContainerType()})),this.router.addRoute("app::windowClosed",(()=>{})),this.loadState(),this.prepContainer()}prepContainer(){this.container="window"===this.state.containerType?new xs(this,this.windowConfigProvider()):new De(this,this.frameConfigProvider())}setConnectionStatus(t){this.isConnected="connected"===t}getConnectionStatus(){return this.isConnected}setProperties(t){Object.assign(this.state,t),this.writeState()}getDefaultState(){return this.defaultState||{}}loadState(){try{const t=JSON.parse(this.PluginAPI.agentStorage.read(this.assetStorageKey,!0));this.state=Object.assign({},this.getDefaultState(),this.state,t)}catch(t){this.PluginAPI.log.error(t),this.state=Object.assign({},this.getDefaultState(),this.state)}}writeState(){this.PluginAPI.agentStorage.write(this.assetStorageKey,JSON.stringify(this.state),null,!0)}toggleContainerType(){const t="frame"===this.state.containerType?"window":"frame";this.setProperties({containerType:t}),this.stop(),this.start()}start(){this.container||this.prepContainer();const{frameId:t}=this.PluginAPI.EventTracer.addTracerIds({});Cs(this.appName,t,this.router.lookupRouteProvider(),this.container.getOriginProvider(),this.container.getDestinationProvider(),!0,this.connectionName),Es((t=>{this.setConnectionStatus(t)})),this.container.open().then((()=>{this.events.trigger("mounted")})).catch((()=>{"window"===this.state.containerType?(this.setProperties({containerType:"frame"}),this.prepContainer(),this.start()):(this.PluginAPI.log(`Failed to start ${this.appName} in either window or frame.`),this.stop())}))}stop(){this.container.close(),this.container=null,this.events.trigger("unmounted"),Is()}}const Ns=t=>({apiKey:t.apiKey,environment:t.debugging.isStagingServer()?"staging":"production",device:t.debugging.isMobileUserAgent()?"mobile":"desktop",browserCookies:window.navigator.cookieEnabled,guideStatus:t.areGuidesDisabled()?"disabled":t.debugging.areGuidesDelayed()?"delayed":"enabled"}),Ds=function(){const t={height:Ie.HEIGHT,width:Ie.WIDTH};let e,n;const r=new zs("Debugger","pendo.debugger.min.js","debug-enabled","AgentPlugin",t,(()=>({containerId:"pendo-client-debugger"})),(()=>({title:"Pendo Debugger"}))),o={app:r,init(t,o){e=t,n=o,n.restartDebugger=this.start,r.init(e,n),r.router.addRoute("debugger::connect",((t,o)=>{o({config:n.ConfigReader.audit(),env:Ns(e),container:r.state,events:n.store.state.debugger.eventsCaptured})})),r.router.addRoute("debugger::stop",(()=>{e.disableDebugging()})),r.router.addRoute("debugger::showGuideById",((t,n)=>{n(e.showGuideById(t.data))})),r.router.addRoute("debugger::toggleGuideLoop",(t=>{t.data?e.startGuides():e.stopGuides()})),r.router.addRoute("debugger::tombstoneGuide",(t=>{const r=e.findGuideById(t.data);n.Tombstone.addGuide(r)})),r.router.addRoute("debugger::openGuidePage",(t=>{const r=((t,e,n)=>{const r=e.findGuideById(t);if(!r||!e._.get(r,"attributes.resourceCenter"))return`${n}/guides/${t}`;if(r.attributes.resourceCenter.isTopLevel)return`${n}/resource-center/${r.id}/draft`;const o=e.BuildingBlocks.BuildingBlockResourceCenter.getResourceCenter();return o&&o.id?`${n}/resource-center/${o.id}/module/${r.id}`:""})(t.data,e,n.hosts.SERVER);r&&window.open(r,"_blank")})),r.router.addRoute("debugger::restore",(({data:t})=>{(t=>{if(!t||!t.length)return;const e=document.createElement("iframe");e.sandbox="allow-same-origin",e.src="about:blank",e.hidden=!0,document.body.appendChild(e),e.contentWindow.ignoreIframeMonitor=!0,t.forEach((t=>{t.id.split(".").reduce(((t,e,n,r)=>n===r.length-1?(t.destination[e]=t.source[e],t.destination[e]):(t.destination=t.destination[e],t.source=t.source[e],t)),{destination:window,source:e.contentWindow})})),document.body.removeChild(e)})(t)})),r.router.addRoute("debugger::findShadowRoot",((t,e)=>{e((()=>{let t,e=!1,n=0;const r=document.createNodeIterator(document.body,NodeFilter.SHOW_ELEMENT);if(!r||!r.nextNode)return!0;for(;n<1e4&&!e;)n++,t=r.nextNode(),t&&t.shadowRoot&&(e=!0);return e})())})),r.router.addRoute("debugger::sync",((t,o)=>{const i=n.store.subscribe(((t,e)=>{"debugger/eventsCaptured"===t.type&&o({action:"events/eventsCaptured",data:e.debugger.eventsCaptured})})),a=setInterval((()=>{o({action:"agent/sync",data:n.store.state}),o({action:"environment/validateEnvironment",data:e.validateEnvironment(!0)})}),500);r.events.on("unmounted",(()=>{clearInterval(a),i()}))})),r.router.addRoute("debugger::enableEventLogging",(({data:t})=>{r.setProperties({enableEventLogging:t}),n.store.dispatch("debugger/enableEventLogging",t)})),r.router.addRoute("debugger::clearEventsCaptured",(()=>{n.store.dispatch("debugger/clearEventsCaptured")})),r.router.addRoute("debugger::checkGuideEligibility",(({data:t},e)=>{n.store.dispatch("debugger/checkGuideEligibility",{guideId:t,response:e})}))},start(){r.start()},stop(){r.stop(),r.setProperties({enabled:!1,containerType:"frame"})}};return o}();const Ms={initialize:function(t,e){Ds.init(t,e),Ds.start();const n=t.disableDebugging;t.disableDebugging=()=>{Ds.stop(),n()}},teardown:function(){Ds.stop()}};pendo.addExtension&&pendo.addExtension({name:"Debugger",version:"1.0.0",type:"agent",use:"plugin",uri:Ms})}();
|