@commversion/libs 0.18.2 → 0.18.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/.cspell.json +149 -0
- package/.editorconfig +10 -0
- package/.husky/pre-commit +27 -0
- package/.husky/prepare-commit-msg +13 -0
- package/.markdownlint.json +4 -0
- package/.oxfmtrc.json +6 -0
- package/.oxlintrc.json +34 -0
- package/.release-it.json +9 -3
- package/.vscode/extensions.json +18 -0
- package/.vscode/settings.json +12 -0
- package/README.md +20 -10
- package/dist/lc-attribution.js +1 -0
- package/dist/lc-channel-widgets.js +7 -7
- package/dist/lc-cookie-banner-update-position.js +3 -3
- package/dist/lc-device.js +1 -1
- package/dist/lc-exit-intent-debounced.js +1 -1
- package/dist/lc-exit-intent.js +1 -1
- package/dist/lc-experiment.js +1 -1
- package/dist/lc-form-abandonment.js +1 -1
- package/dist/lc-form-submission.js +1 -1
- package/dist/lc-ga-initialize-event.js +1 -1
- package/dist/lc-ga-tags.js +1 -1
- package/dist/lc-gclid.js +1 -1
- package/dist/lc-geoblocking.js +1 -1
- package/dist/lc-gtm.js +1 -1
- package/dist/lc-input-error.js +1 -1
- package/dist/lc-kill-chat-persist.js +1 -1
- package/dist/lc-kill-chat.js +1 -1
- package/dist/lc-open-on-button-click.js +1 -1
- package/dist/lc-pause-on-url.js +1 -1
- package/dist/lc-powered-by.js +1 -1
- package/dist/lc-show-by-selector.js +1 -1
- package/dist/lc-show-hide.js +1 -1
- package/dist/lc-utm-params.js +1 -1
- package/dist/lc-whatsapp-widget-combo.js +4 -4
- package/dist/lc-whatsapp-widget-only.js +8 -8
- package/dist/schedule-event.js +1 -1
- package/global.d.ts +320 -0
- package/package.json +112 -87
- package/pnpm-workspace.yaml +33 -0
- package/templates/scaffold.ts +86 -0
- package/templates/script/README.md +11 -0
- package/templates/script/package.json +4 -0
- package/templates/script/src/NAME.ts +6 -0
- package/templates/script/src/index.html +57 -0
- package/templates/script/src/main.ts +5 -0
- package/templates/script/tests/NAME.test.ts +9 -0
- package/templates/script/vite.config.ts +19 -0
- package/tsconfig.json +32 -0
- package/vitest.config.ts +18 -0
- package/.prettierignore +0 -4
- package/.prettierrc +0 -3
package/.cspell.json
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2",
|
|
3
|
+
"language": "en-GB",
|
|
4
|
+
"words": [
|
|
5
|
+
"applescript",
|
|
6
|
+
"attrib",
|
|
7
|
+
"bitfield",
|
|
8
|
+
"blazediff",
|
|
9
|
+
"boxen",
|
|
10
|
+
"bufferutil",
|
|
11
|
+
"centered",
|
|
12
|
+
"chardet",
|
|
13
|
+
"chokidar",
|
|
14
|
+
"citty",
|
|
15
|
+
"cliui",
|
|
16
|
+
"color",
|
|
17
|
+
"commversion",
|
|
18
|
+
"confbox",
|
|
19
|
+
"consola",
|
|
20
|
+
"cookieinfo",
|
|
21
|
+
"cutoff",
|
|
22
|
+
"cyclonedx",
|
|
23
|
+
"dclid",
|
|
24
|
+
"defu",
|
|
25
|
+
"degenerator",
|
|
26
|
+
"destr",
|
|
27
|
+
"direnv",
|
|
28
|
+
"domexception",
|
|
29
|
+
"dotenv",
|
|
30
|
+
"eabi",
|
|
31
|
+
"emnapi",
|
|
32
|
+
"emscripten",
|
|
33
|
+
"esbuild",
|
|
34
|
+
"escaperegexp",
|
|
35
|
+
"escodegen",
|
|
36
|
+
"esprima",
|
|
37
|
+
"estraverse",
|
|
38
|
+
"estree",
|
|
39
|
+
"esutils",
|
|
40
|
+
"eventemitter",
|
|
41
|
+
"execa",
|
|
42
|
+
"fdir",
|
|
43
|
+
"formdata",
|
|
44
|
+
"fsevents",
|
|
45
|
+
"fullwidth",
|
|
46
|
+
"gclid",
|
|
47
|
+
"geoblock",
|
|
48
|
+
"geoblocking",
|
|
49
|
+
"giget",
|
|
50
|
+
"gitmoji",
|
|
51
|
+
"gnueabihf",
|
|
52
|
+
"handoff",
|
|
53
|
+
"hashchange",
|
|
54
|
+
"hideable",
|
|
55
|
+
"hotwire",
|
|
56
|
+
"hrefs",
|
|
57
|
+
"hubspot",
|
|
58
|
+
"idempotently",
|
|
59
|
+
"isexe",
|
|
60
|
+
"isplainobject",
|
|
61
|
+
"jiti",
|
|
62
|
+
"jridgewell",
|
|
63
|
+
"jsdom",
|
|
64
|
+
"keepalive",
|
|
65
|
+
"kickoff",
|
|
66
|
+
"libc",
|
|
67
|
+
"lightningcss",
|
|
68
|
+
"listr",
|
|
69
|
+
"livechat",
|
|
70
|
+
"livechatinc",
|
|
71
|
+
"locationchange",
|
|
72
|
+
"magicast",
|
|
73
|
+
"maxage",
|
|
74
|
+
"minimatch",
|
|
75
|
+
"minimist",
|
|
76
|
+
"minipass",
|
|
77
|
+
"mrmime",
|
|
78
|
+
"msvc",
|
|
79
|
+
"musleabihf",
|
|
80
|
+
"muts",
|
|
81
|
+
"nanoid",
|
|
82
|
+
"napi",
|
|
83
|
+
"noopener",
|
|
84
|
+
"noreferrer",
|
|
85
|
+
"npmjs",
|
|
86
|
+
"nypm",
|
|
87
|
+
"obug",
|
|
88
|
+
"ohash",
|
|
89
|
+
"onetime",
|
|
90
|
+
"openharmony",
|
|
91
|
+
"oxfmt",
|
|
92
|
+
"oxlint",
|
|
93
|
+
"phun",
|
|
94
|
+
"picocolors",
|
|
95
|
+
"picomatch",
|
|
96
|
+
"pluginutils",
|
|
97
|
+
"pngjs",
|
|
98
|
+
"popstate",
|
|
99
|
+
"postback",
|
|
100
|
+
"postchat",
|
|
101
|
+
"prechat",
|
|
102
|
+
"prefilledmessage",
|
|
103
|
+
"quickjs",
|
|
104
|
+
"rawlist",
|
|
105
|
+
"readdirp",
|
|
106
|
+
"rfdc",
|
|
107
|
+
"rimraf",
|
|
108
|
+
"riscv",
|
|
109
|
+
"saslprep",
|
|
110
|
+
"sass",
|
|
111
|
+
"Segoe",
|
|
112
|
+
"siginfo",
|
|
113
|
+
"sirv",
|
|
114
|
+
"sitecore",
|
|
115
|
+
"srvc",
|
|
116
|
+
"stackback",
|
|
117
|
+
"sugarss",
|
|
118
|
+
"teardown",
|
|
119
|
+
"timezone",
|
|
120
|
+
"timezones",
|
|
121
|
+
"tinybench",
|
|
122
|
+
"tinyexec",
|
|
123
|
+
"tinyglobby",
|
|
124
|
+
"tinypool",
|
|
125
|
+
"tinyrainbow",
|
|
126
|
+
"tootallnate",
|
|
127
|
+
"totalist",
|
|
128
|
+
"tsgolint",
|
|
129
|
+
"ttclid",
|
|
130
|
+
"turbolinks",
|
|
131
|
+
"tybys",
|
|
132
|
+
"undici",
|
|
133
|
+
"uniqby",
|
|
134
|
+
"unstub",
|
|
135
|
+
"visitorid",
|
|
136
|
+
"vite",
|
|
137
|
+
"vitejs",
|
|
138
|
+
"vitest",
|
|
139
|
+
"wasi",
|
|
140
|
+
"wcwidth",
|
|
141
|
+
"webdriverio",
|
|
142
|
+
"webidl",
|
|
143
|
+
"whatwg",
|
|
144
|
+
"yargs",
|
|
145
|
+
"yoctocolors",
|
|
146
|
+
"yxxx",
|
|
147
|
+
"zstd"
|
|
148
|
+
]
|
|
149
|
+
}
|
package/.editorconfig
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# CV-496 (PR #67 review): local dependency security audit.
|
|
2
|
+
#
|
|
3
|
+
# First line of defence — catches CRITICAL vulnerabilities before code reaches
|
|
4
|
+
# CI. Uses pnpm audit against the npm advisory database.
|
|
5
|
+
#
|
|
6
|
+
# Full pipeline (mirrors gen2-monorepo-base CV2-300):
|
|
7
|
+
# 1. LOCAL: pnpm audit --audit-level=critical (this hook — blocks commit)
|
|
8
|
+
# 2. PR CI: pnpm audit --audit-level=critical (catches critical in CI)
|
|
9
|
+
# 3. PR CI: pnpm sbom generation (compliance artifact)
|
|
10
|
+
# 4. GITHUB: Dependabot (auto-fix PRs for vulnerable deps)
|
|
11
|
+
#
|
|
12
|
+
echo "Running dependency security audit..."
|
|
13
|
+
pnpm audit --audit-level=critical || {
|
|
14
|
+
echo ""
|
|
15
|
+
echo "=============================================="
|
|
16
|
+
echo " Dependency security audit found CRITICAL"
|
|
17
|
+
echo " vulnerabilities."
|
|
18
|
+
echo ""
|
|
19
|
+
echo " Run 'pnpm audit' for details."
|
|
20
|
+
echo " Run 'pnpm audit --fix' to auto-fix."
|
|
21
|
+
echo "=============================================="
|
|
22
|
+
echo ""
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
25
|
+
echo "Dependency security audit passed."
|
|
26
|
+
|
|
27
|
+
pnpm exec lint-staged
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
if [ "$2" = "message" ]; then
|
|
4
|
+
exit 0
|
|
5
|
+
fi
|
|
6
|
+
|
|
7
|
+
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
|
|
8
|
+
|
|
9
|
+
if echo "$BRANCH_NAME" | grep -q '^(no branch, rebasing .*)$'; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
exec < /dev/tty && pnpm exec gitmoji --hook "$1" "$2" || true
|
package/.oxfmtrc.json
ADDED
package/.oxlintrc.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": ["eslint", "import", "jsdoc", "oxc", "promise", "typescript", "unicorn", "vitest"],
|
|
4
|
+
"categories": {
|
|
5
|
+
"correctness": "error",
|
|
6
|
+
"suspicious": "error",
|
|
7
|
+
"perf": "error"
|
|
8
|
+
},
|
|
9
|
+
"rules": {
|
|
10
|
+
"@typescript-eslint/unbound-method": ["error", { "ignoreStatic": true }],
|
|
11
|
+
"eslint/sort-imports": ["error", { "ignoreDeclarationSort": true }],
|
|
12
|
+
"eslint/no-underscore-dangle": "off",
|
|
13
|
+
"eslint/no-await-in-loop": "off",
|
|
14
|
+
"typescript/no-unsafe-type-assertion": "off",
|
|
15
|
+
"typescript/no-wrapper-object-types": "off",
|
|
16
|
+
"typescript/no-redundant-type-constituents": "off",
|
|
17
|
+
"unicorn/consistent-function-scoping": "off",
|
|
18
|
+
"unicorn/prefer-add-event-listener": "off"
|
|
19
|
+
},
|
|
20
|
+
"env": {
|
|
21
|
+
"builtin": true
|
|
22
|
+
},
|
|
23
|
+
"overrides": [
|
|
24
|
+
{
|
|
25
|
+
"files": ["**/tests/**", "**/*.test.{js,ts}"],
|
|
26
|
+
"rules": {
|
|
27
|
+
"typescript/unbound-method": "off",
|
|
28
|
+
"vitest/require-mock-type-parameters": "off",
|
|
29
|
+
"vitest/no-conditional-expect": "off",
|
|
30
|
+
"vitest/valid-title": "off"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
package/.release-it.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
"aaron-bond.better-comments",
|
|
4
|
+
"codeandstuff.package-json-upgrade",
|
|
5
|
+
"davidanson.vscode-markdownlint",
|
|
6
|
+
"editorconfig.editorconfig",
|
|
7
|
+
"github.copilot",
|
|
8
|
+
"jock.svg",
|
|
9
|
+
"oxc.oxc-vscode",
|
|
10
|
+
"ryu1kn.partial-diff",
|
|
11
|
+
"sonarsource.sonarlint-vscode",
|
|
12
|
+
"streetsidesoftware.code-spell-checker",
|
|
13
|
+
"typescriptteam.native-preview",
|
|
14
|
+
"vitest.explorer",
|
|
15
|
+
"vscode-icons-team.vscode-icons",
|
|
16
|
+
"yzhang.markdown-all-in-one"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"oxc.fmt.configPath": ".oxfmtrc.json",
|
|
3
|
+
"oxc.typeAware": true,
|
|
4
|
+
"editor.codeActionsOnSave": {
|
|
5
|
+
"source.fixAll.oxc": "always"
|
|
6
|
+
},
|
|
7
|
+
"editor.defaultFormatter": "oxc.oxc-vscode",
|
|
8
|
+
"editor.formatOnSaveMode": "file",
|
|
9
|
+
"editor.formatOnSave": true,
|
|
10
|
+
"js/ts.experimental.useTsgo": true,
|
|
11
|
+
"typescript.native-preview.tsdk": "node_modules/@typescript/native-preview"
|
|
12
|
+
}
|
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ Configuration takes place by global `window.commversion` object, make sure to no
|
|
|
18
18
|
|
|
19
19
|
```html
|
|
20
20
|
<script>
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
window.commversion = window.commversion || {};
|
|
22
|
+
window.commversion.someProperty = true;
|
|
23
23
|
</script>
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -28,6 +28,7 @@ Configuration takes place by global `window.commversion` object, make sure to no
|
|
|
28
28
|
All scripts are available under the `scripts/` directory.
|
|
29
29
|
|
|
30
30
|
- schedule-event
|
|
31
|
+
- lc-attribution
|
|
31
32
|
- lc-open-on-button-click
|
|
32
33
|
- lc-cookie-banner-update-position
|
|
33
34
|
- lc-show-by-selector
|
|
@@ -52,6 +53,7 @@ All scripts are available under the `scripts/` directory.
|
|
|
52
53
|
- lc-whatsapp-widget-only
|
|
53
54
|
- lc-whatsapp-widget-combo
|
|
54
55
|
- lc-channel-widgets
|
|
56
|
+
<!-- scaffold:scripts -->
|
|
55
57
|
|
|
56
58
|
## Release new versions
|
|
57
59
|
|
|
@@ -59,14 +61,14 @@ All scripts are available under the `scripts/` directory.
|
|
|
59
61
|
This project uses the npm.js public registry. Before trying to do any release, make sure you are logged with npm as Commversion.
|
|
60
62
|
The quickest way to do that, is to create a `.npmrc` file in the project directly and insert the following:
|
|
61
63
|
|
|
62
|
-
```
|
|
64
|
+
```plaintext
|
|
63
65
|
//registry.npmjs.org/:_authToken=base64_encoded_npm_token
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
You can test if the above works by running:
|
|
67
69
|
|
|
68
|
-
```
|
|
69
|
-
$
|
|
70
|
+
```bash
|
|
71
|
+
$ pnpm whoami
|
|
70
72
|
commversion # this is the authenticated npm user
|
|
71
73
|
```
|
|
72
74
|
|
|
@@ -76,22 +78,30 @@ Patch releases for bug fixes.
|
|
|
76
78
|
Minor releases for new features.
|
|
77
79
|
Major releases for breaking changes.
|
|
78
80
|
|
|
79
|
-
The release is fully automated by executing `
|
|
81
|
+
The release is fully automated by executing `pnpm run release`. No need to run build scripts beforehand, this is done automatically.
|
|
80
82
|
|
|
81
83
|
## Guideline for contributing
|
|
82
84
|
|
|
85
|
+
This project uses **pnpm** via [Corepack](https://nodejs.org/api/corepack.html) — the exact pnpm version is pinned in `packageManager` in `package.json` and Corepack downloads/verifies it on first use. Enable Corepack once with:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
corepack enable
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Node `>=24` is required.
|
|
92
|
+
|
|
83
93
|
To create a new script, run the following command in a shell.
|
|
84
94
|
|
|
85
95
|
```bash
|
|
86
|
-
|
|
96
|
+
pnpm new script-name
|
|
87
97
|
```
|
|
88
98
|
|
|
89
|
-
The command above will create
|
|
99
|
+
The command above will create a new script containing the absolute minimum files. It will also amend root `README.md` and `package.json` to include required entries.
|
|
90
100
|
|
|
91
|
-
Start working on a specific script by running `
|
|
101
|
+
Start working on a specific script by running `pnpm run dev:<script-name>`.
|
|
92
102
|
|
|
93
103
|
Finally, you can run tests by running:
|
|
94
104
|
|
|
95
105
|
```bash
|
|
96
|
-
|
|
106
|
+
pnpm test
|
|
97
107
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var o=class e{constructor(e={}){r(this,`dependencies`,void 0),this.dependencies=e}provide(t){return new e(a(a({},this.dependencies),t(this.dependencies)))}},s=class e{constructor(e,t,n,i,a,o){r(this,`bus`,void 0),r(this,`pageData`,void 0),r(this,`registry`,void 0),r(this,`channelClick`,void 0),r(this,`exitIntent`,void 0),r(this,`form`,void 0),this.bus=e,this.pageData=t,this.registry=n,this.channelClick=i,this.exitIntent=a,this.form=o}static build(t){let{bus:n,pageData:r,registry:i,channelClick:a,exitIntent:o,form:s}=t;return{app:new e(n,r,i,a,o,s)}}init(){this.pageData.init(),this.registry.init(),this.channelClick.init(),this.exitIntent.init(),this.form.init(),this.bus.dispatch(`commversion:attribution-ready`,{})}destroy(){this.registry.destroy(),this.channelClick.destroy(),this.exitIntent.destroy(),this.form.destroy()}},c=class e{constructor(e){r(this,`target`,void 0),this.target=e}on(e,t){let n=e=>{e instanceof CustomEvent&&t(e.detail)};return this.target.addEventListener(e,n),()=>this.target.removeEventListener(e,n)}dispatch(e,t){this.target.dispatchEvent(new CustomEvent(e,{detail:t}))}static build(){return{bus:new e(window)}}},l=class e{constructor(e,t){r(this,`bus`,void 0),r(this,`registry`,void 0),r(this,`unsubscribe`,void 0),this.bus=e,this.registry=t}static build(t){let{bus:n,registry:r}=t;return{channelClick:new e(n,r)}}init(){this.unsubscribe=this.bus.on(`commversion:channel-clicked`,({channel:e})=>{let{sessionVariables:t}=window.LiveChatWidget.get(`customer_data`);this.registry.patchOne(e,{chat_start_url:window.location.href,chat_start_time:new Date().toISOString(),session_variables:t})})}destroy(){var e;(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=void 0}},u=class e{constructor(e,t,n){r(this,`registry`,void 0),r(this,`debounceMs`,void 0),r(this,`margin`,void 0),r(this,`isMouseInside`,!0),r(this,`leaveTimeout`,void 0),r(this,`onMouseEnter`,()=>{this.registry.patchAll({exit_intent:!1})}),r(this,`onMouseLeave`,()=>{this.isBrowsing()&&this.registry.patchAll({exit_intent:!0})}),r(this,`onMouseMove`,e=>{this.checkBounds(e.clientX,e.clientY)?this.isMouseInside?(clearTimeout(this.leaveTimeout),this.leaveTimeout=void 0):(this.isMouseInside=!0,this.registry.patchAll({exit_intent:!1})):this.isMouseInside&&(this.isMouseInside=!1,this.leaveTimeout=setTimeout(()=>{this.leaveTimeout=void 0,this.isBrowsing()&&this.registry.patchAll({exit_intent:!0})},this.debounceMs))}),this.registry=e,this.debounceMs=t,this.margin=n}init(){window.addEventListener(`mouseenter`,this.onMouseEnter),window.addEventListener(`mouseleave`,this.onMouseLeave),window.addEventListener(`mousemove`,this.onMouseMove)}static build(t){let{registry:n,config:r}=t,{exitIntentDebounceMs:i=1500,exitIntentMargin:a=10}=r;return{exitIntent:new e(n,i,a)}}destroy(){window.removeEventListener(`mouseenter`,this.onMouseEnter),window.removeEventListener(`mouseleave`,this.onMouseLeave),window.removeEventListener(`mousemove`,this.onMouseMove)}checkBounds(e,t){let n=window.innerWidth,r=window.innerHeight;return e>=this.margin&&e<=n-this.margin&&t>=this.margin&&t<=r-this.margin}isBrowsing(){try{return window.LiveChatWidget.get(`customer_data`).status===`browsing`}catch(e){return!1}}},d=class e{constructor(e,t,n,i){r(this,`registry`,void 0),r(this,`abandonmentSelector`,void 0),r(this,`abandonmentDelaySeconds`,void 0),r(this,`submissionSelector`,void 0),r(this,`formAbandonmentTimeout`,void 0),r(this,`abandonmentForms`,void 0),r(this,`submissionForms`,void 0),r(this,`inputs`,void 0),r(this,`onChange`,()=>{clearTimeout(this.formAbandonmentTimeout),this.formAbandonmentTimeout=setTimeout(()=>{this.registry.patchAll({form_abandoned:!0})},this.abandonmentDelaySeconds*1e3)}),r(this,`onAbandonmentFormSubmit`,()=>{clearTimeout(this.formAbandonmentTimeout)}),r(this,`onSubmit`,()=>{this.registry.patchAll({form_submission:!0})}),r(this,`onInvalid`,()=>{this.registry.patchAll({input_error:!0})}),this.registry=e,this.abandonmentSelector=t,this.abandonmentDelaySeconds=n,this.submissionSelector=i}static build(t){let{registry:n,config:r}=t,{formAbandonmentSelector:i=`form`,formAbandonmentDelay:a=10,formSubmissionSelector:o=`form`}=r;return{form:new e(n,i,a,o)}}init(){this.abandonmentForms=document.querySelectorAll(this.abandonmentSelector),this.submissionForms=document.querySelectorAll(this.submissionSelector),this.inputs=document.querySelectorAll(`input`);for(let e of this.abandonmentForms)e.addEventListener(`change`,this.onChange),e.addEventListener(`submit`,this.onAbandonmentFormSubmit);for(let e of this.submissionForms)e.addEventListener(`submit`,this.onSubmit);for(let e of this.inputs)e.addEventListener(`invalid`,this.onInvalid)}destroy(){var e,t,n;for(let t of(e=this.abandonmentForms)==null?[]:e)t.removeEventListener(`change`,this.onChange),t.removeEventListener(`submit`,this.onAbandonmentFormSubmit);for(let e of(t=this.submissionForms)==null?[]:t)e.removeEventListener(`submit`,this.onSubmit);for(let e of(n=this.inputs)==null?[]:n)e.removeEventListener(`invalid`,this.onInvalid)}};function f(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,`next`,e)}function s(e){f(a,r,i,o,s,`throw`,e)}o(void 0)})}}var m=class e{constructor(e){r(this,`url`,void 0),this.url=e}static build(t){let{url:n}=t;return{http:new e(n)}}post(e){var t=this;return p(function*(){let n=yield fetch(t.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`POST ${t.url} failed with ${n.status}`);return yield n.json()})()}patch(e){var t=this;return p(function*(){yield fetch(t.url,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),keepalive:!0})})()}},h;function g(e,t,n){var r;function i(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=s.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let a=(r=n==null?void 0:n.Parent)==null?Object:r;class o extends a{}Object.defineProperty(o,"name",{value:e});function s(e){var t;let r=n!=null&&n.Parent?new o:this;i(r,e),(t=r._zod).deferred!=null||(t.deferred=[]);for(let e of r._zod.deferred)e();return r}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>{var r;return n!=null&&n.Parent&&t instanceof n.Parent?!0:t==null||(r=t._zod)==null||(r=r.traits)==null?void 0:r.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var _=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(h=globalThis).__zod_globalConfig!=null||(h.__zod_globalConfig={});var v=globalThis.__zod_globalConfig;function y(e){return e&&Object.assign(v,e),v}function b(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function x(e,t){if(e==null)return{};var n,r,i=b(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var ee=[`inst`,`continue`,`input`];function te(e,t){return typeof t==`bigint`?t.toString():t}function ne(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}var S=Symbol(`evaluating`);function C(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==S)return r===void 0&&(r=S,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}var w=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ie(e,t,n){let r=new e._zod.constr(t==null?e._zod.def:t);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?a(a({},t),{},{error:()=>t.error}):t}function ae(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function E(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0}return!1}function D(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0}return!1}function O(e,t){return t.map(t=>{var n;return(n=t).path!=null||(n.path=[]),t.path.unshift(e),t})}function k(e){return typeof e==`string`?e:e==null?void 0:e.message}function A(e,t,n){var r,i,a,o,s,c,l,u,d;let f=e.message?e.message:(r=(i=(a=(o=k((s=e.inst)==null||(s=s._zod.def)==null||(c=s.error)==null?void 0:c.call(s,e)))==null?k(t==null||(l=t.error)==null?void 0:l.call(t,e)):o)==null?k((u=n.customError)==null?void 0:u.call(n,e)):a)==null?k((d=n.localeError)==null?void 0:d.call(n,e)):i)==null?`Invalid input`:r,{inst:p,continue:m,input:h}=e,g=x(e,ee);return g.path!=null||(g.path=[]),g.message=f,t!=null&&t.reportInput&&(g.input=h),g}var j=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,te,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oe=g(`$ZodError`,j),M=g(`$ZodError`,j,{Parent:Error}),se=(e=>(t,n,r,i)=>{let o=r?a(a({},r),{},{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new _;if(s.issues.length){var c;let t=new((c=i==null?void 0:i.Err)==null?e:c)(s.issues.map(e=>A(e,o,y())));throw w(t,i==null?void 0:i.callee),t}return s.value})(M),ce=(e=>function(){var t=p(function*(t,n,r,i){let o=r?a(a({},r),{},{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=yield s),s.issues.length){var c;let t=new((c=i==null?void 0:i.Err)==null?e:c)(s.issues.map(e=>A(e,o,y())));throw w(t,i==null?void 0:i.callee),t}return s.value});return function(e,n,r,i){return t.apply(this,arguments)}}())(M),N=(e=>(t,n,r)=>{let i=r?a(a({},r),{},{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new _;return o.issues.length?{success:!1,error:new(e==null?oe:e)(o.issues.map(e=>A(e,i,y())))}:{success:!0,data:o.value}})(M),P=(e=>function(){var t=p(function*(t,n,r){let i=r?a(a({},r),{},{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=yield o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>A(e,i,y())))}:{success:!0,data:o.value}});return function(e,n,r){return t.apply(this,arguments)}}())(M),le=/^https?$/,F=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;`${F}`;function ue(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function I(e){let t=ue({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${F}T(?:${r})$`)}var L=e=>{var t,n;let r=e?`[\\s\\S]{${(t=e==null?void 0:e.minimum)==null?0:t},${(n=e==null?void 0:e.maximum)==null?``:n}}`:`[\\s\\S]*`;return RegExp(`^${r}$`)},R=g(`$ZodCheck`,(e,t)=>{var n;e._zod!=null||(e._zod={}),e._zod.def=t,(n=e._zod).onattach!=null||(n.onattach=[])}),z=g(`$ZodCheckStringFormat`,(e,t)=>{var n,r;R.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns!=null||(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check!=null||(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push(a(a({origin:`string`,code:`invalid_format`,format:t.format,input:n.value},t.pattern?{pattern:t.pattern.toString()}:{}),{},{inst:e,continue:!t.abort}))}):(r=e._zod).check!=null||(r.check=()=>{})}),B={major:4,minor:4,patch:3},V=g(`$ZodType`,(e,t)=>{var n,r;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=B;let i=[...(n=e._zod.def.checks)==null?[]:n];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0){var o;(r=e._zod).deferred!=null||(r.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse})}else{let t=(e,t,n)=>{let r=E(e),i;for(let o of t){if(o._zod.def.when){if(D(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&(n==null?void 0:n.async)===!1)throw new _;if(i||s instanceof Promise){var a;i=((a=i)==null?Promise.resolve():a).then(p(function*(){yield s,e.issues.length!==t&&(r||(r=E(e,t)))}))}else{if(e.issues.length===t)continue;r||(r=E(e,t))}}return i?i.then(()=>e):e},n=(n,r,a)=>{if(E(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new _;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if(o.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},a(a({},o),{},{skipChecks:!0}));return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}let s=e._zod.parse(r,o);if(s instanceof Promise){if(o.async===!1)throw new _;return s.then(e=>t(e,i,o))}return t(s,i,o)}}C(e,`~standard`,()=>({validate:t=>{try{var n;let r=N(e,t);return r.success?{value:r.data}:{issues:(n=r.error)==null?void 0:n.issues}}catch(n){return P(e,t).then(e=>{var t;return e.success?{value:e.data}:{issues:(t=e.error)==null?void 0:t.issues}})}},vendor:`zod`,version:1}))}),H=g(`$ZodString`,(e,t)=>{var n,r,i;V.init(e,t),e._zod.pattern=(n=[...(r=e==null||(i=e._zod.bag)==null?void 0:i.patterns)==null?[]:r].pop())==null?L(e._zod.bag):n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(e){}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),U=g(`$ZodStringFormat`,(e,t)=>{z.init(e,t),H.init(e,t)}),de=g(`$ZodURL`,(e,t)=>{U.init(e,t),e._zod.check=n=>{try{var r;let i=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===le.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let a=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(`:`)?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=i;return}catch(r){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),fe=g(`$ZodISODateTime`,(e,t)=>{t.pattern!=null||(t.pattern=I(t)),U.init(e,t)}),pe=g(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function W(e,t,n){e.issues.length&&t.issues.push(...O(n,e.issues)),t.value[n]=e.value}var me=g(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>W(t,n,e))):W(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function G(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...O(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function he(e){let t=Object.keys(e.shape);for(let r of t){var n;if(!(!((n=e.shape)==null||(n=n[r])==null||(n=n._zod)==null||(n=n.traits)==null)&&n.has(`$ZodType`)))throw Error(`Invalid element at key "${r}": expected a Zod schema`)}let r=ae(e.shape);return a(a({},e),{},{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)})}function ge(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>G(e,n,i,t,u,d))):G(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var _e=g(`$ZodObject`,(e,t)=>{V.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`);if(!(n!=null&&n.get)){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n=a({},e);return Object.defineProperty(t,"shape",{value:n}),n}})}let r=ne(()=>he(t));C(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]!=null||(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let i=re,o=t.catchall,s;e._zod.parse=(t,n)=>{s!=null||(s=r.value);let a=t.value;if(!i(a))return t.issues.push({expected:`object`,code:`invalid_type`,input:a,inst:e}),t;t.value={};let c=[],l=s.shape;for(let e of s.keys){let r=l[e],i=r._zod.optin===`optional`,o=r._zod.optout===`optional`,s=r._zod.run({value:a[e],issues:[]},n);s instanceof Promise?c.push(s.then(n=>G(n,t,e,a,i,o))):G(s,t,e,a,i,o)}return o?ge(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}});function ve(e,t){return new e(a({type:`string`},T(t)))}function ye(e,t){return new e(a({type:`string`,format:`url`,check:`string_format`,abort:!1},T(t)))}function be(e,t){return new e(a({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null},T(t)))}function xe(e,t){return new e(a({type:`never`},T(t)))}var K=g(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>se(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>N(e,t,n),e.parseAsync=function(){var t=p(function*(t,n){return ce(e,t,n,{callee:e.parseAsync})});return function(e,n){return t.apply(this,arguments)}}(),e.safeParseAsync=function(){var t=p(function*(t,n){return P(e,t,n)});return function(e,n){return t.apply(this,arguments)}}(),e.check=(...n)=>{var r;return e.clone(a(a({},t),{},{checks:[...(r=t.checks)==null?[]:r,...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},e.with=e.check,e.clone=(t,n)=>ie(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),q=g(`ZodMiniString`,(e,t)=>{H.init(e,t),K.init(e,t)});function J(e){return ve(q,e)}var Y=g(`ZodMiniStringFormat`,(e,t)=>{U.init(e,t),q.init(e,t)}),Se=g(`ZodMiniURL`,(e,t)=>{de.init(e,t),Y.init(e,t)});function X(e){return ye(Se,e)}var Ce=g(`ZodMiniNever`,(e,t)=>{pe.init(e,t),K.init(e,t)});function we(e){return xe(Ce,e)}var Te=g(`ZodMiniArray`,(e,t)=>{me.init(e,t),K.init(e,t)});function Ee(e,t){return new Te(a({type:`array`,element:e},T(t)))}var De=g(`ZodMiniObject`,(e,t)=>{_e.init(e,t),K.init(e,t),C(e,`shape`,()=>t.shape)});function Z(e,t){return new De(a({type:`object`,shape:e,catchall:we()},T(t)))}var Oe=g(`ZodMiniISODateTime`,(e,t)=>{fe.init(e,t),Y.init(e,t)});function ke(e){return be(Oe,e)}var Ae=e=>{let t={};for(let n of e.split(/;\s*/)){if(!n)continue;let e=n.indexOf(`=`);if(e<0)continue;let r=n.slice(0,e).trim();if(!r)continue;let i=n.slice(e+1).trim();try{t[r]=decodeURIComponent(i)}catch(e){t[r]=i}}return t},je=Z({referrer:J(),landing_page:X(),browsing_history:Ee(Z({opened_at:ke(),url:X(),title:J()}))}),Q=`lc_browsing_history_data`,Me=`screen and (max-width: 992px) and (pointer: coarse)`,Ne=class e{constructor(e){r(this,`sessionVariables`,void 0),r(this,`data`,void 0),this.sessionVariables=e}static build(t){let{sessionVariables:n}=t;return{pageData:new e(n)}}init(){this.data=Pe(this.sessionVariables)}get(){if(this.data===void 0)throw Error(`PageDataCollector.get called before init`);return this.data}},Pe=e=>{let t=new URLSearchParams(window.location.search);return a(a(a({session_variables:e,device:window.matchMedia(Me).matches?`mobile`:`desktop`},Fe(t,e)),Ie(t)),Le())},Fe=(e,t)=>{var n,r,i;let a={};if(window.gaGlobal===void 0)return a;let o=Ae(document.cookie),s=Object.entries(o),c=(n=window.analytics)==null?void 0:n.user(),l=window.gaGlobal.vid,u=s.filter(([e])=>e.startsWith(`_ga_`)).map(e=>{var t;return(t=e[1])==null?``:t}),d=e.get(`gclid`)||((r=s.find(([e])=>e.startsWith(`_gcl_aw`)))==null?void 0:r[1])||t.gclid,f=e.get(`dclid`)||o._gcl_dc||t.dclid,p=t.fbc||o._fbc,m=t.fbp||o._fbp,h=e.get(`ttclid`)||o._ttp,g=e.get(`li_fat_id`)||o.li_fat_id,_=(c==null?void 0:c.anonymousId())||window.localStorage.getItem(`ajs_anonymous_id`),v=(c==null?void 0:c.id())||window.localStorage.getItem(`ajs_user_id`),y=(i=s.find(([e])=>e.startsWith(`bid_`)))==null?void 0:i[1];return l&&(a.ga_session=l),u.length>0&&(a.ga_session_id=u),d&&(a.gclid=d),f&&(a.dclid=f),p&&(a.fbc=p),m&&(a.fbp=m),h&&(a.ttclid=h),g&&(a.li_fat_id=g),_&&(a.segment_anonymous_id=_),v&&(a.segment_user_id=v),y&&(a.sitecore_browser_id=y),a},Ie=e=>{let t={},n=e.get(`utm_id`),r=e.get(`utm_source`),i=e.get(`utm_medium`),a=e.get(`utm_campaign`),o=e.get(`utm_term`),s=e.get(`utm_content`);return n&&(t.utm_id=n),r&&(t.utm_source=r),i&&(t.utm_medium=i),a&&(t.utm_campaign=a),o&&(t.utm_term=o),s&&(t.utm_content=s),t},Le=()=>{let e=$(),t=new Date;t.setDate(t.getDate()-30);let n=e.browsing_history.filter(e=>new Date(e.opened_at)>t),r={opened_at:new Date().toISOString(),url:window.location.href,title:document.title},i=n.length===0?{referrer:document.referrer,landing_page:r.url,browsing_history:[r]}:a(a({},e),{},{browsing_history:[...n,r].slice(-50)});return window.localStorage.setItem(Q,JSON.stringify(i)),i},$=()=>{let e=window.localStorage.getItem(Q);if(!e)return{referrer:``,landing_page:``,browsing_history:[]};try{return je.parse(JSON.parse(e))}catch(t){return console.error(`Error parsing ${Q}:`,{content:e},t),{referrer:``,landing_page:``,browsing_history:[]}}},Re=class e{constructor(e,t,n,i){r(this,`bus`,void 0),r(this,`http`,void 0),r(this,`pageData`,void 0),r(this,`clientId`,void 0),r(this,`shortCodes`,{whatsapp:void 0,sms:void 0,facebook:void 0}),r(this,`unsubscribe`,void 0),this.bus=e,this.http=t,this.pageData=n,this.clientId=i}static build(t){let{bus:n,http:r,pageData:i,config:a}=t;return{registry:new e(n,r,i,a.clientId)}}init(){this.unsubscribe=this.bus.on(`commversion:channels-registered`,({channels:e})=>{for(let t of e)this.shortCodes[t]===void 0&&(this.shortCodes[t]=this.startChannel(t),this.shortCodes[t].catch(e=>console.error(e)))})}destroy(){var e;(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=void 0}patchAll(e){for(let t of Object.values(this.shortCodes))t==null||t.then(t=>this.http.patch(a({short_code:t},e)).catch(e=>console.error(e)),()=>{})}patchOne(e,t){var n;(n=this.shortCodes[e])==null||n.then(e=>this.http.patch(a({short_code:e},t)).catch(e=>console.error(e)),()=>{})}startChannel(e){var t=this;return p(function*(){try{let{short_code:n}=yield t.http.post(a(a({},t.pageData.get()),{},{client_id:t.clientId,channel:e,exit_intent:!1}));return t.bus.dispatch(`commversion:shortcode-resolved`,{channel:e,shortCode:n}),n}catch(n){let r=n instanceof Error?n.message:String(n);throw t.bus.dispatch(`commversion:shortcode-failed`,{channel:e,error:r}),n}})()}},ze=`https://api.cht-srvc.net/attribution`,Be=e=>{var t;let n,r=(t=e.attributionUrl)==null?ze:t;return Object.assign(({customerData:t})=>{n=new o({config:e,url:r,sessionVariables:t.sessionVariables}).provide(c.build).provide(m.build).provide(Ne.build).provide(Re.build).provide(l.build).provide(u.build).provide(d.build).provide(s.build).dependencies.app,n.init()},{destroy:()=>{n==null||n.destroy(),n=void 0}})};window.commversion=window.commversion||{};var Ve=Be(window.commversion);window.LiveChatWidget.once(`ready`,Ve)})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Object.defineProperties;var Ke=Object.getOwnPropertyDescriptors;var be=Object.getOwnPropertySymbols;var et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable;var _e=(m,g,C)=>g in m?Qe(m,g,{enumerable:!0,configurable:!0,writable:!0,value:C}):m[g]=C,P=(m,g)=>{for(var C in g||(g={}))et.call(g,C)&&_e(m,C,g[C]);if(be)for(var C of be(g))tt.call(g,C)&&_e(m,C,g[C]);return m},we=(m,g)=>Je(m,Ke(g));const ye={whatsapp:{label:"WhatsApp",icon:'<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>',backgroundColor:"#25D366",prefilledmessage:"Hi, I'd like to learn more.",mobile:{enabled:!1,url:"https://wa.me/{number}[?text={prefilledmessage}]"},desktop:{enabled:!1,url:"https://web.whatsapp.com/send?phone={number}[&text={prefilledmessage}]"}},sms:{label:"SMS",icon:'<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 13H6v-2h2v2zm5 0h-2v-2h2v2zm5 0h-2v-2h2v2z"/></svg>',backgroundColor:"#3478F6",prefilledmessage:"Hi, I'd like to learn more.",mobile:{enabled:!1,url:"sms:{number}[?body={prefilledmessage}]"},desktop:{enabled:!1,url:"sms:{number}[?body={prefilledmessage}]"},popover:{title:"Text us \u2014 we're available 24/7",description:"US numbers only. Msg & carrier rates may apply. Reply STOP to opt out.",buttonLabel:"Start Conversation"}}},ve=new Set(["prefilledmessage"]);function Ce(e,t){return e.replace(/\[([^\]]*)\]/g,(i,o)=>{for(const[,s]of o.matchAll(/\{(\w+)\}/g)){const a=t[s];if(a==null||a==="")return""}return o}).replace(/\{(\w+)\}/g,(i,o)=>{const s=t[o];if(s==null)return"";const a=String(s);return ve.has(o)?encodeURIComponent(a):a})}const Q=e=>e&&typeof e.enabled=="boolean"?{enabled:e.enabled}:{},Se=e=>e===!0?!0:e&&typeof e=="object"?e.enabled===!0:!1,J={title:60,description:140,buttonLabel:24},xe=(e,t)=>{if(!e||e===!0||typeof e!="object")return{};const n={},i=o=>{if(typeof e[o]!="string")return;const s=J[o];if(s!=null&&e[o].length>s){console.warn(`[lc-channel-widgets] ${t} popover.${o} exceeds ${s} chars (got ${e[o].length}); using registry default`);return}n[o]=e[o]};return Object.keys(J).forEach(i),n};function Be(e,t){if(!e||typeof e.type!="string")return null;const n=ye[e.type];if(!n)return null;const i=n[t]||{},o=we(P({},e),{prefilledmessage:typeof e.prefilledmessage=="string"?e.prefilledmessage:n.prefilledmessage||""});return{type:e.type,label:n.label,icon:n.icon,backgroundColor:n.backgroundColor,mobile:P(P({},n.mobile),Q(e.mobile)),desktop:P(P({},n.desktop),Q(e.desktop)),popover:n.popover&&Se(e.popover)?P(P({},n.popover),xe(e.popover,e.type)):void 0,href:i.url?Ce(i.url,o):""}}const Ee="screen and (max-width: 992px) and (pointer: coarse)",Le=()=>window.matchMedia(Ee).matches?"mobile":"desktop",_=[];function K(){for(let e=_.length-1;e>=0;e--){const t=_[e];t&&t.parentNode&&t.parentNode.removeChild(t),_.splice(e,1)}}let ee=!1;function Oe(){ee||(ee=!0,document.addEventListener("click",e=>{for(let t=0;t<_.length;t++){const n=_[t];n.__isOpen&&!n.contains(e.target)&&W(n)}}))}function ze(){if(window.__lcHistoryPatched)return;window.__lcHistoryPatched=!0,window.__lcLastUrl=window.__lcLastUrl||location.href;const e=i=>{const o=window.__lcLastUrl,s=location.href,a=o!==s;window.__lcLastUrl=s,!(!a&&i!=="popstate")&&window.dispatchEvent(new Event("lc:locationchange"))},t=history.pushState;typeof t=="function"&&(history.pushState=function(...i){const o=t.apply(this,i);return e("pushState"),o});const n=history.replaceState;typeof n=="function"&&(history.replaceState=function(...i){const o=n.apply(this,i);return e("replaceState"),o}),window.addEventListener("popstate",()=>e("popstate")),window.addEventListener("hashchange",()=>e("hashchange"))}function te(e){var i;if(document.__lcVisibilityBound&&!e)return!0;if(typeof((i=window.LiveChatWidget)==null?void 0:i.on)!="function")return!1;const t=document.__lcVisibilityCb;if(t&&typeof window.LiveChatWidget.off=="function")try{window.LiveChatWidget.off("visibility_changed",t)}catch(o){}const n=o=>{var a,c;const s=document.__lcStack;!s||!s.isConnected||(o&&typeof o.visibility=="string"&&(s.__lcVisibility=o.visibility),(a=document.__lcCurrentRebind)==null||a.call(document),(c=document.__lcCurrentSync)==null||c.call(document))};return window.LiveChatWidget.on("visibility_changed",n),document.__lcVisibilityCb=n,document.__lcVisibilityBound=!0,!0}function ke(e){if(te(e)||document.__lcVisibilityPolling)return;document.__lcVisibilityPolling=!0;let t=0;const n=setInterval(()=>{(te(e)||++t>=200)&&(clearInterval(n),document.__lcVisibilityPolling=!1)},200)}function Ae(){document.__lcBodyMutationObs||typeof MutationObserver!="undefined"&&(document.__lcBodyMutationObs=new MutationObserver(e=>{const t=document.__lcStack;if(!!t)for(let n=0;n<e.length;n++){const i=e[n].removedNodes;if(!(!i||i.length===0))for(let o=0;o<i.length;o++){const s=i[o];if(s.nodeType===1&&(s===t||s.contains&&s.contains(t))){const a=document.__lcChannelWidgetsConfig;a&&ne(a);return}}}}),document.__lcBodyMutationObs.observe(document.body,{childList:!0,subtree:!0}))}let F=null,j=null;function ne(e){j=e,!F&&(F=setTimeout(()=>{F=null;const t=j;j=null,Y(t)},100))}const ie="#chat-widget-minimized",oe="#chat-overlay-container",Pe="#chat-overlay-button",Te=[ie,oe],Re=15,re=100,We=150;function Ie(e){return{width:e.width,height:e.height,fromLeft:e.left,fromRight:window.innerWidth-e.right,fromTop:e.top,fromBottom:window.innerHeight-e.bottom}}function Me(e){const t=e.fromLeft<=e.fromRight,n=e.fromTop<=e.fromBottom,i=t?e.fromLeft:window.innerWidth-e.fromRight-e.width,o=n?e.fromTop:window.innerHeight-e.fromBottom-e.height;return{left:i,top:o,right:i+e.width,bottom:o+e.height,width:e.width,height:e.height}}const V=60;function Ve(e){const t=window.innerWidth-e.right<=e.left,n=e.bottom,i=n-V,o=t?e.right:e.left+V;return{left:o-V,right:o,top:i,bottom:n,width:V,height:V}}const He=200,Ne=150;function N(e,t,{interval:n=He,maxRetries:i=Ne}={}){let o=0;const s=setInterval(()=>{const a=document.querySelector(e);if(a){clearInterval(s),t(a);return}++o>=i&&clearInterval(s)},n)}function le(){if(document.getElementById("lc-channel-widgets-style"))return;const e=document.createElement("style");e.id="lc-channel-widgets-style",e.textContent=`
|
|
1
|
+
var lcChannelWidgets=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?a(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var s={whatsapp:{label:`WhatsApp`,icon:`<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>`,backgroundColor:`#25D366`,prefilledmessage:`Hi, I'd like to learn more.`,mobile:{enabled:!1,url:`https://wa.me/{number}[?text={prefilledmessage}]`},desktop:{enabled:!1,url:`https://web.whatsapp.com/send?phone={number}[&text={prefilledmessage}]`}},sms:{label:`SMS`,icon:`<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 13H6v-2h2v2zm5 0h-2v-2h2v2zm5 0h-2v-2h2v2z"/></svg>`,backgroundColor:`#3478F6`,prefilledmessage:`Hi, I'd like to learn more.`,mobile:{enabled:!1,url:`sms:{number}[?body={prefilledmessage}]`},desktop:{enabled:!1,url:`sms:{number}[?body={prefilledmessage}]`},popover:{title:`Text us — we're available 24/7`,description:`US numbers only. Msg & carrier rates may apply. Reply STOP to opt out.`,buttonLabel:`Start Conversation`}}},c=new Set([`prefilledmessage`]),l=new Map,u=new Map,d=new Map,f=new Set,p=new Set;function m(e,t){let n=u.get(e);n||(n=new Set,u.set(e,n)),n.add(t)}function h(e){let t=u.get(e);if(t)for(let e of t)e.isConnected||t.delete(e)}function g(e,t,n){return t?e?`${e} (ref ${t})`:(p.has(n)||(p.add(n),console.warn(`[lc-channel-widgets] ${n}Config.defaultMessage is empty; emitting bare ref`)),`(ref ${t})`):e||``}function _(e,t){var n,r;let i=((n=window.commversion)==null?void 0:n[`${e}Config`])||void 0;if(i&&t&&i.buttonMessages){let e=i.buttonMessages[t];if(typeof e==`string`)return e}if(i&&typeof i.defaultMessage==`string`)return i.defaultMessage;let a=(r=s[e])==null?void 0:r.prefilledmessage;return typeof a==`string`?a:``}function v(e){var t;let n=e.__lcChannelType,r=d.get(n);if(!(r!=null&&r.urlTemplate)){e.href=`#`;return}let i=g((t=e.__lcBaseMessage)==null?``:t,l.get(n),n),a=o(o({},r.channelData),{},{prefilledmessage:i});e.href=ee(r.urlTemplate,a)}function y(e){window.dispatchEvent(new CustomEvent(`commversion:channel-clicked`,{detail:{channel:e}}))}function b(){let e=Array.from(f);e.length!==0&&window.dispatchEvent(new CustomEvent(`commversion:channels-registered`,{detail:{channels:e}}))}function x(e){var t;let n=((t=window.commversion)==null?void 0:t[`${e.type}Config`])||void 0;if(n!=null&&n.buttonMessages)for(let t of Object.keys(n.buttonMessages)){let n;try{n=document.querySelectorAll(t)}catch(e){console.warn(`[lc-channel-widgets] invalid buttonMessages selector "${t}":`,e);continue}n.forEach(n=>{if(!n.__lcChannelAttached){if(!(n instanceof HTMLAnchorElement)){console.warn(`[lc-channel-widgets] buttonMessages selector "${t}" matched non-<a> element; skipping`);return}n.__lcChannelAttached=e.type,n.__lcChannelType=e.type,n.__lcBaseMessage=_(e.type,t),n.setAttribute(`target`,`_blank`),n.setAttribute(`rel`,`noopener noreferrer`),v(n),m(e.type,n),n.addEventListener(`click`,()=>y(e.type))}})}}window.addEventListener(`commversion:attribution-ready`,()=>{b()}),window.addEventListener(`commversion:shortcode-resolved`,e=>{let{channel:t,shortCode:n}=e.detail||{};if(!t||typeof n!=`string`)return;l.set(t,n),h(t);let r=u.get(t);if(r)for(let e of r)v(e)}),window.addEventListener(`commversion:shortcode-failed`,()=>{});function ee(e,t){return e.replace(/\[([^\]]*)\]/g,(e,n)=>{for(let[,e]of n.matchAll(/\{(\w+)\}/g)){let n=t[e];if(n==null||n===``)return``}return n}).replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];if(r==null)return``;let i=String(r);return c.has(n)?encodeURIComponent(i):i})}var S=e=>e&&typeof e.enabled==`boolean`?{enabled:e.enabled}:{},te=e=>e===!0?!0:e&&typeof e==`object`?e.enabled===!0:!1,C={title:60,description:140,buttonLabel:24},ne=(e,t)=>{if(!e||e===!0||typeof e!=`object`)return{};let n={};return Object.keys(C).forEach(r=>{if(typeof e[r]!=`string`)return;let i=C[r];if(i!=null&&e[r].length>i){console.warn(`[lc-channel-widgets] ${t} popover.${r} exceeds ${i} chars (got ${e[r].length}); using registry default`);return}n[r]=e[r]}),n};function re(e,t){if(!e||typeof e.type!=`string`)return null;let n=s[e.type];if(!n)return null;let r=n[t]||{};return{type:e.type,label:n.label,icon:n.icon,backgroundColor:n.backgroundColor,mobile:o(o({},n.mobile),S(e.mobile)),desktop:o(o({},n.desktop),S(e.desktop)),popover:n.popover&&te(e.popover)?o(o({},n.popover),ne(e.popover,e.type)):void 0,urlTemplate:r.url||``,channelData:e}}var ie=`screen and (max-width: 992px) and (pointer: coarse)`,ae=()=>window.matchMedia(ie).matches?`mobile`:`desktop`,w=[];function T(){for(let e=w.length-1;e>=0;e--){let t=w[e];t!=null&&t.parentNode&&t.remove(),w.splice(e,1)}}var E=!1;function oe(){E||(E=!0,document.addEventListener(`click`,e=>{for(let t of w)t.__isOpen&&!t.contains(e.target)&&J(t)}))}function se(){if(window.__lcHistoryPatched)return;window.__lcHistoryPatched=!0,window.__lcLastUrl=window.__lcLastUrl||location.href;let e=e=>{let t=window.__lcLastUrl,n=location.href,r=t!==n;window.__lcLastUrl=n,!(!r&&e!==`popstate`)&&window.dispatchEvent(new Event(`lc:locationchange`))},t=history.pushState;typeof t==`function`&&(history.pushState=function(...n){let r=t.apply(this,n);return e(`pushState`),r});let n=history.replaceState;typeof n==`function`&&(history.replaceState=function(...t){let r=n.apply(this,t);return e(`replaceState`),r}),window.addEventListener(`popstate`,()=>e(`popstate`)),window.addEventListener(`hashchange`,()=>e(`hashchange`))}function D(e){var t;if(document.__lcVisibilityBound&&!e)return!0;if(typeof((t=window.LiveChatWidget)==null?void 0:t.on)!=`function`)return!1;let n=document.__lcVisibilityCb;if(n&&typeof window.LiveChatWidget.off==`function`)try{window.LiveChatWidget.off(`visibility_changed`,n)}catch(e){}let r=e=>{var t,n,r,i;let a=document.__lcStack;a!=null&&a.isConnected&&(e&&typeof e.visibility==`string`&&(a.__lcVisibility=e.visibility),(t=(n=document).__lcCurrentRebind)==null||t.call(n),(r=(i=document).__lcCurrentSync)==null||r.call(i))};return window.LiveChatWidget.on(`visibility_changed`,r),document.__lcVisibilityCb=r,document.__lcVisibilityBound=!0,!0}function ce(e){if(D(e)||document.__lcVisibilityPolling)return;document.__lcVisibilityPolling=!0;let t=0,n=setInterval(()=>{(D(e)||++t>=200)&&(clearInterval(n),document.__lcVisibilityPolling=!1)},200)}function O(){document.__lcBodyMutationObs||typeof MutationObserver>`u`||(document.__lcBodyMutationObs=new MutationObserver(e=>{let t=document.__lcStack;if(t){for(let{removedNodes:r}of e)if(!(!r||r.length===0))for(let e of r){var n;if(e.nodeType===1&&(e===t||(n=e.contains)!=null&&n.call(e,t))){let e=document.__lcChannelWidgetsConfig;e&&j(e);return}}}}),document.__lcBodyMutationObs.observe(document.body,{childList:!0,subtree:!0}))}var k=null,A=null;function j(e){A=e,!k&&(k=setTimeout(()=>{k=null;let e=A;A=null,$(e)},100))}var M=`#chat-widget-minimized`,N=`#chat-overlay-container`,le=`#chat-overlay-button`,ue=[M,N],P=15,F=100,I=150;function L(e){return{width:e.width,height:e.height,fromLeft:e.left,fromRight:window.innerWidth-e.right,fromTop:e.top,fromBottom:window.innerHeight-e.bottom}}function R(e){let t=e.fromLeft<=e.fromRight,n=e.fromTop<=e.fromBottom,r=t?e.fromLeft:window.innerWidth-e.fromRight-e.width,i=n?e.fromTop:window.innerHeight-e.fromBottom-e.height;return{left:r,top:i,right:r+e.width,bottom:i+e.height,width:e.width,height:e.height}}var z=60;function B(e){let t=window.innerWidth-e.right<=e.left,n=e.bottom,r=n-z,i=t?e.right:e.left+z;return{left:i-z,right:i,top:r,bottom:n,width:z,height:z}}var V=200,H=150;function U(e,t,{interval:n=V,maxRetries:r=H}={}){let i=0,a=setInterval(()=>{let n=document.querySelector(e);if(n){clearInterval(a),t(n);return}++i>=r&&clearInterval(a)},n)}function W(){if(document.getElementById(`lc-channel-widgets-style`))return;let e=document.createElement(`style`);e.id=`lc-channel-widgets-style`,e.textContent=`
|
|
2
2
|
.lc-channel-stack {
|
|
3
3
|
position: fixed;
|
|
4
4
|
top: 0;
|
|
@@ -8,7 +8,7 @@ var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Ob
|
|
|
8
8
|
align-items: center;
|
|
9
9
|
pointer-events: auto;
|
|
10
10
|
/* All position changes go through transform: translate(...) rather
|
|
11
|
-
than top/left so they don't contribute to CLS
|
|
11
|
+
than top/left so they don't contribute to CLS — top/left changes
|
|
12
12
|
are layout shifts; transforms are compositor-only and excluded. */
|
|
13
13
|
will-change: transform;
|
|
14
14
|
/* Sizes are driven inline by syncPosition so widget icons match
|
|
@@ -38,7 +38,7 @@ var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Ob
|
|
|
38
38
|
flex-direction: row;
|
|
39
39
|
}
|
|
40
40
|
/* In-LC mount (mobile). Absolute child of LC's container, so movement
|
|
41
|
-
is inherited in the same paint frame
|
|
41
|
+
is inherited in the same paint frame — no JS positioning, no
|
|
42
42
|
scroll listeners, no transitions on movement. top/left/right are
|
|
43
43
|
set inline by injectChannelStackInContainer. */
|
|
44
44
|
.lc-channel-stack--in-lc {
|
|
@@ -70,7 +70,7 @@ var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Ob
|
|
|
70
70
|
.lc-channel-popover {
|
|
71
71
|
position: fixed;
|
|
72
72
|
/* Anchor at (0,0); visual position is driven entirely by transform
|
|
73
|
-
so repositioning is a compositor matrix update
|
|
73
|
+
so repositioning is a compositor matrix update — no layout pass. */
|
|
74
74
|
top: 0;
|
|
75
75
|
left: 0;
|
|
76
76
|
z-index: 2147483641;
|
|
@@ -83,7 +83,7 @@ var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Ob
|
|
|
83
83
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
84
84
|
/* Pre-promote to own compositor layer. Box-shadow / border-radius /
|
|
85
85
|
text are painted once into the backing store at init; subsequent
|
|
86
|
-
open/close pays only a GPU matrix/alpha update
|
|
86
|
+
open/close pays only a GPU matrix/alpha update — no layout, no paint.
|
|
87
87
|
Declaring BOTH animated properties lets Chrome schedule them in a
|
|
88
88
|
single compositor frame instead of two GPU passes. */
|
|
89
89
|
will-change: opacity, transform;
|
|
@@ -123,7 +123,7 @@ var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Ob
|
|
|
123
123
|
cursor: pointer;
|
|
124
124
|
padding: 4px 6px;
|
|
125
125
|
}
|
|
126
|
-
/* Directional arrow. 12px square rotated 45
|
|
126
|
+
/* Directional arrow. 12px square rotated 45° so half sits outside
|
|
127
127
|
the popover as a triangular tip. Inline left/top is set per open
|
|
128
128
|
so the tip aligns with the trigger button's center. */
|
|
129
129
|
.lc-channel-popover-arrow {
|
|
@@ -142,4 +142,4 @@ var lcChannelWidgets=function(m){"use strict";var Qe=Object.defineProperty,Je=Ob
|
|
|
142
142
|
top: -6px;
|
|
143
143
|
box-shadow: -3px -3px 6px rgba(0, 0, 0, 0.06);
|
|
144
144
|
}
|
|
145
|
-
`,document.head.appendChild(e)}function $e(e,t){if(typeof e!="string"||e.length===0)return null;if(/^(data:|https?:\/\/)/.test(e)){const o=document.createElement("img");return o.className="lc-channel-icon",o.alt=t||"",o.src=e,o}const n=document.createElement("span");n.className="lc-channel-icon",n.setAttribute("aria-hidden","true"),n.innerHTML=e;const i=n.querySelector("svg");return i&&(i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.style.display="block"),n}function se(e,t,n){const a=e.left+e.width/2;let c=e.top-n-12,O="bottom";c<8&&(c=e.bottom+12,O="top"),c+n>window.innerHeight-8&&(c=window.innerHeight-n-8),c<8&&(c=8);let r=a-t/2;r<8&&(r=8),r+t>window.innerWidth-8&&(r=window.innerWidth-t-8);const B=18,I=Math.max(B,t-18),T=Math.max(B,Math.min(I,a-r));return{tx:r,ty:c,arrowSide:O,arrowOffset:T}}function G(e,t,n){e.__appliedArrowSide!==t&&(e.classList.remove("lc-channel-popover--arrow-top","lc-channel-popover--arrow-bottom"),e.classList.add(`lc-channel-popover--arrow-${t}`),e.__appliedArrowSide=t),e.__arrowEl.style.left=`${n-6}px`}function ce(e){const t=e.getBoundingClientRect(),n=t.width>0?t.width:e.__cachedWidth,i=t.height>0?t.height:e.__cachedHeight,o=e.__trigger.getBoundingClientRect(),s=se(o,n,i);e.style.transform=`translate3d(${s.tx}px,${s.ty}px,0)`,G(e,s.arrowSide,s.arrowOffset)}function W(e){e.__isOpen=!1,e.style.opacity="0",e.style.pointerEvents="none",requestAnimationFrame(()=>{e.setAttribute("aria-hidden","true")})}function qe(e){_.forEach(t=>{t!==e&&t.__isOpen&&W(t)}),e.__cachedTransform?(e.style.transform=e.__cachedTransform,e.__arrowSide&&e.__arrowEl&&G(e,e.__arrowSide,e.__arrowOffset)):e.__trigger&&ce(e),e.style.opacity="1",e.style.pointerEvents="auto",requestAnimationFrame(()=>{e.removeAttribute("aria-hidden")}),e.__isOpen=!0}function Ue(e){const t=e.popover,n=document.createElement("div");if(n.className="lc-channel-popover",n.setAttribute("data-popover-channel-id",e.type),t.title){const c=document.createElement("h3");c.className="lc-channel-popover-title",c.textContent=t.title,n.appendChild(c)}if(t.description){const c=document.createElement("p");c.className="lc-channel-popover-description",c.textContent=t.description,n.appendChild(c)}const i=document.createElement("button");i.type="button",i.className="lc-channel-popover-button",i.textContent=t.buttonLabel||"Start Conversation",i.style.backgroundColor=e.backgroundColor||"#1a1a1a",i.onclick=c=>{c.stopPropagation(),typeof e.href=="string"&&e.href.length>0&&window.open(e.href,"_blank","noopener,noreferrer"),W(n)},n.appendChild(i);const o=document.createElement("button");o.type="button",o.className="lc-channel-popover-close",o.setAttribute("aria-label","Close"),o.textContent="\xD7",o.onclick=c=>{c.stopPropagation(),W(n)},n.appendChild(o);const s=document.createElement("div");s.className="lc-channel-popover-arrow",n.appendChild(s),n.__arrowEl=s,n.__isOpen=!1,n.style.opacity="0",n.style.pointerEvents="none",n.setAttribute("aria-hidden","true"),n.style.transform="translate3d(0,0,0)",document.body.appendChild(n);const a=n.getBoundingClientRect();return n.__cachedWidth=a.width>0?a.width:280,n.__cachedHeight=a.height,_.push(n),Oe(),n}function ae(e){const t=document.createElement("div");t.className="lc-channel-button",t.setAttribute("data-channel-id",e.type),e.label&&t.setAttribute("aria-label",e.label),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor);const n=e.popover?Ue(e):null;t.__popoverEl=n,n&&(n.__trigger=t),t.onclick=o=>{if(n){o.stopPropagation(),n.__isOpen?W(n):qe(n);return}typeof e.href=="string"&&e.href.length>0&&window.open(e.href,"_blank","noopener,noreferrer")};const i=$e(e.icon,e.label||e.type);return i&&t.appendChild(i),t}function De(e,t){const n=e==null?void 0:e[t];return n&&typeof n.enabled=="boolean"?n.enabled:t==="mobile"}function X(e,t){const n=Math.max(e.width,e.height),i=Math.min(n,t),o=Math.round(i*.5);return{measured:n,buttonSize:i,iconSize:o}}function de(e,t){const n=[];return e.forEach(i=>{const o=Be(i,t);if(!o){console.warn("[lc-channel-widgets] unknown or invalid channel \u2014 skipping:",i);return}De(o,t)&&n.push(o)}),n}function Fe(e){var A,$,q;const{deviceType:t,chatWidgetSelector:n,channels:i,bubbleSelector:o}=e,s=e[t];if(!document.querySelector(n))return;const c=()=>document.querySelector(n),O=de(i,t);if(O.length===0)return;le();let r=document.body.querySelector(":scope > .lc-channel-stack");r||(K(),r=document.createElement("div"),r.className="lc-channel-stack lc-channel-stack--horizontal",r.style.gap=s.gap,r.setAttribute("role","group"),r.setAttribute("aria-label","Contact channels"),document.body.appendChild(r)),document.__lcStack=r,O.forEach(l=>{r.querySelector(`[data-channel-id="${CSS.escape(l.type)}"]`)||r.appendChild(ae(l))});const B=parseInt(s.gapBelow,10)||8,I=()=>{const l=c();for(let u=0;u<o.length;u++){const h=o[u],b=l&&l.querySelector(h)||document.querySelector(h);if(!b)continue;const w=b.getBoundingClientRect();if(w.width>0&&w.height>0)return w}return null},T=()=>{const l=c(),u=[];for(let h=0;h<o.length;h++){const b=o[h],w=l?l.querySelector(b):null,R=document.querySelector(b);w&&u.indexOf(w)===-1&&u.push(w),R&&R!==w&&u.indexOf(R)===-1&&u.push(R)}return l&&u.indexOf(l)===-1&&u.push(l),u};let H="minimized";try{const l=(q=($=(A=window.LiveChatWidget)==null?void 0:A.get)==null?void 0:$.call(A,"state"))==null?void 0:q.visibility;typeof l=="string"&&(H=l)}catch(l){}r.__lcVisibility=H;const M=()=>{const l=I();l&&r.__lcVisibility==="minimized"&&l.width<=re&&l.height<=re&&window.innerHeight-l.bottom<=We&&(document.__lcBubbleAnchor=Ie(l));let u=null,h=null;if(r.__lcVisibility==="minimized")l&&(u=l,h=l);else if(r.__lcVisibility==="maximized"&&t!=="mobile"){const d=c();if(d){const p=d.getBoundingClientRect();p.width>0&&p.height>0&&(u=p,h=document.__lcBubbleAnchor?Me(document.__lcBubbleAnchor):Ve(p))}}if(!u||!h){for(let d=0;d<_.length;d++)_[d].__isOpen&&W(_[d]);r.style.display="none";return}r.style.display="flex";const{buttonSize:b,iconSize:w}=X(h,t==="mobile"?60:40),R=r.__lcLastButtonSize!==b;R&&(r.style.setProperty("--lc-channel-size",`${b}px`),r.style.setProperty("--lc-channel-icon-size",`${w}px`),r.__lcCachedDims=null,r.__lcLastButtonSize=b);const y=8,pe=r.children.length,he=r.__lcLastButtonCount!==pe;he&&(r.__lcCachedDims=null);const E=r.__lcCachedDims||r.getBoundingClientRect();r.__lcCachedDims=E,r.__lcLastButtonCount=pe;let U,D;if(t==="mobile"){const d=h,p=Math.min(d.height,d.width,80);let x=d.left<window.innerWidth-d.right?d.left+p/2:d.right-p/2;const f=E.width/2;x-f<y&&(x=f+y),x+f>window.innerWidth-y&&(x=window.innerWidth-f-y),U=x-E.width/2,D=d.bottom+B-Re}else{const d=u.left+u.width/2<window.innerWidth/2,p=E.height/2;let L=h.top+h.height/2;L-p<y&&(L=p+y),L+p>window.innerHeight-y&&(L=window.innerHeight-p-y);const x=-p;let f,v;d?(f=u.right+B,f+E.width>window.innerWidth-y&&(f=window.innerWidth-E.width-y),v=0):(f=u.left-B,f-E.width<y&&(f=E.width+y),v=-E.width),U=f+v,D=L+x}const Z=`translate(${U}px, ${D}px)`;!(Z!==r.__lcLastTransform)&&!R&&!he||(r.style.transform=Z,r.__lcLastTransform=Z,r.__lcTransitionActivated||requestAnimationFrame(()=>{r.classList.add("lc-stack-ready"),r.__lcTransitionActivated=!0}),r.querySelectorAll(".lc-channel-button").forEach(d=>{const p=U+d.offsetLeft,L=D+d.offsetTop,x=d.offsetWidth,f=d.offsetHeight;if(d.__cachedRect={left:p,top:L,right:p+x,bottom:L+f,width:x,height:f},d.__popoverEl){const v=d.__popoverEl,{tx:Ye,ty:Ze,arrowSide:fe,arrowOffset:me}=se(d.__cachedRect,v.__cachedWidth,v.__cachedHeight),ge=`translate3d(${Ye}px,${Ze}px,0)`;v.__cachedTransform=ge,v.__arrowSide=fe,v.__arrowOffset=me,v.__isOpen&&(v.style.transform=ge,G(v,fe,me))}}))};let S=0;const z=()=>{S||(S=requestAnimationFrame(()=>{S=0,M()}))};M(),document.__lcCurrentSync=z,document.__lcWindowListenersBound||(window.addEventListener("resize",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)}),window.addEventListener("orientationchange",()=>{var l;document.__lcBubbleAnchor=null,(l=document.__lcCurrentSync)==null||l.call(document)}),window.visualViewport&&(window.visualViewport.addEventListener("resize",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)}),window.visualViewport.addEventListener("scroll",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)})),window.addEventListener("scroll",()=>{var l;return(l=document.__lcCurrentSync)==null?void 0:l.call(document)},!0),document.__lcWindowListenersBound=!0),typeof ResizeObserver!="undefined"&&!r.__lcResizeObserved&&(new ResizeObserver(z).observe(r),r.__lcResizeObserved=!0);const k=()=>{const l=T();if(l.length===0)return;const u=r.__lcObservedBubbles||[];l.length===u.length&&l.every((b,w)=>b===u[w])||(r.__lcBubbleObserver&&r.__lcBubbleObserver.disconnect(),r.__lcObservedBubbles=l,typeof ResizeObserver!="undefined"&&(r.__lcBubbleObserver=new ResizeObserver(z),l.forEach(b=>r.__lcBubbleObserver.observe(b))))};k(),(!r.__lcObservedBubbles||r.__lcObservedBubbles.length===0)&&o.forEach(l=>{N(l,()=>{k(),M()})}),document.__lcCurrentRebind=k,document.__lcVisibilityBound=!1,ke(!0)}function je(e){if(e.style.right&&e.style.right!=="auto")return"right";if(e.style.left&&e.style.left!=="auto")return"left";const t=window.getComputedStyle(e);return t.right!=="auto"?"right":t.left!=="auto"?"left":"right"}function Ge(){document.__lcPopoverVvBound||!window.visualViewport||(document.__lcPopoverVvBound=!0,window.visualViewport.addEventListener("resize",()=>{for(let e=0;e<_.length;e++){const t=_[e];t.__isOpen&&t.__trigger&&ce(t)}}))}function ue(e,t,n){if(!e||e.querySelector(":scope > .lc-channel-stack--in-lc"))return;e.style.overflow="unset";const i=document.createElement("div");i.className="lc-channel-stack lc-channel-stack--horizontal lc-channel-stack--in-lc",i.setAttribute("role","group"),i.setAttribute("aria-label","Contact channels"),i.style.gap=n.mobile.gap;const o=je(e),s=parseInt(n.mobile.gapBelow,10),a=Number.isFinite(s)?s:0,c=parseInt(n.mobile.gapSide,10),O=Number.isFinite(c)?c:8;if(o==="left"?(i.style.left=`${O}px`,i.style.right="auto"):(i.style.right=`${O}px`,i.style.left="auto"),t.forEach(S=>{i.appendChild(ae(S))}),e.appendChild(i),typeof ResizeObserver=="undefined")return;const r=()=>e.querySelector(ie)||e.querySelector(Pe),B=S=>{i.style.marginTop="";const z=()=>{const k=S.getBoundingClientRect(),{measured:A,buttonSize:$,iconSize:q}=X(k,60);if(A===0){i.style.display="none";return}i.style.display="flex",i.style.setProperty("--lc-channel-size",`${$}px`),i.style.setProperty("--lc-channel-icon-size",`${q}px`);const l=e.getBoundingClientRect();i.style.top=`${k.bottom-l.top+a}px`};z(),new ResizeObserver(z).observe(S)},I=r();if(I){B(I);return}i.style.top="100%",i.style.marginTop=`${a}px`;let T=!1;const H=()=>{if(T)return;const S=r();if(S){T=!0,M.disconnect(),B(S);return}const{measured:z,buttonSize:k,iconSize:A}=X(e.getBoundingClientRect(),60);z!==0&&(i.style.setProperty("--lc-channel-size",`${k}px`),i.style.setProperty("--lc-channel-icon-size",`${A}px`))},M=new ResizeObserver(H);H(),T||M.observe(e)}function Xe(e){const t=de(e.channels,"mobile");t.length!==0&&(le(),Ge(),N(e.chatWidgetSelector,n=>{ue(n,t,e),N(oe,i=>ue(i,t,e),{interval:200,maxRetries:15})}))}function Y(e={}){const t=e.channelWidgetsConfig||{},n={gap:"4px",gapBelow:"0px",gapSide:"8px"},i={gap:"8px",gapBelow:"8px"},o={chatWidgetSelector:t.chatWidgetSelector||"#chat-widget-container",bubbleSelector:Te,channels:Array.isArray(t.channels)?t.channels:[],mobile:Object.assign({},n,t.mobile),desktop:Object.assign({},i,t.desktop)},s=Le();if(o.deviceType=s,o.channels.length===0)return;document.__lcChannelWidgetsConfig=e,s==="mobile"?Xe(o):N(o.chatWidgetSelector,()=>{Fe(o),Ae()});const a=()=>{document.__lcBubbleAnchor=null,document.__lcVisibilityBound=!1,K();const c=document.__lcChannelWidgetsConfig;c&&ne(c)};document.__lcChannelWidgetsSpaBound||(ze(),window.addEventListener("lc:locationchange",a),document.__lcChannelWidgetsSpaBound=!0),document.__lcChannelWidgetsTurbolinksBound||(document.addEventListener("turbolinks:load",a),document.__lcChannelWidgetsTurbolinksBound=!0)}return window.commversion=window.commversion||{},window.LiveChatWidget.on("ready",()=>Y(window.commversion)),m.lcAddChannelWidgets=Y,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),m}({});
|
|
145
|
+
`,document.head.appendChild(e)}function de(e,t){if(typeof e!=`string`||e.length===0)return null;if(/^(data:|https?:\/\/)/.test(e)){let n=document.createElement(`img`);return n.className=`lc-channel-icon`,n.alt=t||``,n.src=e,n}let n=document.createElement(`span`);n.className=`lc-channel-icon`,n.setAttribute(`aria-hidden`,`true`),n.innerHTML=e;let r=n.querySelector(`svg`);return r&&(r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`),r.style.display=`block`),n}function G(e,t,n){let r=e.left+e.width/2,i=e.top-n-12,a=`bottom`;i<8&&(i=e.bottom+12,a=`top`),i+n>window.innerHeight-8&&(i=window.innerHeight-n-8),i<8&&(i=8);let o=r-t/2;o<8&&(o=8),o+t>window.innerWidth-8&&(o=window.innerWidth-t-8);let s=Math.max(18,t-18),c=Math.max(18,Math.min(s,r-o));return{tx:o,ty:i,arrowSide:a,arrowOffset:c}}function K(e,t,n){e.__appliedArrowSide!==t&&(e.classList.remove(`lc-channel-popover--arrow-top`,`lc-channel-popover--arrow-bottom`),e.classList.add(`lc-channel-popover--arrow-${t}`),e.__appliedArrowSide=t),e.__arrowEl.style.left=`${n-6}px`}function q(e){let t=e.getBoundingClientRect(),n=t.width>0?t.width:e.__cachedWidth,r=t.height>0?t.height:e.__cachedHeight,i=G(e.__trigger.getBoundingClientRect(),n,r);e.style.transform=`translate3d(${i.tx}px,${i.ty}px,0)`,K(e,i.arrowSide,i.arrowOffset)}function J(e){e.__isOpen=!1,e.style.opacity=`0`,e.style.pointerEvents=`none`,requestAnimationFrame(()=>{e.setAttribute(`aria-hidden`,`true`)})}function fe(e){w.forEach(t=>{t!==e&&t.__isOpen&&J(t)}),e.__cachedTransform?(e.style.transform=e.__cachedTransform,e.__arrowSide&&e.__arrowEl&&K(e,e.__arrowSide,e.__arrowOffset)):e.__trigger&&q(e),e.style.opacity=`1`,e.style.pointerEvents=`auto`,requestAnimationFrame(()=>{e.removeAttribute(`aria-hidden`)}),e.__isOpen=!0}function pe(e){let t=e.popover,n=document.createElement(`div`);if(n.className=`lc-channel-popover`,n.dataset.popoverChannelId=e.type,t.title){let e=document.createElement(`h3`);e.className=`lc-channel-popover-title`,e.textContent=t.title,n.appendChild(e)}if(t.description){let e=document.createElement(`p`);e.className=`lc-channel-popover-description`,e.textContent=t.description,n.appendChild(e)}let r=document.createElement(`a`);r.className=`lc-channel-popover-button`,r.setAttribute(`target`,`_blank`),r.setAttribute(`rel`,`noopener noreferrer`),r.style.textDecoration=`none`,r.style.display=`block`,r.style.textAlign=`center`,r.style.boxSizing=`border-box`,r.textContent=t.buttonLabel||`Start Conversation`,r.style.backgroundColor=e.backgroundColor||`#1a1a1a`,r.__lcChannelType=e.type,r.__lcBaseMessage=_(e.type),v(r),m(e.type,r),r.addEventListener(`click`,t=>{t.stopPropagation(),y(e.type),J(n)}),n.appendChild(r);let i=document.createElement(`button`);i.type=`button`,i.className=`lc-channel-popover-close`,i.setAttribute(`aria-label`,`Close`),i.textContent=`×`,i.onclick=e=>{e.stopPropagation(),J(n)},n.appendChild(i);let a=document.createElement(`div`);a.className=`lc-channel-popover-arrow`,n.appendChild(a),n.__arrowEl=a,n.__isOpen=!1,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`aria-hidden`,`true`),n.style.transform=`translate3d(0,0,0)`,document.body.appendChild(n);let o=n.getBoundingClientRect();return n.__cachedWidth=o.width>0?o.width:280,n.__cachedHeight=o.height,w.push(n),oe(),n}function Y(e){let t=!!e.popover,n=document.createElement(t?`div`:`a`);n.className=`lc-channel-button`,n.dataset.channelId=e.type,e.label&&n.setAttribute(`aria-label`,e.label),e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor);let r=t?pe(e):null;n.__popoverEl=r,r&&(r.__trigger=n),t?n.onclick=e=>{e.stopPropagation(),r.__isOpen?J(r):fe(r)}:(n.setAttribute(`target`,`_blank`),n.setAttribute(`rel`,`noopener noreferrer`),n.style.textDecoration=`none`,n.__lcChannelType=e.type,n.__lcBaseMessage=_(e.type),v(n),m(e.type,n),n.addEventListener(`click`,()=>y(e.type)));let i=de(e.icon,e.label||e.type);return i&&n.appendChild(i),n}function me(e,t){let n=e==null?void 0:e[t];return n&&typeof n.enabled==`boolean`?n.enabled:t===`mobile`}function X(e,t){let n=Math.max(e.width,e.height),r=Math.min(n,t);return{measured:n,buttonSize:r,iconSize:Math.round(r*.5)}}function Z(e,t){let n=[];return e.forEach(e=>{let r=re(e,t);if(!r){console.warn(`[lc-channel-widgets] unknown or invalid channel — skipping:`,e);return}d.set(r.type,r),f.add(r.type),x(r),me(r,t)&&n.push(r)}),b(),n}function he(e){let{deviceType:t,chatWidgetSelector:n,channels:r,bubbleSelector:i}=e,a=e[t];if(!document.querySelector(n))return;let o=()=>document.querySelector(n),s=Z(r,t);if(s.length===0)return;W();let c=document.body.querySelector(`:scope > .lc-channel-stack`);c||(T(),c=document.createElement(`div`),c.className=`lc-channel-stack lc-channel-stack--horizontal`,c.style.gap=a.gap,c.setAttribute(`role`,`group`),c.setAttribute(`aria-label`,`Contact channels`),document.body.appendChild(c)),document.__lcStack=c,s.forEach(e=>{c.querySelector(`[data-channel-id="${CSS.escape(e.type)}"]`)||c.appendChild(Y(e))});let l=Number.parseInt(a.gapBelow,10)||8,u=()=>{let e=o();for(let t of i){let n=(e==null?void 0:e.querySelector(t))||document.querySelector(t);if(!n)continue;let r=n.getBoundingClientRect();if(r.width>0&&r.height>0)return r}return null},d=()=>{let e=o(),t=[];for(let n of i){let r=e?e.querySelector(n):null,i=document.querySelector(n);r&&!t.includes(r)&&t.push(r),i&&i!==r&&!t.includes(i)&&t.push(i)}return e&&!t.includes(e)&&t.push(e),t},f=`minimized`;try{var p,m;let e=(p=window.LiveChatWidget)==null||(m=p.get)==null||(m=m.call(p,`state`))==null?void 0:m.visibility;typeof e==`string`&&(f=e)}catch(e){}c.__lcVisibility=f;let h=()=>{let e=u();e&&c.__lcVisibility===`minimized`&&e.width<=F&&e.height<=F&&window.innerHeight-e.bottom<=I&&(document.__lcBubbleAnchor=L(e));let n=null,r=null;if(c.__lcVisibility===`minimized`)e&&(n=e,r=e);else if(c.__lcVisibility===`maximized`&&t!==`mobile`){let e=o();if(e){let t=e.getBoundingClientRect();t.width>0&&t.height>0&&(n=t,r=document.__lcBubbleAnchor?R(document.__lcBubbleAnchor):B(t))}}if(!n||!r){for(let e of w)e.__isOpen&&J(e);c.style.display=`none`;return}c.style.display=`flex`;let{buttonSize:i,iconSize:a}=X(r,t===`mobile`?60:40),s=c.__lcLastButtonSize!==i;s&&(c.style.setProperty(`--lc-channel-size`,`${i}px`),c.style.setProperty(`--lc-channel-icon-size`,`${a}px`),c.__lcCachedDims=null,c.__lcLastButtonSize=i);let d=c.children.length,f=c.__lcLastButtonCount!==d;f&&(c.__lcCachedDims=null);let p=c.__lcCachedDims||c.getBoundingClientRect();c.__lcCachedDims=p,c.__lcLastButtonCount=d;let m,h;if(t===`mobile`){let e=r,t=Math.min(e.height,e.width,80),n=e.left<window.innerWidth-e.right?e.left+t/2:e.right-t/2,i=p.width/2;n-i<8&&(n=i+8),n+i>window.innerWidth-8&&(n=window.innerWidth-i-8),m=n-p.width/2,h=e.bottom+l-P}else{let e=n.left+n.width/2<window.innerWidth/2,t=p.height/2,i=r.top+r.height/2;i-t<8&&(i=t+8),i+t>window.innerHeight-8&&(i=window.innerHeight-t-8);let a=-t,o,s;e?(o=n.right+l,o+p.width>window.innerWidth-8&&(o=window.innerWidth-p.width-8),s=0):(o=n.left-l,o-p.width<8&&(o=p.width+8),s=-p.width),m=o+s,h=i+a}let g=`translate(${m}px, ${h}px)`;g===c.__lcLastTransform&&!s&&!f||(c.style.transform=g,c.__lcLastTransform=g,c.__lcTransitionActivated||requestAnimationFrame(()=>{c.classList.add(`lc-stack-ready`),c.__lcTransitionActivated=!0}),c.querySelectorAll(`.lc-channel-button`).forEach(e=>{let t=m+e.offsetLeft,n=h+e.offsetTop,r=e.offsetWidth,i=e.offsetHeight;if(e.__cachedRect={left:t,top:n,right:t+r,bottom:n+i,width:r,height:i},e.__popoverEl){let t=e.__popoverEl,{tx:n,ty:r,arrowSide:i,arrowOffset:a}=G(e.__cachedRect,t.__cachedWidth,t.__cachedHeight),o=`translate3d(${n}px,${r}px,0)`;t.__cachedTransform=o,t.__arrowSide=i,t.__arrowOffset=a,t.__isOpen&&(t.style.transform=o,K(t,i,a))}}))},g=0,_=()=>{g||(g=requestAnimationFrame(()=>{g=0,h()}))};h(),document.__lcCurrentSync=_,document.__lcWindowListenersBound||(window.addEventListener(`resize`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)}),window.addEventListener(`orientationchange`,()=>{var e,t;document.__lcBubbleAnchor=null,(e=(t=document).__lcCurrentSync)==null||e.call(t)}),window.visualViewport&&(window.visualViewport.addEventListener(`resize`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)}),window.visualViewport.addEventListener(`scroll`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)})),window.addEventListener(`scroll`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)},!0),document.__lcWindowListenersBound=!0),typeof ResizeObserver<`u`&&!c.__lcResizeObserved&&(new ResizeObserver(_).observe(c),c.__lcResizeObserved=!0);let v=()=>{let e=d();if(e.length===0)return;let t=c.__lcObservedBubbles||[];e.length===t.length&&e.every((e,n)=>e===t[n])||(c.__lcBubbleObserver&&c.__lcBubbleObserver.disconnect(),c.__lcObservedBubbles=e,typeof ResizeObserver<`u`&&(c.__lcBubbleObserver=new ResizeObserver(_),e.forEach(e=>c.__lcBubbleObserver.observe(e))))};v(),(!c.__lcObservedBubbles||c.__lcObservedBubbles.length===0)&&i.forEach(e=>{U(e,()=>{v(),h()})}),document.__lcCurrentRebind=v,document.__lcVisibilityBound=!1,ce(!0)}function ge(e){if(e.style.right&&e.style.right!==`auto`)return`right`;if(e.style.left&&e.style.left!==`auto`)return`left`;let t=window.getComputedStyle(e);return t.right===`auto`?t.left===`auto`?`right`:`left`:`right`}function _e(){document.__lcPopoverVvBound||window.visualViewport&&(document.__lcPopoverVvBound=!0,window.visualViewport.addEventListener(`resize`,()=>{for(let e of w)e.__isOpen&&e.__trigger&&q(e)}))}function Q(e,t,n){if(!e||e.querySelector(`:scope > .lc-channel-stack--in-lc`))return;e.style.overflow=`unset`;let r=document.createElement(`div`);r.className=`lc-channel-stack lc-channel-stack--horizontal lc-channel-stack--in-lc`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,`Contact channels`),r.style.gap=n.mobile.gap;let i=ge(e),a=Number.parseInt(n.mobile.gapBelow,10),o=Number.isFinite(a)?a:0,s=Number.parseInt(n.mobile.gapSide,10),c=Number.isFinite(s)?s:8;if(i===`left`?(r.style.left=`${c}px`,r.style.right=`auto`):(r.style.right=`${c}px`,r.style.left=`auto`),t.forEach(e=>{r.appendChild(Y(e))}),e.appendChild(r),typeof ResizeObserver>`u`)return;let l=()=>e.querySelector(M)||e.querySelector(le),u=t=>{r.style.marginTop=``;let n=()=>{let n=t.getBoundingClientRect(),{measured:i,buttonSize:a,iconSize:s}=X(n,60);if(i===0){r.style.display=`none`;return}r.style.display=`flex`,r.style.setProperty(`--lc-channel-size`,`${a}px`),r.style.setProperty(`--lc-channel-icon-size`,`${s}px`);let c=e.getBoundingClientRect();r.style.top=`${n.bottom-c.top+o}px`};n(),new ResizeObserver(n).observe(t)},d=l();if(d){u(d);return}r.style.top=`100%`,r.style.marginTop=`${o}px`;let f=!1,p=()=>{if(f)return;let t=l();if(t){f=!0,m.disconnect(),u(t);return}let{measured:n,buttonSize:i,iconSize:a}=X(e.getBoundingClientRect(),60);n!==0&&(r.style.setProperty(`--lc-channel-size`,`${i}px`),r.style.setProperty(`--lc-channel-icon-size`,`${a}px`))},m=new ResizeObserver(p);p(),f||m.observe(e)}function ve(e){let t=Z(e.channels,`mobile`);t.length!==0&&(W(),_e(),U(e.chatWidgetSelector,n=>{Q(n,t,e),U(N,n=>Q(n,t,e),{interval:200,maxRetries:15})}))}function $(e={}){let t=e.channelWidgetsConfig||{},n={chatWidgetSelector:t.chatWidgetSelector||`#chat-widget-container`,bubbleSelector:ue,channels:Array.isArray(t.channels)?t.channels:[],mobile:o(o({},{gap:`4px`,gapBelow:`0px`,gapSide:`8px`}),t.mobile),desktop:o(o({},{gap:`8px`,gapBelow:`8px`}),t.desktop)},r=ae();if(n.deviceType=r,n.channels.length===0)return;document.__lcChannelWidgetsConfig=e,r===`mobile`?ve(n):U(n.chatWidgetSelector,()=>{he(n),O()});let i=()=>{document.__lcBubbleAnchor=null,document.__lcVisibilityBound=!1,T();let e=document.__lcChannelWidgetsConfig;e&&j(e)};document.__lcChannelWidgetsSpaBound||(se(),window.addEventListener(`lc:locationchange`,i),document.__lcChannelWidgetsSpaBound=!0),document.__lcChannelWidgetsTurbolinksBound||(document.addEventListener(`turbolinks:load`,i),document.__lcChannelWidgetsTurbolinksBound=!0)}return window.commversion=window.commversion||{},window.LiveChatWidget.on(`ready`,()=>$(window.commversion)),e.lcAddChannelWidgets=$,e})({});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(){
|
|
1
|
+
(function(){var e=`screen and (max-width: 992px) and (pointer: coarse)`,t=()=>window.matchMedia(e).matches?`mobile`:`desktop`;function n(e){let n=document.querySelector(e.chatWidgetSelector),r=document.querySelector(e.bannerSelector);if(!n){console.warn(`Chat widget not found.`);return}let i=r&&(e.bannerHiddenClass?!r.classList.contains(e.bannerHiddenClass):r.offsetParent!==null),a=document.getElementById(`chat-widget-style`);if(i){let n=t()===`mobile`?e.bottomOffsetMobile:e.bottomOffset;a||(a=document.createElement(`style`),a.id=`chat-widget-style`,document.head.appendChild(a)),a.innerHTML=`
|
|
2
2
|
${e.chatWidgetSelector} {
|
|
3
|
-
bottom: ${
|
|
3
|
+
bottom: ${n} !important;
|
|
4
4
|
transition: bottom 0.5s ease-in-out;
|
|
5
5
|
}
|
|
6
|
-
`,console.log(
|
|
6
|
+
`,console.log(`Chat widget realigned: Above banner`)}else a?(a.remove(),console.log(`Chat widget realigned: Style removed (default position)`)):console.log(`Chat widget realigned: Default (no style present)`)}function r(e,t=0){let i=document.querySelector(e.chatWidgetSelector),a=document.querySelector(e.bannerSelector),o=e.cookieBannerMaxRetries;i&&a?(console.log(`Cookie banner detected. Aligning chat widget...`),n(e),e.buttonSelectors.forEach((t,r)=>{let i=document.querySelector(t);i&&!i.__listenerAdded&&(console.log(`Adding event listener to button ${r+1} (${t})...`),i.addEventListener(`click`,()=>{console.log(`Button clicked: ${t}`),setTimeout(()=>n(e),500)}),i.__listenerAdded=!0)})):t<o?(console.log(`Retrying to find cookie banner... Attempt ${t+1}`),setTimeout(()=>r(e,t+1),250)):console.warn(`Max retries reached. Cookie banner not found.`)}function i(e={}){let t=e.cookieBannerConfig||{},n={chatWidgetSelector:t.chatWidgetSelector||`#chat-widget-container`,bannerSelector:t.bannerSelector||`.cookie-banner`,bannerHiddenClass:t.bannerHiddenClass||null,bottomOffset:t.bottomOffset||`80px`,bottomOffsetMobile:t.bottomOffsetMobile||`80px`,buttonSelectors:t.buttonSelectors||[],cookieBannerMaxRetries:typeof t.cookieBannerMaxRetries==`number`?t.cookieBannerMaxRetries:5};console.log(`LiveChatWidget is ready. Initializing chat widget alignment...`),r(n)}window.commversion=window.commversion||{},window.LiveChatWidget.on(`ready`,i(window.commversion))})();
|
package/dist/lc-device.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){
|
|
1
|
+
(function(){var e=`screen and (max-width: 992px) and (pointer: coarse)`,t=()=>window.matchMedia(e).matches?`mobile`:`desktop`;window.commversion=window.commversion||{},window.LiveChatWidget.on(`ready`,(e=>()=>{let{LiveChatWidget:e}=window,n=t();e.call(`update_session_variables`,{device:n})})(window.commversion))})();
|