@usereq/widget 0.2.24 → 1.0.0-experimental.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -145
- package/dist/embed.js +38 -0
- package/dist/embed.js.map +1 -0
- package/dist/embed.mjs +2839 -0
- package/dist/embed.mjs.map +1 -0
- package/package.json +35 -81
- package/dist/widget.js +0 -255
- package/src/chat-widget/chat-widget-appearance.ts +0 -55
- package/src/chat-widget/message-reveal.ts +0 -52
- package/src/chat-widget/stop-confirmation.ts +0 -288
- package/src/custom-element/agent-widget-element.tsx +0 -676
- package/src/embed.ts +0 -8
- package/src/index.ts +0 -9
- package/src/register.ts +0 -15
- package/src/renderer/index.ts +0 -6
- package/src/renderer/widget-runtime.tsx +0 -385
- package/src/runtime/api-origin.ts +0 -29
- package/src/runtime/api.ts +0 -123
- package/src/runtime/bootstrap.ts +0 -366
- package/src/runtime/debug.ts +0 -104
- package/src/runtime/messages.ts +0 -12
- package/src/runtime/session-storage.ts +0 -32
- package/src/runtime/trigger-rule.ts +0 -182
- package/src/shared/shadow-css.ts +0 -15
- package/src/shared/shadow-theme.ts +0 -115
- package/src/shared/stop-confirmation.ts +0 -20
- package/src/shared/widget-config.ts +0 -171
- package/src/styles/widget.css.ts +0 -83
- package/src/types.ts +0 -98
- package/src/vite-env.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,166 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@usereq/widget` (the `experimental` line)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The script a customer's page loads. It renders a published surface - a chat (bubble, chatbar, box, stream), a banner, a testimonial card, an exit popup - or a group of them, and talks to the surface's agent through `apps/api`. Published to npm as `@usereq/widget` - the previous platform's package name, reused for its scope and publish lane - under the **`experimental` dist-tag** (`1.0.0-experimental.N`); `latest` (0.2.x) stays the old `<usereq-agent-widget>` script, which the pages pasted before this runtime load unpinned. The dashboard's install snippet points at `https://unpkg.com/@usereq/widget@experimental` (`NEXT_PUBLIC_EMBED_SCRIPT_URL`), pinned to the tag so a publish never requires a merchant to re-paste and never reaches those older pages.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Plan: `docs/embed-ui-runtime-plan.md`. The rule for every pixel: **the surface renders the way the dashboard preview promised it** (`apps/app/feats/widgets/components/widget-preview.tsx`) - the styles are lifted number for number, and a change to one is a change to both.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Embed browser IIFE bundle generated at root `dist/widget.js`.
|
|
7
|
+
## On a page
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- `src` (core, shared, runtime, custom-element, embed entry)
|
|
15
|
-
- `dist` (built embed artifact; created by `bun run build`)
|
|
16
|
-
- `tsconfig.json` (global TS config)
|
|
17
|
-
- `.env.example` (optional local env template; not loaded automatically—copy to `.env` / `.env.production` as needed)
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
|
|
21
|
-
- [Bun](https://bun.sh/) 1.2+ (matches `packageManager` in `package.json`)
|
|
22
|
-
- npm CLI for publishing (`npm whoami`, `npm publish`)
|
|
23
|
-
- npm account with publish permission to the `@usereq` scope (or change the package `name` before publishing elsewhere)
|
|
24
|
-
|
|
25
|
-
## Environment variables
|
|
26
|
-
|
|
27
|
-
These matter when you run **`bun run build`** (specifically the Vite embed step). Vite reads them from the repo root via `.env`, `.env.local`, `.env.production`, `.env.production.local`, and so on (see [Vite env files](https://vitejs.dev/guide/env-and-mode.html#env-files)). `vite build` uses mode **`production`**, so `.env.production` is the usual place for release API URLs.
|
|
28
|
-
|
|
29
|
-
| Variable | When set | Effect |
|
|
30
|
-
| ---------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
-
| `USEREQ_WIDGET_DEV_API_BASE` | Embed build | Highest-priority API origin (useful for dev-tag releases). If set, it overrides `USEREQ_WIDGET_API_BASE`. |
|
|
32
|
-
| `USEREQ_WIDGET_API_BASE` | Embed build | Preferred API origin string inlined into `dist/widget.js` (no trailing slash normalization at build time; the runtime trims and strips trailing slashes). |
|
|
33
|
-
| `NEXT_PUBLIC_API_URL` | Embed build | Used only if `USEREQ_WIDGET_API_BASE` is empty—handy if you already define this in a Next.js monorepo. |
|
|
34
|
-
| _(neither set)_ | Embed build | Falls back to `http://localhost:3000` in the Vite config. |
|
|
35
|
-
|
|
36
|
-
**Runtime `globalThis` (advanced):** `getWidgetApiBase()` (see `src/runtime/api-origin.ts`) prefers the compile-time `__USEREQ_WIDGET_API_BASE__` value when it is non-empty after trimming. The Vite embed build always defines that symbol to a non-empty string (see defaults above), so **changing the API URL for the published `dist/widget.js` requires a rebuild with a different `USEREQ_WIDGET_API_BASE`**. The `globalThis.__USEREQ_WIDGET_API_BASE__` path mainly applies when consuming source from this package without inlining a base URL (for example your own bundler without that `define`). If nothing resolves, the function falls back to `http://localhost:4000`.
|
|
37
|
-
|
|
38
|
-
Example for a production embed build:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
USEREQ_WIDGET_API_BASE=https://api.example.com bun run build
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Or create `.env.production` in the repo root (gitignored by default; copy from `.env.example`).
|
|
45
|
-
|
|
46
|
-
## Install
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
bun install
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Development
|
|
53
|
-
|
|
54
|
-
Typecheck:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
bun run typecheck
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Build core + embed:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
bun run build
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Build individual targets:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
bun run build:core
|
|
70
|
-
bun run build:embed
|
|
9
|
+
```html
|
|
10
|
+
<usereq-widget widget-id="01a0…"></usereq-widget>
|
|
11
|
+
<script src="https://unpkg.com/@usereq/widget@experimental" async></script>
|
|
71
12
|
```
|
|
72
13
|
|
|
73
|
-
|
|
14
|
+
`<usereq-group group-id="…">` for a group. Every surface but one floats over the page, so the tag can go anywhere (the snippet says before `</body>`); a chat **box** renders in the flow at the tag's spot, as wide as whatever holds it - the tag is its placement, there is no selector. Optional attributes: `api-url` (a staging API; the dev host page uses it) and `theme="light|dark"` when sampling the page's background would lie about the ground the surface sits on.
|
|
74
15
|
|
|
75
|
-
|
|
76
|
-
- Embed bundle is emitted at root `dist/widget.js` (plus css artifact if emitted).
|
|
16
|
+
The element fetches `GET /api/embed/{kind}/{id}` on connect, checks the envelope (`guard.ts`, a hand-written shape check - no zod on a merchant page), and mounts into its own open shadow root. Nothing throws onto the page: no live snapshot, a page off the org's verified domains, a network that is down - each is one `console.warn("[usereq] …")` and an empty element.
|
|
77
17
|
|
|
78
|
-
|
|
18
|
+
Importing the module instead gives `render(snapshot, host, { apiUrl?, theme?, silent? })` for a page that has the payload in hand (the dashboard's preview, once it swaps to the runtime - plan E3). `silent` keeps events off the wire.
|
|
79
19
|
|
|
80
|
-
|
|
20
|
+
## What it does with a payload
|
|
81
21
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
For CDN/script usage, use:
|
|
92
|
-
|
|
93
|
-
- unpkg: `https://unpkg.com/@usereq/widget/dist/widget.js`
|
|
94
|
-
- jsDelivr: `https://cdn.jsdelivr.net/npm/@usereq/widget/dist/widget.js`
|
|
95
|
-
|
|
96
|
-
The embed entry automatically registers `<usereq-agent-widget>`.
|
|
97
|
-
|
|
98
|
-
## Publish guide
|
|
99
|
-
|
|
100
|
-
Publish once from this repo root. The package is **scoped** (`@usereq/widget`); `publishConfig.access` is already `public`.
|
|
101
|
-
|
|
102
|
-
### 1) Login and verify permissions
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
npm whoami
|
|
106
|
-
# If needed:
|
|
107
|
-
npm login
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Ensure you are logged in as a user or CI token that is allowed to publish under the `@usereq` scope on npm.
|
|
22
|
+
| Piece | Where | Does |
|
|
23
|
+
| ------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| Look | `appearance.ts` | accent, alpha → fill, readable text colour, radius, glass skin, position - the preview's arithmetic, pure; `isMessenger` when a bubble carries `preset: "facebook-messenger"`, and `surfaces/chat-messenger.tsx` draws it from `@workspace/contracts/embed/presets` instead (the accent, alpha and radius go unused; placement, the content and the parts still apply) |
|
|
25
|
+
| Rules | `rules.ts`, `surface.tsx` | the payload's ENABLED rules in priority order; the first whose conditions fit the page (path, utm, device, referrer) arms its trigger (`page_load`, `time_on_page`, `scroll_depth`, `element_click`, `element_visible`, `exit_intent`); when it fires the surface **shows** - the dashboard's sentence is "When …, show <surface>", so a firing is the show, `autoStart` puts the visitor in the composer, `pinned` takes the close away. `once` is remembered per visit in `sessionStorage`. No rules: the surface rests - a bubble's launcher alone, a banner or a testimonial straight away, a popup on exit intent |
|
|
26
|
+
| Groups | `group.ts`, `mount.tsx` | the group's rules say when it plays; `split` picks a member by weight and remembers the bucket (`localStorage`), `sequence` walks the lineup on each member's `advanceOn` and remembers the step |
|
|
27
|
+
| Chat | `chat/use-conversation.ts`, `stream.ts`, `api.ts` | `POST /api/embed/sessions` on the first send, then `POST /api/embed/chat` - the AI SDK UI-message stream read by hand (`stream.ts`), one bubble per paragraph on the preview's reveal clock (`@workspace/contracts/embed/reveal`); Stop aborts, Retry regenerates; a refused session (401/409) is minted anew on the next send |
|
|
28
|
+
| Events | `events.ts` | `embed.loaded`, `surface.opened/closed`, `rule.fired`, `cta.clicked`, … batched to `POST /api/embed/events` with client-minted uuidv7 ids (the server's dedupe key) and a per-browser visitor key |
|
|
29
|
+
| Styling hooks | `base.css.ts`, `appearance.ts` | a static base sheet in the shadow root, then the customer's: `appearance.parts` adds their class beside the runtime's `uq-<part>` on each named part, `appearance.customCss` is appended as-is, a block's `css` is scoped to that block's element |
|
|
111
30
|
|
|
112
|
-
|
|
31
|
+
Storage keys, all optional conveniences that degrade to "forgotten" (`storage.ts` never throws): `usereq:visitor` (localStorage), `usereq:once:<ruleId>` (sessionStorage), `usereq:split:<groupId>`, `usereq:seq:<groupId>`.
|
|
113
32
|
|
|
114
|
-
|
|
33
|
+
On a phone (`max-width: 639px`, live through `matchMedia`, `drawer.tsx`): the bubble's panel is a bottom sheet at half the screen instead of a card beside the launcher. The grab bar drags it to full height or, past the bottom, away; a flick decides on its own; the header gains a close button; the launcher hides while the sheet is up. A pinned surface never closes - the drag down settles at half. Heights are percentages of the viewport as it is (under a collapsing address bar or a keyboard), not `vh`. The chatbar is already a bottom strip and the stream keeps floating; the exit popup's card scrolls inside itself on a short screen.
|
|
115
34
|
|
|
116
|
-
|
|
35
|
+
## Working on it
|
|
117
36
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
bun run typecheck
|
|
126
|
-
bun run build
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Confirm `dist/widget.js` exists (the `files` field includes `dist` and `src`).
|
|
130
|
-
|
|
131
|
-
### 5) Sanity check contents (optional)
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
npm pack --dry-run
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### 6) Publish
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
npm publish
|
|
37
|
+
```sh
|
|
38
|
+
bun run dev # vite on :5173, opens /dev/ - a host page that mounts a surface by id against a local API
|
|
39
|
+
bun test # rules, the stream reader, the look
|
|
40
|
+
bun run build # dist/embed.js (IIFE, the snippet) + dist/embed.mjs (ESM) + sourcemaps
|
|
41
|
+
bun run size # the gzip gate - fails the build over 25 kB
|
|
141
42
|
```
|
|
142
43
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
### 7) Verify
|
|
44
|
+
The dev host page takes `?id=…&kind=widget|group&bg=light|dark|photo&api=http://localhost:4000`, plus `variant=bubble|chatbar|box|stream` and `preset=default|facebook-messenger` to render a chat surface as another variant or under a preset (the real snapshot with `config.variant` / `config.preset` swapped, through `render`) - every look from one published surface. The origin gate is open for an org with no verified domain; with one, run `apps/api` with `DASHBOARD_ORIGIN=http://localhost:5173` or add `localhost` to the list.
|
|
146
45
|
|
|
147
|
-
|
|
148
|
-
npm view @usereq/widget version
|
|
149
|
-
```
|
|
46
|
+
`USEREQ_EMBED_API_URL` at build time bakes the default API origin (`https://api.usereq.com` otherwise); `api-url` on the element overrides it per mount.
|
|
150
47
|
|
|
151
|
-
|
|
48
|
+
## Publishing
|
|
152
49
|
|
|
153
|
-
-
|
|
154
|
-
- **Publish** (`.github/workflows/publish.yml`): runs when you push tags matching:
|
|
155
|
-
- `v*` (for example `v0.2.0`) → publishes to npm default `latest` tag.
|
|
156
|
-
- `dev-v*` (for example `dev-v0.2.0-dev.1`) → publishes to npm `dev` dist-tag.
|
|
157
|
-
Configure repository secrets:
|
|
158
|
-
- **`NPM_TOKEN`** (required): npm automation token able to publish `@usereq/widget`.
|
|
159
|
-
- **`USEREQ_WIDGET_API_BASE`** (optional): production API base for normal `v*` releases.
|
|
160
|
-
- **`USEREQ_WIDGET_DEV_API_BASE`** (optional): dev API base used by `dev-v*` releases.
|
|
161
|
-
- For `dev-v*` publishes, keep `package.json` `version` unique (for example prerelease versions like `0.2.0-dev.1`), because npm does not allow publishing the same version twice even with different dist-tags.
|
|
50
|
+
Bump `version` in `package.json` (`1.0.0-experimental.N`, the next N), push a tag `embed-v<version>`; `.github/workflows/publish-embed.yml` checks the tag against the version, refuses a version that is not an experimental prerelease, runs the typecheck, the tests, the build and the size gate, then `npm publish --access public --tag experimental` (`files: ["dist"]`; no provenance - npm only attests public source repositories and this one is private). Authentication is npm trusted publishing: `@usereq/widget` on npmjs.com names `UserEQ/usereq-app` and `publish-embed.yml` as a trusted publisher, and the run's OIDC token is exchanged for a publish token, so no secret is stored or expires - the workflow carries no `NPM_TOKEN` at all. Taking `latest` - `1.0.0`, the snippet on `@1` - is the day the old element is retired: a product decision, not a release step. The dashboard's snippet follows `NEXT_PUBLIC_EMBED_SCRIPT_URL`.
|
|
162
51
|
|
|
163
|
-
##
|
|
52
|
+
## Not here yet
|
|
164
53
|
|
|
165
|
-
-
|
|
166
|
-
-
|
|
54
|
+
- The editor's preview still renders the React mock; swapping it for `render()` is plan E3.
|
|
55
|
+
- The escalation exit (`payload.escalation`) is carried, not rendered.
|
|
56
|
+
- A media block's `src` is an upload KEY; the runtime shows it only when it is already an `http(s)` URL. The API has to hand back a URL before uploads appear on a page.
|
package/dist/embed.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var UserEQ=(function(ke){Object.defineProperty(ke,Symbol.toStringTag,{value:"Module"});async function Kt(e){const t=e.getReader(),n=new TextDecoder;let r="",o="";const i=[],s=new Map,u=d=>{if(!d.startsWith("data:"))return;const c=d.slice(5).trim();if(!c||c==="[DONE]")return;let f;try{f=JSON.parse(c)}catch{return}switch(f.type){case"start":"messageId"in f&&f.messageId&&(o=f.messageId);break;case"text-start":"id"in f&&(i.push(f.id),s.set(f.id,""));break;case"text-delta":if("id"in f&&"delta"in f){var p;s.set(f.id,((p=s.get(f.id))!==null&&p!==void 0?p:"")+f.delta)}break;case"error":throw new Error("errorText"in f?f.errorText:"The reply failed.");case"abort":throw new Error("The reply was cut short.")}};for(;;){const{done:d,value:c}=await t.read();if(d)break;r+=n.decode(c,{stream:!0});let f;for(;(f=r.indexOf(`
|
|
2
|
+
`))!==-1;)u(r.slice(0,f).replace(/\r$/,"")),r=r.slice(f+1)}return r&&u(r),{id:o||`reply-${Date.now()}`,parts:i.map(d=>{var c;return(c=s.get(d))!==null&&c!==void 0?c:""})}}function V(e){"@babel/helpers - typeof";return V=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(e)}function Xt(e,t){if(V(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(V(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jt(e){var t=Xt(e,"string");return V(t)=="symbol"?t:t+""}function Se(e,t,n){return(t=Jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var te=class extends Error{constructor(e,t,n){super(n),Se(this,"status",void 0),Se(this,"code",void 0),this.status=e,this.code=t}};async function $e(e){let t="request_failed",n=`The request failed (${e.status}).`;try{var r,o;const i=await e.json();!((r=i.error)===null||r===void 0)&&r.code&&(t=i.error.code),!((o=i.error)===null||o===void 0)&&o.message&&(n=i.error.message)}catch{}throw new te(e.status,t,n)}var Ce=(e,t={})=>({method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(e)});async function Qt(e,t,n){const r=await fetch(`${e.base}/api/embed/${t}/${n}`);return r.ok?r.json():$e(r)}async function Zt(e,t){const n=await fetch(`${e.base}/api/embed/sessions`,Ce(t));return n.ok?n.json():$e(n)}async function en(e,t,n,r,o){const i=await fetch(`${e.base}/api/embed/chat`,{...Ce({message:{id:n.id,role:"user",parts:[{type:"text",text:n.text}]},trigger:r},{Authorization:`Bearer ${t}`}),signal:o});return!i.ok||!i.body?$e(i):Kt(i.body)}async function tn(e,t){try{const n=await fetch(`${e.base}/api/embed/events`,{...Ce(t),keepalive:!0});return n.ok?await n.json():null}catch{return null}}var N=e=>typeof e=="object"&&e!==null;function Ve(e){return N(e)&&typeof e.id=="string"&&N(e.config)&&typeof e.config.type=="string"&&N(e.config.appearance)&&Array.isArray(e.rules)}function nn(e){return N(e)&&typeof e.id=="string"&&typeof e.mode=="string"&&N(e.config)&&Array.isArray(e.members)&&e.members.every(t=>N(t)&&Ve(t.widget))&&Array.isArray(e.rules)}function rn(e,t){return!N(e)||e.kind!==t?null:t==="widget"&&Ve(e.payload)||t==="group"&&nn(e.payload)?e:null}var ne,$,Ke,on,D,Xe,Je,Qe,qe,re,K,Ze,Ie,Me,Te,an,ie={},oe=[],sn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ae=Array.isArray;function B(e,t){for(var n in t)e[n]=t[n];return e}function Ae(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ln(e,t,n){var r,o,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?ne.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return se(e,s,r,o,null)}function se(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o==null?++Ke:o,__i:-1,__u:0};return o==null&&$.vnode!=null&&$.vnode(i),i}function L(e){return e.children}function le(e,t){this.props=e,this.context=t}function O(e,t){if(t==null)return e.__?O(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?O(e):null}function cn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=B({},t);i.__v=t.__v+1,$.vnode&&$.vnode(i),Ee(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n==null?O(t):n,!!(32&t.__u),o),i.__v=t.__v,i.__.__k[i.__i]=i,st(r,i,o),t.__e=t.__=null,i.__e!=n&&et(i)}}function et(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),et(e)}function tt(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!ce.__r++||Xe!=$.debounceRendering)&&((Xe=$.debounceRendering)||Je)(ce)}function ce(){try{for(var e,t=1;D.length;)D.length>t&&D.sort(Qe),e=D.shift(),t=D.length,cn(e)}finally{D.length=ce.__r=0}}function nt(e,t,n,r,o,i,s,u,d,c,f){var p,l,h,m,y,w,_=r&&r.__k||oe,g=t.length;for(d=un(n,t,_,d,g),p=0;p<g;p++)(h=n.__k[p])!=null&&(l=h.__i!=-1&&_[h.__i]||ie,h.__i=p,w=Ee(e,h,l,o,i,s,u,d,c,f),m=h.__e,h.ref&&l.ref!=h.ref&&(l.ref&&ze(l.ref,null,h),f.push(h.ref,h.__c||m,h)),y==null&&m!=null&&(y=m),4&h.__u?(d=rt(h,d,e),l.__e&&(l.__e=null)):typeof h.type=="function"&&w!==void 0?d=w:m&&(d=m.nextSibling),h.__u&=-7);return n.__e=y,d}function un(e,t,n,r,o){var i,s,u,d,c,f=n.length,p=f,l=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=se(null,s,null,null,null):ae(s)?s=e.__k[i]=se(L,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=se(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,d=i+l,s.__=e,s.__b=e.__b+1,u=null,(c=s.__i=dn(s,n,d,p))!=-1&&(p--,(u=n[c])&&(u.__u|=2)),u==null||u.__v==null?(c==-1&&(o>f?l--:o<f&&l++),typeof s.type!="function"&&(s.__u|=4)):c!=d&&(c==d-1?l--:c==d+1?l++:(c>d?l--:l++,s.__u|=4))):e.__k[i]=null;if(p)for(i=0;i<f;i++)(u=n[i])!=null&&(2&u.__u)==0&&(u.__e==r&&(r=O(u)),ct(u,u));return r}function rt(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=rt(r[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=O(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function dn(e,t,n,r){var o,i,s,u=e.key,d=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&u==null||f&&u==c.key&&d==c.type)return n;if(r>(f?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((c=t[s=o>=0?o--:i++])!=null&&(2&c.__u)==0&&u==c.key&&d==c.type)return s}return-1}function it(e,t,n){t[0]=="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||sn.test(t)?n:n+"px"}function ue(e,t,n,r,o){var i,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||it(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||it(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ze,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[K]=r[K]:(n[K]=Ie,e.addEventListener(t,i?Te:Me,i)):e.removeEventListener(t,i?Te:Me,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ot(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[re]==null)t[re]=Ie++;else if(t[re]<n[K])return;return n($.event?$.event(t):t)}}}function Ee(e,t,n,r,o,i,s,u,d,c){var f,p,l,h,m,y,w,_,g,v,k,x,q,C,z,H,E=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),i=[u=t.__e=n.__e]),(f=$.__b)&&f(t);e:if(typeof E=="function"){p=s.length;try{if(g=t.props,v=E.prototype&&E.prototype.render,k=(f=E.contextType)&&r[f.__c],x=f?k?k.props.value:f.__:r,n.__c?_=(l=t.__c=n.__c).__=l.__E:(v?t.__c=l=new E(g,x):(t.__c=l=new le(g,x),l.constructor=E,l.render=hn),k&&k.sub(l),l.state||(l.state={}),l.__n=r,h=l.__d=!0,l.__h=[],l._sb=[]),v&&l.__s==null&&(l.__s=l.state),v&&E.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=B({},l.__s)),B(l.__s,E.getDerivedStateFromProps(g,l.__s))),m=l.props,y=l.state,l.__v=t,h)v&&E.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),v&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(v&&E.getDerivedStateFromProps==null&&g!==m&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(g,x),t.__v==n.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(g,l.__s,x)===!1){t.__v!=n.__v&&(l.props=g,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(R){R&&(R.__=t)}),oe.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&s.push(l),u=O(n);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(g,l.__s,x),v&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(m,y,w)})}if(l.context=x,l.props=g,l.__P=e,l.__e=!1,q=$.__r,C=0,v)l.state=l.__s,l.__d=!1,q&&q(t),f=l.render(l.props,l.state,l.context),oe.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,q&&q(t),f=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++C<25);l.state=l.__s,l.getChildContext!=null&&(r=B(B({},r),l.getChildContext())),v&&!h&&l.getSnapshotBeforeUpdate!=null&&(w=l.getSnapshotBeforeUpdate(m,y)),z=f!=null&&f.type===L&&f.key==null?lt(f.props.children):f,u=nt(e,ae(z)?z:[z],t,n,r,o,i,s,u,d,c),l.base=t.__e,t.__u&=-161,l.__h.length&&s.push(l),_&&(l.__E=l.__=null)}catch(R){if(s.length=p,t.__v=null,d||i!=null){if(R.then){for(t.__u|=d?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;i!=null&&(i[i.indexOf(u)]=null),t.__e=u}else if(i!=null)for(H=i.length;H--;)Ae(i[H])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),R.then||at(t),$.__e(R,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):u=t.__e=fn(n.__e,t,n,r,o,i,s,d,c);return(f=$.diffed)&&f(t),128&t.__u?void 0:u}function at(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(at))}function st(e,t,n){for(var r=0;r<n.length;r++)ze(n[r],n[++r],n[++r]);$.__c&&$.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){$.__e(i,o.__v)}})}function lt(e){return typeof e!="object"||e==null||e.__b>0?e:ae(e)?e.map(lt):e.constructor!==void 0?null:B({},e)}function fn(e,t,n,r,o,i,s,u,d){var c,f,p,l,h,m,y,w=n.props||ie,_=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((h=i[c])&&"setAttribute"in h==!!g&&(g?h.localName==g:h.nodeType==3)){e=h,i[c]=null;break}}if(e==null){if(g==null)return document.createTextNode(_);e=document.createElementNS(o,g,_.is&&_),u&&($.__m&&$.__m(t,i),u=!1),i=null}if(g==null)w===_||u&&e.data==_||(e.data=_);else{if(i=g=="textarea"&&_.defaultValue!=null?null:i&&ne.call(e.childNodes),!u&&i!=null)for(w={},c=0;c<e.attributes.length;c++)w[(h=e.attributes[c]).name]=h.value;for(c in w)h=w[c],c=="dangerouslySetInnerHTML"?p=h:c=="children"||c in _||c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _||ue(e,c,null,h,o);for(c in _)h=_[c],c=="children"?l=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?m=h:c=="checked"?y=h:u&&typeof h!="function"||w[c]===h||ue(e,c,h,w[c],o);if(f)u||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=""),nt(t.type=="template"?e.content:e,ae(l)?l:[l],t,n,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:n.__k&&O(n,0),u,d),i!=null)for(c=i.length;c--;)Ae(i[c]);u&&g!="textarea"||(c="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[c]||g=="progress"&&!m||g=="option"&&m!=w[c])&&ue(e,c,m,w[c],o),c="checked",y!=null&&y!=e[c]&&ue(e,c,y,w[c],o))}return e}function ze(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){$.__e(o,n)}}function ct(e,t,n){var r,o;if($.unmount&&$.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ze(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){$.__e(i,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&ct(r[o],t,n||typeof e.type!="function");n||Ae(e.__e),e.__c=e.__=e.__e=void 0}function hn(e,t,n){return this.constructor(e,n)}function ut(e,t,n){var r,o,i,s;t==document&&(t=document.documentElement),$.__&&$.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],Ee(t,e=(!r&&n||t).__k=ln(L,null,[e]),o||ie,ie,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?ne.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,s),st(i,e,s),e.props.children=null}ne=oe.slice,$={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(u){e=u}throw e}},Ke=0,on=function(e){return e!=null&&e.constructor===void 0},le.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=B({},this.state);typeof e=="function"&&(e=e(B({},n),this.props)),e&&B(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),tt(this))},le.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),tt(this))},le.prototype.render=L,D=[],Je=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Qe=function(e,t){return e.__v.__b-t.__v.__b},ce.__r=0,qe=Math.random().toString(8),re="__d"+qe,K="__a"+qe,Ze=/(PointerCapture)$|Capture$/i,Ie=0,Me=ot(!1),Te=ot(!0),an=0;var X,I,He,dt,J=0,ft=[],T=$,ht=T.__b,pt=T.__r,_t=T.diffed,gt=T.__c,mt=T.unmount,bt=T.__;function Re(e,t){T.__h&&T.__h(I,e,J||t),J=0;var n=I.__H||(I.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function A(e){return J=1,pn(xt,e)}function pn(e,t,n){var r=Re(X++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):xt(void 0,t),function(u){var d=r.__N?r.__N[0]:r.__[0],c=r.t(d,u);d!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=I,!I.__f)){var o=function(u,d,c){if(!r.__c.__H)return!0;var f=!1,p=r.__c.props!==u;if(r.__c.__H.__.some(function(h){if(h.__N){f=!0;var m=h.__[0];h.__=h.__N,h.__N=void 0,m!==h.__[0]&&(p=!0)}}),i){var l=i.call(this,u,d,c);return f?l||p:l}return!f||p};I.__f=!0;var i=I.shouldComponentUpdate,s=I.componentWillUpdate;I.componentWillUpdate=function(u,d,c){if(this.__e){var f=i;i=void 0,o(u,d,c),i=f}s&&s.call(this,u,d,c)},I.shouldComponentUpdate=o}return r.__N||r.__}function P(e,t){var n=Re(X++,3);!T.__s&&yt(n.__H,t)&&(n.__=e,n.u=t,I.__H.__h.push(n))}function F(e){return J=5,de(function(){return{current:e}},[])}function de(e,t){var n=Re(X++,7);return yt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Q(e,t){return J=8,de(function(){return e},t)}function _n(){for(var e;e=ft.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(fe),t.__h.some(Pe),t.__h=[]}catch(n){t.__h=[],T.__e(n,e.__v)}}}T.__b=function(e){I=null,ht&&ht(e)},T.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),bt&&bt(e,t)},T.__r=function(e){pt&&pt(e),X=0;var t=(I=e.__c).__H;t&&(He===I?(t.__h=[],I.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(fe),t.__h.some(Pe),t.__h=[],X=0)),He=I},T.diffed=function(e){_t&&_t(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ft.push(t)!==1&&dt===T.requestAnimationFrame||((dt=T.requestAnimationFrame)||gn)(_n)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),He=I=null},T.__c=function(e,t){t.some(function(n){try{n.__h.some(fe),n.__h=n.__h.filter(function(r){return!r.__||Pe(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],T.__e(r,n.__v)}}),gt&>(e,t)},T.unmount=function(e){mt&&mt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{fe(r)}catch(o){t=o}}),n.__H=void 0,t&&T.__e(t,n.__v))};var vt=typeof requestAnimationFrame=="function";function gn(e){var t,n=function(){clearTimeout(r),vt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);vt&&(t=requestAnimationFrame(n))}function fe(e){var t=I,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),I=t}function Pe(e){var t=I;e.__c=e.__(),I=t}function yt(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function xt(e,t){return typeof t=="function"?t(e):t}var mn=`
|
|
3
|
+
:host{all:initial;display:contents;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:14px;line-height:1.4;-webkit-font-smoothing:antialiased;color:#15171e}
|
|
4
|
+
:host([hidden]){display:none}
|
|
5
|
+
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
|
6
|
+
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
7
|
+
input{font:inherit;color:inherit;background:none;border:0;outline:0;min-width:0}
|
|
8
|
+
input::placeholder{color:var(--uq-placeholder,inherit);opacity:1}
|
|
9
|
+
input:disabled{cursor:not-allowed}
|
|
10
|
+
button:disabled{cursor:default}
|
|
11
|
+
a{color:inherit;text-decoration:none}
|
|
12
|
+
img,video{display:block;max-width:100%}
|
|
13
|
+
.uq-fixed{position:fixed;z-index:2147483000}
|
|
14
|
+
.uq-inline{display:block}
|
|
15
|
+
.uq-dots{display:inline-flex;gap:3px;align-items:center;height:10px}
|
|
16
|
+
.uq-dots span{width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.35;animation:uq-dot 1.2s infinite ease-in-out}
|
|
17
|
+
.uq-dots span:nth-child(2){animation-delay:.15s}
|
|
18
|
+
.uq-dots span:nth-child(3){animation-delay:.3s}
|
|
19
|
+
@keyframes uq-dot{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:.9;transform:translateY(-2px)}}
|
|
20
|
+
.uq-rise{animation:uq-rise .22s ease-out both}
|
|
21
|
+
@keyframes uq-rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
22
|
+
.uq-fade{animation:uq-fade .18s ease-out both}
|
|
23
|
+
@keyframes uq-fade{from{opacity:0}to{opacity:1}}
|
|
24
|
+
.uq-drawer{left:0;right:0;bottom:0;display:flex;flex-direction:column;overflow:hidden;padding-bottom:env(safe-area-inset-bottom);transition:height .28s cubic-bezier(.32,.72,0,1),border-radius .28s ease}
|
|
25
|
+
.uq-drawer-half{height:50%}
|
|
26
|
+
.uq-drawer-full{height:100%}
|
|
27
|
+
.uq-drawer-held{transition:none}
|
|
28
|
+
.uq-grab{flex-shrink:0;height:22px;display:flex;align-items:center;justify-content:center;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
|
|
29
|
+
.uq-grab:active{cursor:grabbing}
|
|
30
|
+
.uq-grab span{width:36px;height:4px;border-radius:2px}
|
|
31
|
+
.uq-slide{animation:uq-slide .3s cubic-bezier(.32,.72,0,1) both}
|
|
32
|
+
@keyframes uq-slide{from{transform:translateY(100%)}to{transform:none}}
|
|
33
|
+
@media (prefers-reduced-motion:reduce){.uq-rise,.uq-fade,.uq-slide,.uq-dots span{animation:none}.uq-drawer{transition:none}}
|
|
34
|
+
`;function he(e,t){try{return window[e].getItem(t)}catch{return null}}function pe(e,t,n){try{window[e].setItem(t,n)}catch{}}var bn=2e3,vn=20,yn=100;function Fe(e=Date.now()){const t=new Uint8Array(16);crypto.getRandomValues(t),t[0]=e/1099511627776&255,t[1]=e/4294967296&255,t[2]=e/16777216&255,t[3]=e/65536&255,t[4]=e/256&255,t[5]=e&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128;const n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var wt="usereq:visitor";function kt(){const e=he("localStorage",wt);if(e)return e;const t=Fe();return pe("localStorage",wt,t),t}function xn(e,t){const n=[];let r=null;const o=kt(),i=()=>{for(r!==null&&(window.clearTimeout(r),r=null);n.length>0;){const u=n.splice(0,yn);tn(e,{events:u})}},s=(u,d={})=>{n.push({id:Fe(),type:u,embedKind:t.kind,embedId:t.id,widgetId:d.widgetId,sessionId:d.sessionId,clientKey:o,url:window.location.href.slice(0,2e3),occurredAt:new Date().toISOString(),payload:d.payload}),n.length>=vn?i():r===null&&(r=window.setTimeout(i,bn))};return window.addEventListener("pagehide",i),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&i()}),{report:s,flush:i}}var St=e=>`usereq:once:${e}`;function je(e,t,n){switch(e){case"is":return t===n;case"starts_with":return t.startsWith(n);case"contains":return t.includes(n);case"matches":try{return new RegExp(n).test(t)}catch{return!1}}}function wn(e,t){switch(e.kind){case"path":return e.value==="*"||je(e.op,t.path,e.value);case"utm":var n;return je(e.op,(n=t.utm[e.param])!==null&&n!==void 0?n:"",e.value);case"device":return t.device===e.value;case"referrer":return je(e.op,t.referrer,e.value)}}function kn(e,t){for(const n of e)if(!(n.once&&he("sessionStorage",St(n.id)))&&n.conditions.every(r=>wn(r,t)))return n;return null}function $t(e,t,n){let r=!1,o=()=>{};const i=()=>{r||(r=!0,o(),n())};switch(e){case"page_load":{const d=window.setTimeout(i,0);o=()=>window.clearTimeout(d);break}case"time_on_page":{const d=Number(t.seconds)||0,c=window.setTimeout(i,d*1e3);o=()=>window.clearTimeout(c);break}case"scroll_depth":{const d=Number(t.percent)||0,c=()=>{const f=document.documentElement.scrollHeight-window.innerHeight;(f<=0?100:window.scrollY/f*100)>=d&&i()};window.addEventListener("scroll",c,{passive:!0}),o=()=>window.removeEventListener("scroll",c),c();break}case"element_click":{var s;const d=String((s=t.selector)!==null&&s!==void 0?s:""),c=f=>{const p=f.target;if(!(!(p instanceof Element)||!d))try{p.closest(d)&&i()}catch{}};document.addEventListener("click",c,!0),o=()=>document.removeEventListener("click",c,!0);break}case"element_visible":{var u;const d=String((u=t.selector)!==null&&u!==void 0?u:"");let c=null;const f=()=>{let p=null;try{p=d?document.querySelector(d):null}catch{p=null}return p?(c=new IntersectionObserver(l=>{l.some(h=>h.isIntersecting)&&i()}),c.observe(p),!0):!1};!f()&&document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",()=>void f(),{once:!0}),o=()=>c==null?void 0:c.disconnect();break}case"exit_intent":{const d=c=>{c.relatedTarget===null&&c.clientY<=0&&i()};document.addEventListener("mouseout",d),o=()=>document.removeEventListener("mouseout",d);break}}return()=>{r=!0,o()}}function Ct(e,t,n){const r=kn(e,t);return r?$t(r.trigger,r.triggerParams,()=>{r.once&&pe("sessionStorage",St(r.id),"1"),n(r)}):()=>{}}var qt=e=>`usereq:split:${e}`,It=e=>`usereq:seq:${e}`;function Sn(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function _e(e){return[...e].sort((t,n)=>t.position-n.position)}function $n(e){const t=_e(e.members);if(t.length===0)return null;const n=he("localStorage",qt(e.id)),r=n?t.find(u=>u.widget.id===n):void 0;if(r)return r;const o=t.reduce((u,d)=>u+d.weight,0);let i=Sn(`${kt()}:${e.config.salt}`)%o,s=t[t.length-1];for(const u of t){if(i<u.weight){s=u;break}i-=u.weight}return pe("localStorage",qt(e.id),s.widget.id),s}function Mt(e){var t,n;const r=_e(e.members);if(r.length===0)return null;const o=Number((t=he("sessionStorage",It(e.id)))!==null&&t!==void 0?t:0);return(n=r[Number.isFinite(o)?Math.min(o,r.length-1):0])!==null&&n!==void 0?n:null}function Cn(e,t,n){if(!t.advanceOn)return()=>{};const r=_e(e.members),o=r.findIndex(i=>i.widget.id===t.widget.id);return $t(t.advanceOn.kind,t.advanceOn.params,()=>{var i;const s=o+1<r.length?o+1:null;if(s===null){n(null);return}pe("sessionStorage",It(e.id),String(s)),n((i=r[s])!==null&&i!==void 0?i:null)})}function qn(e){switch(e.mode){case"split":{const t=$n(e);return t?[t.widget]:[]}case"sequence":{const t=Mt(e);return t?[t.widget]:[]}case"parallel":return _e(e.members).map(t=>t.widget)}}function In(e){var t,n,r,o;if(e)return e==="dark";const i=(t=Tt(getComputedStyle(document.body).backgroundColor))!==null&&t!==void 0?t:Tt(getComputedStyle(document.documentElement).backgroundColor);return i!==null?i<.5:(n=(r=(o=window).matchMedia)===null||r===void 0?void 0:r.call(o,"(prefers-color-scheme: dark)").matches)!==null&&n!==void 0?n:!1}function Tt(e){const t=/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)(?:[,\s/]+([\d.]+))?/.exec(e);if(!t||(t[4]===void 0?1:Number(t[4]))<.5)return null;const[n,r,o]=[Number(t[1]),Number(t[2]),Number(t[3])];return(.299*n+.587*r+.114*o)/255}function Mn(e=window.innerWidth){return e<640?"mobile":e<1024?"tablet":"desktop"}function Tn(){const e=new URL(window.location.href),t={};for(const n of["source","medium","campaign","term","content"]){const r=e.searchParams.get(`utm_${n}`);r&&(t[n]=r)}return{href:e.href.slice(0,2e3),path:e.pathname,referrer:document.referrer.slice(0,2e3),utm:t,device:Mn()}}function At(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function An(e){const{r:t,g:n,b:r}=At(e);return(.299*t+.587*n+.114*r)/255>.62?"#15171e":"#ffffff"}var ge=e=>e?"245,245,241":"21,23,30";function En(e,t){const n=e.appearance,r=n.accent;return{accent:r,accentFill:(()=>{if(n.alpha>=100)return r;const{r:o,g:i,b:s}=At(r);return`rgba(${o},${i},${s},${n.alpha/100})`})(),accentText:An(r),rad:n.radius,isGlass:e.type==="chat"&&e.variant==="stream"&&n.skin==="glass",isMessenger:e.type==="chat"&&e.variant==="bubble"&&e.preset==="facebook-messenger",hostDark:t,ink:ge(t),surfaceBg:t?"#181b22":"#ffffff",side:n.position==="bottom-right"?{right:n.offsetX}:{left:n.offsetX},offsetY:n.offsetY}}function S(e,t,n){const r=e.appearance.parts[t],o=[`uq-${t}`];return n&&o.push(n),r&&o.push(r.trim()),o.join(" ")}var zn=0,pr=Array.isArray;function a(e,t,n,r,o,i){t||(t={});var s,u,d=t;if("ref"in d)for(u in d={},t)u=="ref"?s=t[u]:d[u]=t[u];var c={type:e,props:d,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zn,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(u in s)d[u]===void 0&&(d[u]=s[u]);return $.vnode&&$.vnode(c),c}function j({size:e,children:t}){return a("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:t})}var Et=({size:e})=>a(j,{size:e,children:[a("path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}),a("path",{d:"M20 2v4"}),a("path",{d:"M22 4h-4"}),a("circle",{cx:"4",cy:"20",r:"2"})]}),zt=({size:e})=>a(j,{size:e,children:[a("path",{d:"M5 12h14"}),a("path",{d:"m12 5 7 7-7 7"})]}),me=({size:e})=>a(j,{size:e,children:[a("path",{d:"M18 6 6 18"}),a("path",{d:"m6 6 12 12"})]}),Hn=({size:e})=>a(j,{size:e,children:a("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})}),Rn=({size:e})=>a(j,{size:e,children:[a("path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}),a("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]}),Pn=({size:e})=>a(j,{size:e,children:[a("circle",{cx:"12",cy:"12",r:"10"}),a("path",{d:"M12 16v-4"}),a("path",{d:"M12 8h.01"})]}),Ht=({size:e})=>a(j,{size:e,children:a("path",{d:"m6 9 6 6 6-6"})}),Fn=({size:e})=>a(j,{size:e,children:a("path",{d:"M5 12h14"})}),jn=({size:e})=>a(j,{size:e,children:[a("path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"}),a("path",{d:"m21.854 2.147-10.94 10.939"})]}),Bn=({size:e})=>a(j,{size:e,children:[a("path",{d:"M15 3h6v6"}),a("path",{d:"M10 14 21 3"}),a("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),Dn=({size:e,d:t})=>a("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:a("path",{d:t})});function Ln({payload:e,look:t,reporter:n,open:r,setOpen:o,pinned:i}){var s;const u=e.config,{accentFill:d,accentText:c,rad:f}=t;if(!r)return null;const p=!((s=u.cta)===null||s===void 0)&&s.label.trim()?u.cta:null,l=(p==null?void 0:p.href.trim())||"",h=u.position==="bottom"?{bottom:0}:{top:0};return a("div",{class:S(u,"strip","uq-fixed uq-fade"),role:"region","aria-label":"Announcement",style:{left:0,right:0,...h,display:"flex",alignItems:"center",justifyContent:"center",gap:14,padding:"11px 14px",background:d,color:c},children:[a("span",{class:S(u,"text"),style:{fontSize:12.5,fontWeight:500},children:u.text}),p&&a("a",{class:S(u,"cta"),href:l||"#",target:l?"_blank":void 0,rel:l?"noopener noreferrer":void 0,onClick:()=>n.report("cta.clicked",{widgetId:e.id,payload:{href:l}}),style:{fontSize:11.5,padding:"5px 10px",borderRadius:f,border:`1px solid ${c}`,whiteSpace:"nowrap"},children:p.label}),!i&&a("button",{type:"button",class:S(u,"close"),onClick:()=>o(!1),"aria-label":"Close",style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",opacity:.7},children:a(me,{size:14})})]})}var Be={holdMs:1260,gapMs:1520,jitterMs:100};function Wn(e,t=Math.random){const n=[];let r=0;for(let o=0;o<e;o++){if(o===0)r+=Be.holdMs;else{const i=Math.round((t()*2-1)*Be.jitterMs);r+=Math.max(0,Be.gapMs+i)}n.push(r)}return n}function Nn(e,t,n,r){const[o,i]=A([]),[s,u]=A(!1),[d,c]=A(null),[f,p]=A(null),l=F(null),h=F(null),m=F([]),y=F(null),w=()=>{for(const v of m.current)window.clearTimeout(v);m.current=[]};P(()=>()=>w(),[]);const _=Q(async()=>{if(l.current)return l.current;const v=await Zt(e,{kind:n.kind,id:n.id,widgetId:n.kind==="group"?t.id:void 0,landingUrl:r.href,referrer:r.referrer||void 0,utm:Object.keys(r.utm).length?r.utm:void 0});return l.current={token:v.token,conversationId:v.conversationId},p(v.conversationId),l.current},[e,n.kind,n.id,t.id,r]),g=Q(async(v,k)=>{var x;(x=h.current)===null||x===void 0||x.abort();const q=new AbortController;h.current=q,w(),u(!0),c(null);try{const{token:C}=await _(),z=await en(e,C,v,k,q.signal);if(q.signal.aborted)return;const H=z.parts.filter(E=>E.trim());if(H.length===0)throw new Error("The agent did not answer. Try again.");i(E=>[...E,{id:z.id,role:"assistant",parts:H,shown:0}]),m.current=Wn(H.length).map((E,R)=>window.setTimeout(()=>{i(W=>W.map(Y=>Y.id===z.id?{...Y,shown:R+1}:Y)),R===H.length-1&&u(!1)},E))}catch(C){if(q.signal.aborted)return;C instanceof te&&(C.status===401||C.status===409)&&(l.current=null),u(!1),c(C instanceof te?C.message:C instanceof TypeError?"Could not reach the agent. Try again.":C instanceof Error&&C.message?C.message:"Something went wrong. Try again.")}},[e,_]);return{turns:o,busy:s,error:d,sessionId:f,send:Q(v=>{const k=v.trim().slice(0,4e3);if(!k||s)return;const x={id:Fe(),text:k};y.current=x,i(q=>[...q,{id:x.id,role:"user",parts:[k],shown:1}]),g(x,"submit-message")},[s,g]),retry:Q(()=>{!y.current||s||g(y.current,"regenerate-message")},[s,g]),stop:Q(()=>{var v;(v=h.current)===null||v===void 0||v.abort(),h.current=null,w(),i(k=>k.map(x=>x.role==="assistant"&&x.shown<x.parts.length?{...x,shown:x.parts.length}:x)),u(!1)},[])}}function On(){const e="(max-width: 639px)",[t,n]=A(()=>{var r,o,i;return(r=(o=(i=window).matchMedia)===null||o===void 0?void 0:o.call(i,e).matches)!==null&&r!==void 0?r:!1});return P(()=>{var r,o;const i=(r=(o=window).matchMedia)===null||r===void 0?void 0:r.call(o,e);if(!i)return;const s=()=>n(i.matches);return i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[]),t}var Un=.5,Rt=120,De=()=>document.documentElement.clientHeight;function Pt({look:e,pinned:t,onClose:n,children:r}){const[o,i]=A("half"),[s,u]=A(null),d=F(null),c=F(null),f=_=>{const g=d.current;g&&(_.currentTarget.setPointerCapture(_.pointerId),c.current={startY:_.clientY,startHeight:g.getBoundingClientRect().height,lastY:_.clientY,lastAt:_.timeStamp,velocity:0},u(c.current.startHeight))},p=_=>{const g=c.current;if(!g)return;const v=_.timeStamp-g.lastAt;v>0&&(g.velocity=(_.clientY-g.lastY)/v),g.lastY=_.clientY,g.lastAt=_.timeStamp;const k=g.startHeight+(g.startY-_.clientY);u(Math.max(Rt,Math.min(De(),k)))},l=()=>{const _=c.current;if(!_)return;c.current=null;const g=Math.max(Rt,Math.min(De(),_.startHeight+(_.startY-_.lastY))),v=De();let k;if(_.velocity<-.5?k="full":_.velocity>Un?k=o==="full"?"half":"closed":g>v*.75?k="full":g<v*.3?k="closed":k="half",u(null),k==="closed"){t?i("half"):n();return}i(k)},{ink:h,surfaceBg:m,rad:y}=e,w=o==="full"&&s===null;return a("div",{ref:d,class:["uq-fixed uq-drawer uq-slide",w?"uq-drawer-full":"uq-drawer-half",s!==null&&"uq-drawer-held"].filter(Boolean).join(" "),role:"dialog","aria-modal":"false",style:{height:s!==null?s:void 0,borderRadius:w?0:`${y}px ${y}px 0 0`,borderTop:`1px solid rgba(${h},.12)`,background:m,boxShadow:"0 -12px 40px rgba(0,0,0,.18)"},children:[a("div",{class:"uq-grab",onPointerDown:f,onPointerMove:p,onPointerUp:l,onPointerCancel:l,"aria-label":w?"Drag down to shrink or close":"Drag up to expand",style:{background:m},children:a("span",{style:{background:`rgba(${h},.25)`}})}),r]})}var b={accent:"#7B5BFF",gradient:"linear-gradient(135deg,#00B2FF 0%,#006AFF 38%,#8E5BFF 100%)",blue:"#0084FF",surface:{light:"#ffffff",dark:"#242526"},bubble:{light:"#f5f5f5",dark:"#404040"},muted:{light:"#8e8e8e",dark:"#a8a8a8"},border:{light:"rgba(0,0,0,.1)",dark:"rgba(255,255,255,.12)"},panelWidth:372,panelHeight:520,panelRadius:24,panelGap:14,panelShadow:"0 8px 32px rgba(0,0,0,.16)",launcherSize:60,launcherShadow:"0 6px 20px rgba(123,91,255,.4)",badgeSize:20,logo:"M12 2C6.48 2 2 6.18 2 11.32c0 2.93 1.45 5.55 3.7 7.27v3.4l3.39-1.86a10.5 10.5 0 0 0 2.91.41c5.52 0 10-4.18 10-9.22S17.52 2 12 2Zm1.06 12.42-2.55-2.72-4.97 2.72 5.46-5.8 2.61 2.72 4.91-2.72-5.46 5.8Z",headerAvatar:40,headerButton:28,headerIcon:18,nameFont:15,avatarSize:28,bubbleRadius:18,bubbleFont:14,bubblePadding:"6px 12px",bubbleMaxWidth:"78%",ctaShadow:"0 4px 12px rgba(123,91,255,.32)",composerPlaceholder:"Aa",composerRadius:24,composerHeight:36,sendSize:36,sendIcon:20},Yn=3600,Le=e=>e.welcome||"Hi! Ask me anything before you buy.";function Ft(e,t="Type your message…"){const n=e.spotlights.filter(s=>s.trim()),[r,o]=A(0);P(()=>{if(n.length<2)return;const s=window.setInterval(()=>o(u=>u+1),Yn);return()=>window.clearInterval(s)},[n.length]);const i=e.placeholder||t;return n.length?n[r%n.length]:i}function be(e){const t=F(null);return P(()=>{const n=t.current;n&&(n.scrollTop=n.scrollHeight)},e),t}function jt(e){const t=e?"dark":"light";return{surface:b.surface[t],bubble:b.bubble[t],muted:b.muted[t],border:b.border[t]}}var U=(e,t={})=>({width:e,height:e,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,...t});function We({payload:e,size:t,font:n,palette:r,fallback:o}){var i,s,u,d;const c=(i=(s=e.agent)===null||s===void 0?void 0:s.name)!==null&&i!==void 0?i:null,f=(u=(d=e.agent)===null||d===void 0?void 0:d.avatarUrl)!==null&&u!==void 0?u:null;return f?a("img",{src:f,alt:"",width:t,height:t,style:U(t,{objectFit:"cover"})}):a("span",{style:U(t,{background:r.bubble,color:r.muted,fontSize:n,fontWeight:600,...o}),children:c?c.trim().charAt(0).toUpperCase():"A"})}function Bt({text:e,mine:t,runStart:n,look:r,config:o,payload:i,palette:s,children:u}){return a("div",{class:"uq-rise",style:{display:"flex",alignItems:"flex-end",gap:6,justifyContent:t?"flex-end":"flex-start",marginTop:n?6:2},children:[!t&&(n?a(We,{payload:i,size:b.avatarSize,font:12,palette:s}):a("span",{style:{width:b.avatarSize,flexShrink:0}})),a("div",{class:S(o,t?"userMessage":"botMessage"),style:{maxWidth:b.bubbleMaxWidth,padding:u?"8px 12px":b.bubblePadding,borderRadius:b.bubbleRadius,background:t?b.gradient:s.bubble,color:t?"#fff":`rgb(${r.ink})`,fontSize:b.bubbleFont,lineHeight:1.375,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:u!=null?u:e})]})}function Dt({payload:e,config:t,look:n,chat:r,focus:o,onCta:i,mobile:s,fill:u=!1,onMinimize:d,onClose:c}){var f,p,l,h;const m=jt(n.hostDark),{surface:y,bubble:w,muted:_,border:g}=m,v=Ft(t,b.composerPlaceholder),k=(f=(p=e.agent)===null||p===void 0?void 0:p.name)!==null&&f!==void 0?f:null,x=!!(!((l=e.agent)===null||l===void 0)&&l.live),q=be([r.turns,r.busy,r.error]),[C,z]=A(""),H=F(null);P(()=>{var M;o>0&&((M=H.current)===null||M===void 0||M.focus())},[o]);const E=M=>{M.preventDefault(),x&&(r.send(C),z(""))},R=!((h=t.cta)===null||h===void 0||(h=h.href)===null||h===void 0)&&h.trim()?t.cta:null,W=[{key:"welcome",text:Le(t),mine:!1}];for(const M of r.turns)if(M.role==="user"){var Y;W.push({key:M.id,text:(Y=M.parts[0])!==null&&Y!==void 0?Y:"",mine:!0})}else M.parts.slice(0,M.shown).forEach((G,Ye)=>{W.push({key:`${M.id}:${Ye}`,text:G,mine:!1})});const hr=W[W.length-1],Z=(M,G,Ye,Ge,Vt)=>a("button",{type:"button",class:Vt?S(t,Vt):void 0,onClick:Ge,disabled:!Ge,"aria-label":G,style:U(s?36:b.headerButton,{color:Ye,opacity:Ge?1:.6}),children:M}),ee=b.headerIcon;return a("div",{class:S(t,"panel"),style:{display:"flex",flexDirection:"column",borderRadius:u?0:b.panelRadius,overflow:"hidden",border:u?void 0:`1px solid ${g}`,boxShadow:u?void 0:b.panelShadow,background:y,color:`rgb(${n.ink})`,...u?{flex:1,minHeight:0}:{height:b.panelHeight,maxHeight:`calc(100vh - ${n.offsetY+b.launcherSize+b.panelGap+12}px)`}},children:[a("div",{class:S(t,"header"),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderBottom:`1px solid ${g}`},children:[a(We,{payload:e,size:b.headerAvatar,font:14,palette:m}),a("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:2},children:[a("span",{style:{fontSize:b.nameFont,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k?k.split("—")[0].trim():"Chat"}),a("span",{style:{color:_,opacity:.7,display:"flex"},children:a(Ht,{size:16})})]}),Z(a(Hn,{size:ee}),"Call (unavailable)",b.blue),Z(a(Rn,{size:ee}),"Video call (unavailable)",b.blue),Z(a(Pn,{size:ee}),"Details (unavailable)",_),d&&Z(a(Fn,{size:ee}),"Minimize chat",_,d),c&&Z(a(me,{size:ee}),"Close chat",_,c,"close")]}),a("div",{ref:q,style:{flex:1,minHeight:0,padding:"6px 12px 12px",display:"flex",flexDirection:"column",overflowY:"auto",overscrollBehavior:"contain"},children:[W.map((M,G)=>a(Bt,{text:M.text,mine:M.mine,runStart:G===0||W[G-1].mine!==M.mine,look:n,config:t,payload:e,palette:m},M.key)),r.busy&&a(Bt,{mine:!1,runStart:hr.mine,look:n,config:t,payload:e,palette:m,children:a("span",{class:"uq-dots","aria-label":"Typing",style:{gap:4},children:[a("span",{style:{width:6,height:6}}),a("span",{style:{width:6,height:6}}),a("span",{style:{width:6,height:6}})]})}),r.error&&a("div",{class:"uq-error uq-fade",style:{display:"flex",gap:8,marginTop:6,paddingLeft:b.avatarSize+6,fontSize:12,color:_},children:[a("span",{children:r.error}),a("button",{type:"button",onClick:r.retry,style:{color:b.blue,fontWeight:500,textDecoration:"underline"},children:"Retry"})]})]}),R&&a("div",{style:{display:"flex",justifyContent:"flex-end",padding:"8px 12px"},children:a("a",{class:"uq-cta",href:R.href,target:"_blank",rel:"noopener noreferrer",onClick:i,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 16px",borderRadius:999,background:b.gradient,color:"#fff",fontSize:14,fontWeight:600,boxShadow:b.ctaShadow},children:[R.label||"Learn more",a(Bn,{size:16})]})}),a("form",{class:S(t,"composer"),onSubmit:E,style:{display:"flex",alignItems:"center",gap:4,padding:8,borderTop:`1px solid ${g}`},children:[a("input",{ref:H,type:"text",value:C,onInput:M=>z(M.target.value),placeholder:v,disabled:!x,maxLength:4e3,"aria-label":"Message",autoComplete:"off",style:{flex:1,minHeight:b.composerHeight,padding:"0 12px",borderRadius:b.composerRadius,background:w,color:`rgb(${n.ink})`,fontSize:s?16:14,"--uq-placeholder":_}}),r.busy?a("button",{type:"button",class:S(t,"sendButton"),onClick:r.stop,"aria-label":"Stop",style:U(b.sendSize,{color:b.blue}),children:a("span",{style:{width:10,height:10,background:"currentColor",borderRadius:2}})}):a("button",{type:"submit",class:S(t,"sendButton"),disabled:!x||!C.trim(),"aria-label":"Send",style:U(b.sendSize,{color:b.blue,opacity:x&&C.trim()?1:.5}),children:a(jn,{size:b.sendIcon})})]})]})}function Gn({payload:e,config:t,look:n,chat:r,mobile:o,focus:i,open:s,setOpen:u,pinned:d,onCta:c}){const f=jt(n.hostDark),{side:p,offsetY:l}=n,h=d?void 0:()=>u(!1);if(s&&o){const m={...n,surfaceBg:f.surface,rad:b.panelRadius};return a(Pt,{look:m,pinned:d,onClose:()=>u(!1),children:a(Dt,{payload:e,config:t,look:n,chat:r,focus:i,onCta:c,mobile:!0,fill:!0,onClose:h})})}return a(L,{children:[s&&a("div",{class:"uq-fixed uq-rise",style:{bottom:l+b.launcherSize+b.panelGap,width:b.panelWidth,...p},children:a(Dt,{payload:e,config:t,look:n,chat:r,focus:i,onCta:c,mobile:!1,onMinimize:h,onClose:h})}),a("button",{type:"button",class:S(t,"launcher","uq-fixed"),"aria-label":s?"Close chat":"Open chat","aria-expanded":s,onClick:()=>{s&&d||u(!s)},style:{bottom:l,...U(b.launcherSize,{boxShadow:b.launcherShadow}),...p},children:[a(We,{payload:e,size:b.launcherSize,font:16,palette:f,fallback:{background:b.gradient,color:"#fff"}}),s?a("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"rgba(0,0,0,.45)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff"},children:a(Ht,{size:28})}):a("span",{style:{position:"absolute",right:-4,bottom:-4,...U(b.badgeSize,{background:b.accent,color:"#fff",boxShadow:`0 0 0 2px ${f.surface}`})},children:a(Dn,{size:12,d:b.logo})})]})]})}function ve({text:e,mine:t,onDark:n,look:r,config:o,children:i}){const s=ge(n),{isGlass:u,accentFill:d,accentText:c,rad:f}=r;return a("div",{class:S(o,t?"userMessage":"botMessage","uq-rise"),style:{alignSelf:t?"flex-end":"flex-start",maxWidth:t?"78%":"84%",padding:"8px 10px",borderRadius:f,background:t?d:u?"rgba(10,12,18,.42)":`rgba(${s},${n?.1:.06})`,color:t?c:u?"#fff":`rgb(${s})`,backdropFilter:!t&&u?"blur(6px)":void 0,fontSize:12,lineHeight:1.45,textShadow:!t&&u?"0 1px 2px rgba(0,0,0,.5)":void 0,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:i!=null?i:e})}var Vn=e=>a(ve,{mine:!1,...e,children:a("span",{class:"uq-dots","aria-label":"Typing",children:[a("span",{}),a("span",{}),a("span",{})]})});function Lt({config:e,look:t,onClick:n}){var r;const o=!((r=e.cta)===null||r===void 0||(r=r.href)===null||r===void 0)&&r.trim()?e.cta:null;return o?a("a",{class:"uq-cta",href:o.href,target:"_blank",rel:"noopener noreferrer",onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"9px 12px",borderRadius:t.rad,background:t.accentFill,color:t.accentText,fontSize:12,fontWeight:500},children:o.label||"Learn more"}):null}function Wt({config:e,look:t,onDark:n,hint:r,chat:o,disabled:i,focus:s}){const u=ge(n),{isGlass:d,accentFill:c,accentText:f,rad:p}=t,[l,h]=A(""),m=F(null);P(()=>{var _;s>0&&((_=m.current)===null||_===void 0||_.focus())},[s]);const y=_=>{_.preventDefault(),!i&&(o.send(l),h(""))},w=d?"rgba(255,255,255,.75)":`rgba(${u},${n?.6:.45})`;return a("form",{class:S(e,"composer"),onSubmit:y,style:{display:"flex",alignItems:"center",gap:8,padding:"7px 8px 7px 11px",borderRadius:p,border:d?"1px solid rgba(255,255,255,.35)":`1px solid rgba(${u},${n?.28:.12})`,background:d?"rgba(10,12,18,.3)":`rgba(${u},${n?.08:.02})`,backdropFilter:d||n?"blur(6px)":void 0},children:[a("input",{ref:m,type:"text",value:l,onInput:_=>h(_.target.value),placeholder:r||"Message…",disabled:i,maxLength:4e3,"aria-label":"Message",autoComplete:"off",style:{flex:1,fontSize:11.5,color:d?"#fff":`rgb(${u})`,"--uq-placeholder":w}}),o.busy?a("button",{type:"button",class:S(e,"sendButton"),onClick:o.stop,"aria-label":"Stop",style:{width:24,height:24,borderRadius:p,background:c,color:f,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:a("span",{style:{width:8,height:8,background:"currentColor",borderRadius:1}})}):a("button",{type:"submit",class:S(e,"sendButton"),disabled:i,"aria-label":"Send",style:{width:24,height:24,borderRadius:p,background:c,color:f,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,opacity:i?.5:1},children:a(zt,{size:13})})]})}function Ne({welcome:e,chat:t,onDark:n,look:r,config:o}){const i=ge(n);return a(L,{children:[a(ve,{text:e,mine:!1,onDark:n,look:r,config:o}),t.turns.map(s=>s.role==="user"?a(ve,{text:s.parts[0],mine:!0,onDark:n,look:r,config:o},s.id):s.parts.slice(0,s.shown).map((u,d)=>a(ve,{text:u,mine:!1,onDark:n,look:r,config:o},`${s.id}:${d}`))),t.busy&&a(Vn,{onDark:n,look:r,config:o}),t.error&&a("div",{class:"uq-error uq-fade",style:{alignSelf:"flex-start",display:"flex",gap:8,fontSize:11.5,color:r.isGlass?"rgba(255,255,255,.8)":`rgba(${i},.6)`,textShadow:r.isGlass?"0 1px 2px rgba(0,0,0,.5)":void 0},children:[a("span",{children:t.error}),a("button",{type:"button",onClick:t.retry,style:{color:r.isGlass?"#fff":r.accent,fontWeight:500,textDecoration:"underline"},children:"Retry"})]})]})}function Oe({payload:e,config:t,look:n,chat:r,shadow:o,hint:i,focus:s,onCta:u,fill:d=!1,onClose:c}){var f,p,l;const{ink:h,surfaceBg:m,hostDark:y,accentFill:w,accentText:_,rad:g}=n,v=(f=(p=e.agent)===null||p===void 0?void 0:p.name)!==null&&f!==void 0?f:null,k=v?v.trim().charAt(0).toUpperCase():"A",x=Le(t),q=be([r.turns,r.busy,r.error]),C=!!(!((l=e.agent)===null||l===void 0)&&l.live);return a("div",{class:S(t,"panel"),style:{width:"100%",borderRadius:d?0:g,overflow:"hidden",border:d?void 0:`1px solid rgba(${h},.12)`,boxShadow:o?"0 18px 44px rgba(0,0,0,.16)":void 0,background:m,...d?{flex:1,minHeight:0,display:"flex",flexDirection:"column"}:{}},children:[a("div",{class:S(t,"header"),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:w,color:_},children:[a("span",{style:{width:20,height:20,borderRadius:"50%",background:"rgba(255,255,255,.25)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,color:_},children:k}),a("span",{style:{fontSize:12,fontWeight:500},children:v?v.split("—")[0].trim():"Chat"}),a("span",{style:{marginLeft:"auto",fontSize:10,opacity:.8},children:C?"online":"offline"}),c&&a("button",{type:"button",class:S(t,"close"),onClick:c,"aria-label":"Close chat",style:{width:28,height:28,marginRight:-6,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",color:_,flexShrink:0},children:a(me,{size:16})})]}),a("div",{ref:q,style:{display:"flex",flexDirection:"column",gap:7,padding:12,background:m,maxHeight:d?void 0:"min(58vh, 380px)",flex:d?1:void 0,minHeight:d?0:void 0,overflowY:"auto",overscrollBehavior:"contain"},children:a(Ne,{welcome:x,chat:r,onDark:y,look:n,config:t})}),a("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"0 12px 12px",background:m},children:[a(Lt,{config:t,look:n,onClick:u}),a(Wt,{config:t,look:n,onDark:y,hint:i,chat:r,disabled:!C,focus:s})]})]})}function Kn({payload:e,look:t,api:n,embed:r,page:o,reporter:i,open:s,setOpen:u,pinned:d,focus:c}){var f;const p=e.config,l=Nn(n,e,r,o),h=Ft(p),{accentFill:m,accentText:y,rad:w,side:_,offsetY:g}=t,v=On(),k=!!(!((f=e.agent)===null||f===void 0)&&f.live),x=Le(p),q=()=>{var z,H;return i.report("cta.clicked",{widgetId:e.id,sessionId:(z=l.sessionId)!==null&&z!==void 0?z:void 0,payload:{href:(H=p.cta)===null||H===void 0?void 0:H.href}})};if(t.isMessenger)return a(Gn,{payload:e,config:p,look:t,chat:l,mobile:v,focus:c,open:s,setOpen:u,pinned:d,onCta:q});if(p.variant==="bubble")return s&&v?a(Pt,{look:t,pinned:d,onClose:()=>u(!1),children:a(Oe,{payload:e,config:p,look:t,chat:l,shadow:!1,hint:h,focus:c,onCta:q,fill:!0,onClose:d?void 0:()=>u(!1)})}):a(L,{children:[s&&a("div",{class:"uq-fixed uq-rise",style:{bottom:g+54,width:296,..._},children:a(Oe,{payload:e,config:p,look:t,chat:l,shadow:!0,hint:h,focus:c,onCta:q})}),a("button",{type:"button",class:S(p,"launcher","uq-fixed"),"aria-label":s?"Close chat":"Open chat","aria-expanded":s,onClick:()=>{s&&d||u(!s)},style:{bottom:g,width:44,height:44,borderRadius:Math.min(22,w*2),background:m,color:y,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 10px 26px rgba(0,0,0,.24)",..._},children:a(Et,{size:20})})]});if(p.variant==="box")return a("div",{class:"uq-inline",children:a(Oe,{payload:e,config:p,look:t,chat:l,shadow:!1,hint:h,focus:c,onCta:q})});const C={payload:e,config:p,look:t,chat:l,hint:h,mobile:v,focus:c,live:k,welcome:x,onCta:q};return p.variant==="chatbar"?a(Xn,{...C}):a(Jn,{...C})}function Xn({config:e,look:t,chat:n,hint:r,mobile:o,focus:i,live:s,welcome:u}){const{ink:d,hostDark:c,accentFill:f,accentText:p,rad:l}=t,h=be([n.turns,n.busy,n.error]),m=n.turns.length>0;return a("div",{class:S(e,"panel","uq-fixed"),style:{left:0,right:0,bottom:0,padding:"10px 12px",background:c?"rgba(24,27,34,.97)":"rgba(255,255,255,.97)",borderTop:`1px solid rgba(${d},.12)`,display:"flex",flexDirection:"column",gap:10,boxShadow:"0 -10px 30px rgba(0,0,0,.12)"},children:[m&&a("div",{ref:h,style:{display:"flex",flexDirection:"column",gap:7,maxHeight:"min(50vh, 320px)",overflowY:"auto"},children:a(Ne,{welcome:u,chat:n,onDark:c,look:t,config:e})}),a("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a("span",{class:S(e,"launcher"),style:{width:26,height:26,borderRadius:l,background:f,color:p,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:a(Et,{size:14})}),a("span",{class:S(e,"botMessage"),style:{flex:1,minWidth:0,fontSize:12,color:`rgb(${d})`,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:u}),a("form",{class:S(e,"composer"),onSubmit:y=>{y.preventDefault();const w=y.currentTarget.elements.namedItem("message");!w||!s||(n.send(w.value),w.value="")},style:{display:"flex",alignItems:"center",gap:8,flexShrink:0,padding:"6px 8px 6px 11px",borderRadius:l,border:`1px solid rgba(${d},.14)`,minWidth:o?0:220},children:[a("input",{name:"message",type:"text",placeholder:r,disabled:!s,maxLength:4e3,"aria-label":"Message",autoComplete:"off",ref:y=>{y&&i>0&&y.focus()},style:{flex:1,fontSize:11.5,color:`rgb(${d})`,"--uq-placeholder":`rgba(${d},.45)`}}),a("button",{type:n.busy?"button":"submit",class:S(e,"sendButton"),onClick:n.busy?n.stop:void 0,disabled:!s,"aria-label":n.busy?"Stop":"Send",style:{width:22,height:22,borderRadius:l,background:f,color:p,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:n.busy?a("span",{style:{width:7,height:7,background:"currentColor",borderRadius:1}}):a(zt,{size:12})})]})]})]})}function Jn({config:e,look:t,chat:n,hint:r,mobile:o,focus:i,live:s,welcome:u,onCta:d}){const{hostDark:c,side:f,offsetY:p}=t,l=c,h=be([n.turns,n.busy,n.error]);return a("div",{class:S(e,"panel","uq-fixed"),style:{bottom:p,width:o?`calc(100% - ${e.appearance.offsetX*2}px)`:320,display:"flex",flexDirection:"column",gap:7,...f},children:[a("div",{ref:h,style:{display:"flex",flexDirection:"column",gap:7,maxHeight:"min(60vh, 420px)",overflowY:"auto"},children:a(Ne,{welcome:u,chat:n,onDark:l,look:t,config:e})}),a(Lt,{config:e,look:t,onClick:d}),a(Wt,{config:e,look:t,onDark:l,hint:r,chat:n,disabled:!s,focus:i})]})}var Qn=e=>/^https?:\/\//i.test(e);function Zn({config:e,block:t,index:n,look:r,onCta:o}){const{ink:i,accent:s,accentFill:u,accentText:d,rad:c}=r,f=["uq-block",`uq-block-${t.kind}`,t.cssClass.trim()].filter(Boolean).join(" "),p="align"in t?t.align:"center",l={class:f,"data-uq-block":n};switch(t.kind){case"headline":return a("div",{...l,style:{fontFamily:"var(--font-display, inherit)",fontSize:t.size==="lg"?21:t.size==="sm"?15:18,fontWeight:600,letterSpacing:"-0.02em",textAlign:p,color:t.color||`rgb(${i})`},children:t.text});case"text":return a("div",{...l,style:{fontSize:12.5,lineHeight:1.5,textAlign:p,color:t.color||`rgba(${i},.65)`,whiteSpace:"pre-wrap"},children:t.text});case"media":return!t.src||!Qn(t.src)?null:t.mediaType==="video"?a("video",{...l,src:t.src,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,style:{width:"100%",maxHeight:200,objectFit:"cover",borderRadius:c,background:"#000"}}):a("img",{...l,src:t.src,alt:t.alt||"",style:{width:"100%",maxHeight:200,objectFit:"cover",borderRadius:c}});case"quote":return a("div",{...l,style:{textAlign:"center"},children:[a("div",{style:{fontSize:13,fontStyle:"italic",color:`rgb(${i})`},children:["“",t.text,"”"]}),a("div",{style:{fontSize:11,color:`rgba(${i},.55)`,marginTop:4},children:t.author})]});case"cta":return a("a",{...l,class:`${S(e,"cta")} ${f}`,href:t.href||"#",target:t.newTab?"_blank":void 0,rel:t.newTab?"noopener noreferrer":void 0,onClick:()=>o(t.href),style:{display:"block",marginTop:4,padding:"10px 14px",borderRadius:c,background:t.style==="outline"?"transparent":u,border:t.style==="outline"?`1px solid ${s}`:void 0,color:t.style==="outline"?s:d,fontSize:13,fontWeight:500,textAlign:"center"},children:t.label})}}function er({payload:e,look:t,reporter:n,open:r,setOpen:o,pinned:i}){const s=e.config,{ink:u,surfaceBg:d,rad:c}=t;if(!r)return null;const f=()=>{i||o(!1)},p=l=>n.report("cta.clicked",{widgetId:e.id,payload:{href:l}});return a("div",{class:S(s,"scrim","uq-fixed uq-fade"),onClick:f,style:{inset:0,background:"rgba(8,10,16,.5)",display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a("div",{class:S(s,"card","uq-rise"),role:"dialog","aria-modal":"true",onClick:l=>l.stopPropagation(),style:{position:"relative",width:"100%",maxWidth:340,maxHeight:"calc(100vh - 48px)",overflowY:"auto",background:d,borderRadius:c,padding:"22px 20px",boxShadow:"0 24px 60px rgba(0,0,0,.3)",display:"flex",flexDirection:"column",gap:10,textAlign:"center",color:`rgb(${u})`},children:[!i&&a("button",{type:"button",class:S(s,"close"),onClick:f,"aria-label":"Close",style:{position:"absolute",top:8,right:8,width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",color:`rgba(${u},.55)`},children:a(me,{size:14})}),s.blocks.map((l,h)=>a(Zn,{config:s,block:l,index:h,look:t,onCta:p},h))]})})}var tr=3600;function nr({payload:e,look:t,open:n}){const r=e.config,{ink:o,accent:i,surfaceBg:s,rad:u}=t,d=r.quotes,[c,f]=A(0);if(P(()=>{if(d.length<2)return;const h=window.setInterval(()=>f(m=>m+1),tr);return()=>window.clearInterval(h)},[d.length]),!n||d.length===0)return null;const p=c%d.length,l=d[p];return a("div",{class:"uq-fixed uq-fade",style:{left:0,right:0,bottom:0,display:"flex",justifyContent:"center",padding:24,pointerEvents:"none"},children:a("figure",{class:S(r,"frame"),style:{width:"100%",maxWidth:440,background:s,border:`1px solid rgba(${o},.12)`,borderLeft:`3px solid ${i}`,borderRadius:u,padding:"16px 18px",display:"flex",flexDirection:"column",gap:9,boxShadow:"0 14px 34px rgba(0,0,0,.12)",pointerEvents:"auto"},children:[a("blockquote",{class:S(r,"quote","uq-fade"),style:{fontSize:13.5,lineHeight:1.55,color:`rgb(${o})`},children:["“",l.text||"…","”"]},p),a("figcaption",{style:{display:"flex",alignItems:"center",gap:10},children:[a("span",{class:S(r,"author"),style:{fontFamily:"monospace",fontSize:11,color:`rgba(${o},.55)`},children:l.author||"—"}),a("span",{class:S(r,"dots"),style:{marginLeft:"auto",display:"flex",gap:4},children:d.map((h,m)=>a("span",{style:{width:5,height:5,borderRadius:"50%",background:m===p?i:`rgba(${o},.18)`}},m))})]})]})})}function rr(e){switch(e.config.type){case"chat":case"exit-popup":return!1;case"banner":case"testimonial":return!0}}function ir(e){return e.rules.length>0||e.config.type!=="exit-popup"?e.rules:[{id:`default:${e.id}`,trigger:"exit_intent",triggerParams:{},conditions:[],once:!0,actionConfig:{open:!1,autoStart:!1,pinned:!1}}]}function Nt({payload:e,api:t,embed:n,page:r,reporter:o,hostDark:i,kick:s=null}){const u=de(()=>En(e.config,i),[e,i]),d=de(()=>ir(e),[e]),[c,f]=A(d.length===0),[p,l]=A(()=>d.length===0&&rr(e)),[h,m]=A(!1),[y,w]=A(0),_=F(p),g=x=>{l(x),x!==_.current&&(_.current=x,o.report(x?"surface.opened":"surface.closed",{widgetId:e.id}))},v=({autoStart:x,pinned:q})=>{f(!0),m(q),g(!0),x&&w(C=>C+1)};if(P(()=>Ct(d,r,x=>{o.report("rule.fired",{widgetId:e.id,payload:{ruleId:x.id,trigger:x.trigger}}),v(x.actionConfig)}),[e.id]),P(()=>{s&&v(s.action)},[s]),!c)return null;const k={payload:e,look:u,api:t,embed:n,page:r,reporter:o,open:p,setOpen:g,pinned:h,focus:y};switch(e.config.type){case"chat":return a(Kn,{...k});case"exit-popup":return a(er,{...k});case"banner":return a(Ln,{...k});case"testimonial":return a(nr,{...k})}}function or(e){const t=[],n=e.config.appearance.customCss.trim();return n&&t.push(n),e.config.type==="exit-popup"&&e.config.blocks.forEach((r,o)=>{const i=r.css.trim();i&&t.push(`[data-uq-widget="${e.id}"] [data-uq-block="${o}"]{${i}}`)}),t.join(`
|
|
35
|
+
`)}function ar(e){return e.kind==="widget"?[e.payload]:e.payload.members.map(t=>t.widget)}var sr={report:()=>{},flush:()=>{}};function lr({group:e,...t}){const[n,r]=A(e.rules.length===0),[o,i]=A(null),[s,u]=A(()=>qn(e));return P(()=>Ct(e.rules,t.page,d=>{t.reporter.report("rule.fired",{payload:{ruleId:d.id,trigger:d.trigger}}),r(!0),i(c=>{var f;return{action:d.actionConfig,n:((f=c==null?void 0:c.n)!==null&&f!==void 0?f:0)+1}})}),[e.id]),P(()=>{if(e.mode!=="sequence"||!n)return;const d=Mt(e);if(d)return Cn(e,d,c=>u(c?[c.widget]:[]))},[e.id,e.mode,n,s]),n?a(L,{children:s.map(d=>a("div",{"data-uq-widget":d.id,style:"display:contents",children:a(Nt,{payload:d,kick:o,...t})},d.id))}):null}function cr({snapshot:e,...t}){const n={kind:e.kind,id:e.payload.id};return e.kind==="group"?a(lr,{group:e.payload,embed:n,...t}):a("div",{"data-uq-widget":e.payload.id,style:"display:contents",children:a(Nt,{payload:e.payload,embed:n,...t})})}function Ot(e,t,n={}){var r,o,i;const s=(r=t.shadowRoot)!==null&&r!==void 0?r:t.attachShadow({mode:"open"}),u={base:((o=n.apiUrl)!==null&&o!==void 0?o:"https://api.usereq.com").replace(/\/+$/,"")},d={kind:e.kind,id:e.payload.id},c=n.silent?sr:xn(u,d),f=In((i=n.theme)!==null&&i!==void 0?i:null),p=Tn(),l=document.createElement("style");s.appendChild(l);const h=document.createElement("div");h.setAttribute("data-uq-root",""),h.style.display="contents",s.appendChild(h);const m=y=>{l.textContent=[mn,...ar(y).map(or)].join(`
|
|
36
|
+
`),ut(a(cr,{snapshot:y,api:u,page:p,reporter:c,hostDark:f}),h)};return m(e),c.report("embed.loaded",{payload:{version:e.payload.version}}),{update:m,unmount:()=>{ut(null,h),c.flush(),l.remove(),h.remove()}}}function Ut(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ur(e,t){Ut(e,t),t.add(e)}function Yt(e,t,n){Ut(e,t),t.set(e,n)}function ye(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function xe(e,t){return e.get(ye(e,t))}function we(e,t,n){return e.set(ye(e,t),n),n}var dr={widget:{element:"usereq-widget",attribute:"widget-id"},group:{element:"usereq-group",attribute:"group-id"}};function Ue(e){console.warn(`[usereq] ${e}`)}function Gt(e){const{element:t,attribute:n}=dr[e];if(customElements.get(t))return;var r=new WeakMap,o=new WeakMap,i=new WeakSet;class s extends HTMLElement{constructor(...c){super(...c),ur(this,i),Yt(this,r,null),Yt(this,o,0)}connectedCallback(){ye(i,this,u).call(this)}disconnectedCallback(){var c;(c=xe(r,this))===null||c===void 0||c.unmount(),we(r,this,null)}attributeChangedCallback(c,f,p){f!==p&&this.isConnected&&ye(i,this,u).call(this)}}async function u(){var d,c,f,p;const l=(d=this.getAttribute(n))===null||d===void 0?void 0:d.trim();if(!l)return;const h=we(o,this,(c=xe(o,this),++c));(f=xe(r,this))===null||f===void 0||f.unmount(),we(r,this,null);const m=((p=this.getAttribute("api-url"))!==null&&p!==void 0?p:"https://api.usereq.com").replace(/\/+$/,""),y=this.getAttribute("theme"),w=y==="light"||y==="dark"?y:null;let _;try{const g=await Qt({base:m},e,l);_=rn(g,e)}catch(g){g instanceof te?Ue(`${t} ${l}: ${g.message} (${g.code})`):Ue(`${t} ${l}: could not reach ${m}.`);return}if(!(h!==xe(o,this)||!this.isConnected)){if(!_){Ue(`${t} ${l}: the response was not a ${e} snapshot.`);return}we(r,this,Ot(_,this,{apiUrl:m,theme:w}))}}Se(s,"observedAttributes",[n,"api-url","theme"]),customElements.define(t,s)}function fr(){Gt("widget"),Gt("group")}return fr(),ke.render=Ot,ke})({});
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=embed.js.map
|