@usereq/widget 1.0.0-experimental.0 → 1.0.0-experimental.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,16 +19,20 @@ Importing the module instead gives `render(snapshot, host, { apiUrl?, theme?, si
19
19
 
20
20
  ## What it does with a payload
21
21
 
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 |
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`, `chat/session-store.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. The session is kept per surface in `localStorage` (the token is bound to the origin that minted it, and `localStorage` is per origin - so a kept token is only ever presented from the site it belongs to) and a surface that mounts with one reads the thread back (`GET /api/embed/sessions/current`), so a reload or the next page of the site carries the conversation on; a refused session (401/409, expired) is forgotten and minted anew on the next send. The visitor ends it with the `MessageCircleX` control (the panel header, or beside the send where there is no header): the agent asks "Stop the conversation?" in the thread, "Stop conversation" ends it on the server (`POST /api/embed/sessions/current/end` - the dashboard shows it ended) and clears the page for a fresh start; "Keep chatting" takes the card away. Chat only - the other surfaces have no agent |
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 |
30
30
 
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>`.
31
+ Storage keys, all optional conveniences that degrade to "forgotten" (`storage.ts` never throws): `usereq:visitor` (localStorage), `usereq:session:<widgetId>` (localStorage - the chat session, for the token's 24 h), `usereq:once:<ruleId>` (sessionStorage), `usereq:split:<groupId>`, `usereq:seq:<groupId>`.
32
+
33
+ The bubble's panel is a FIXED box on a desktop (`CHAT_BUBBLE` in `@workspace/contracts/embed/presets`, 340 by 480, shrinking only when the viewport is shorter than that plus the launcher): the thread scrolls inside it and the composer stays put, the same size before the first message and after the fiftieth (2026-09-10 - before, the card was as tall as its messages and grew as replies landed). The inline box variant is the same fixed box in the page's flow.
34
+
35
+ The bubble's panel is a FIXED box on a desktop (`CHAT_BUBBLE` in `@workspace/contracts/embed/presets`, 340 by 480, shrinking only when the viewport is shorter than that plus the launcher): the thread scrolls inside it and the composer stays put, the same size before the first message and after the fiftieth (2026-09-10 - before, the card was as tall as its messages and grew as replies landed). The inline box variant is the same fixed box in the page's flow.
32
36
 
33
37
  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.
34
38
 
@@ -43,11 +47,11 @@ bun run size # the gzip gate - fails the build over 25 kB
43
47
 
44
48
  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.
45
49
 
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.
50
+ `USEREQ_EMBED_API_URL` at build time bakes the default API origin (the contracts' `EMBED_API_URL`, `https://api.usereq.com`, otherwise); `api-url` on the element overrides it per mount. The dashboard writes that attribute into the snippet only when its own `NEXT_PUBLIC_API_URL` is not the production API - a dev or staging deployment - so a production snippet stays two lines with nothing to override.
47
51
 
48
52
  ## Publishing
49
53
 
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`.
54
+ From the repo root, `bun run release:embed` (`scripts/release-embed.ts`) bumps `version` in `package.json` to the next `1.0.0-experimental.N` (or the one you name), commits that file, and tags `embed-v<version>` on it - it refuses an uncommitted `packages/embed` or `packages/contracts`, since the runtime bakes the contracts in. Then `git push origin HEAD 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`.
51
55
 
52
56
  ## Not here yet
53
57
 
package/dist/embed.js CHANGED
@@ -1,5 +1,5 @@
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&&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=`
1
+ var UserEQ=(function(Ie){Object.defineProperty(Ie,Symbol.toStringTag,{value:"Module"});async function rn(e){const t=e.getReader(),n=new TextDecoder;let r="",o="";const i=[],a=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),a.set(f.id,""));break;case"text-delta":if("id"in f&&"delta"in f){var h;a.set(f.id,((h=a.get(f.id))!==null&&h!==void 0?h:"")+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=a.get(d))!==null&&c!==void 0?c:""})}}function ee(e){"@babel/helpers - typeof";return ee=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},ee(e)}function on(e,t){if(ee(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(ee(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sn(e){var t=on(e,"string");return ee(t)=="symbol"?t:t+""}function Te(e,t,n){return(t=sn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G=class extends Error{constructor(e,t,n){super(n),Te(this,"status",void 0),Te(this,"code",void 0),this.status=e,this.code=t}};async function te(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 G(e.status,t,n)}var Me=(e,t={})=>({method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(e)});async function an(e,t,n){const r=await fetch(`${e.base}/api/embed/${t}/${n}`);return r.ok?r.json():te(r)}async function ln(e,t){const n=await fetch(`${e.base}/api/embed/sessions`,Me(t));return n.ok?n.json():te(n)}var ze=e=>({Authorization:`Bearer ${e}`});async function cn(e,t){const n=await fetch(`${e.base}/api/embed/sessions/current`,{headers:ze(t)});return n.ok?n.json():te(n)}async function un(e,t){const n=await fetch(`${e.base}/api/embed/sessions/current/end`,{method:"POST",headers:ze(t)});return n.ok?n.json():te(n)}async function dn(e,t,n,r,o){const i=await fetch(`${e.base}/api/embed/chat`,{...Me({message:{id:n.id,role:"user",parts:[{type:"text",text:n.text}]},trigger:r},ze(t)),signal:o});return!i.ok||!i.body?te(i):rn(i.body)}async function fn(e,t){try{const n=await fetch(`${e.base}/api/embed/events`,{...Me(t),keepalive:!0});return n.ok?await n.json():null}catch{return null}}var K=e=>typeof e=="object"&&e!==null;function tt(e){return K(e)&&typeof e.id=="string"&&K(e.config)&&typeof e.config.type=="string"&&K(e.config.appearance)&&Array.isArray(e.rules)}function pn(e){return K(e)&&typeof e.id=="string"&&typeof e.mode=="string"&&K(e.config)&&Array.isArray(e.members)&&e.members.every(t=>K(t)&&tt(t.widget))&&Array.isArray(e.rules)}function hn(e,t){return!K(e)||e.kind!==t?null:t==="widget"&&tt(e.payload)||t==="group"&&pn(e.payload)?e:null}var ue,I,nt,_n,O,rt,it,ot,Ae,de,ne,st,He,Re,Ee,gn,fe={},pe=[],mn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,he=Array.isArray;function W(e,t){for(var n in t)e[n]=t[n];return e}function Pe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function bn(e,t,n){var r,o,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?ue.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return _e(e,a,r,o,null)}function _e(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?++nt:o,__i:-1,__u:0};return o==null&&I.vnode!=null&&I.vnode(i),i}function N(e){return e.children}function ge(e,t){this.props=e,this.context=t}function V(e,t){if(t==null)return e.__?V(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"?V(e):null}function vn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=W({},t);i.__v=t.__v+1,I.vnode&&I.vnode(i),je(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n==null?V(t):n,!!(32&t.__u),o),i.__v=t.__v,i.__.__k[i.__i]=i,ht(r,i,o),t.__e=t.__=null,i.__e!=n&&at(i)}}function at(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}),at(e)}function lt(e){(!e.__d&&(e.__d=!0)&&O.push(e)&&!me.__r++||rt!=I.debounceRendering)&&((rt=I.debounceRendering)||it)(me)}function me(){try{for(var e,t=1;O.length;)O.length>t&&O.sort(ot),e=O.shift(),t=O.length,vn(e)}finally{O.length=me.__r=0}}function ct(e,t,n,r,o,i,a,u,d,c,f){var h,l,p,m,x,v,_=r&&r.__k||pe,g=t.length;for(d=yn(n,t,_,d,g),h=0;h<g;h++)(p=n.__k[h])!=null&&(l=p.__i!=-1&&_[p.__i]||fe,p.__i=h,v=je(e,p,l,o,i,a,u,d,c,f),m=p.__e,p.ref&&l.ref!=p.ref&&(l.ref&&Fe(l.ref,null,p),f.push(p.ref,p.__c||m,p)),x==null&&m!=null&&(x=m),4&p.__u?(d=ut(p,d,e),l.__e&&(l.__e=null)):typeof p.type=="function"&&v!==void 0?d=v:m&&(d=m.nextSibling),p.__u&=-7);return n.__e=x,d}function yn(e,t,n,r,o){var i,a,u,d,c,f=n.length,h=f,l=0;for(e.__k=new Array(o),i=0;i<o;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=_e(null,a,null,null,null):he(a)?a=e.__k[i]=_e(N,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=_e(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,d=i+l,a.__=e,a.__b=e.__b+1,u=null,(c=a.__i=xn(a,n,d,h))!=-1&&(h--,(u=n[c])&&(u.__u|=2)),u==null||u.__v==null?(c==-1&&(o>f?l--:o<f&&l++),typeof a.type!="function"&&(a.__u|=4)):c!=d&&(c==d-1?l--:c==d+1?l++:(c>d?l--:l++,a.__u|=4))):e.__k[i]=null;if(h)for(i=0;i<f;i++)(u=n[i])!=null&&(2&u.__u)==0&&(u.__e==r&&(r=V(u)),gt(u,u));return r}function ut(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=ut(r[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=V(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function xn(e,t,n,r){var o,i,a,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[a=o>=0?o--:i++])!=null&&(2&c.__u)==0&&u==c.key&&d==c.type)return a}return-1}function dt(e,t,n){t[0]=="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||mn.test(t)?n:n+"px"}function be(e,t,n,r,o){var i,a;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||dt(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||dt(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(st,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[ne]=r[ne]:(n[ne]=He,e.addEventListener(t,i?Ee:Re,i)):e.removeEventListener(t,i?Ee:Re,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 ft(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[de]==null)t[de]=He++;else if(t[de]<n[ne])return;return n(I.event?I.event(t):t)}}}function je(e,t,n,r,o,i,a,u,d,c){var f,h,l,p,m,x,v,_,g,y,$,q,z,S,C,w,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),i=[u=t.__e=n.__e]),(f=I.__b)&&f(t);e:if(typeof T=="function"){h=a.length;try{if(g=t.props,y=T.prototype&&T.prototype.render,$=(f=T.contextType)&&r[f.__c],q=f?$?$.props.value:f.__:r,n.__c?_=(l=t.__c=n.__c).__=l.__E:(y?t.__c=l=new T(g,q):(t.__c=l=new ge(g,q),l.constructor=T,l.render=Sn),$&&$.sub(l),l.state||(l.state={}),l.__n=r,p=l.__d=!0,l.__h=[],l._sb=[]),y&&l.__s==null&&(l.__s=l.state),y&&T.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=W({},l.__s)),W(l.__s,T.getDerivedStateFromProps(g,l.__s))),m=l.props,x=l.state,l.__v=t,p)y&&T.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),y&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(y&&T.getDerivedStateFromProps==null&&g!==m&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(g,q),t.__v==n.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(g,l.__s,q)===!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(M){M&&(M.__=t)}),pe.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&a.push(l),u=V(n);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(g,l.__s,q),y&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(m,x,v)})}if(l.context=q,l.props=g,l.__P=e,l.__e=!1,z=I.__r,S=0,y)l.state=l.__s,l.__d=!1,z&&z(t),f=l.render(l.props,l.state,l.context),pe.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,z&&z(t),f=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++S<25);l.state=l.__s,l.getChildContext!=null&&(r=W(W({},r),l.getChildContext())),y&&!p&&l.getSnapshotBeforeUpdate!=null&&(v=l.getSnapshotBeforeUpdate(m,x)),C=f!=null&&f.type===N&&f.key==null?_t(f.props.children):f,u=ct(e,he(C)?C:[C],t,n,r,o,i,a,u,d,c),l.base=t.__e,t.__u&=-161,l.__h.length&&a.push(l),_&&(l.__E=l.__=null)}catch(M){if(a.length=h,t.__v=null,d||i!=null){if(M.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(w=i.length;w--;)Pe(i[w])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),M.then||pt(t),I.__e(M,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):u=t.__e=wn(n.__e,t,n,r,o,i,a,d,c);return(f=I.diffed)&&f(t),128&t.__u?void 0:u}function pt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(pt))}function ht(e,t,n){for(var r=0;r<n.length;r++)Fe(n[r],n[++r],n[++r]);I.__c&&I.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){I.__e(i,o.__v)}})}function _t(e){return typeof e!="object"||e==null||e.__b>0?e:he(e)?e.map(_t):e.constructor!==void 0?null:W({},e)}function wn(e,t,n,r,o,i,a,u,d){var c,f,h,l,p,m,x,v=n.props||fe,_=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((p=i[c])&&"setAttribute"in p==!!g&&(g?p.localName==g:p.nodeType==3)){e=p,i[c]=null;break}}if(e==null){if(g==null)return document.createTextNode(_);e=document.createElementNS(o,g,_.is&&_),u&&(I.__m&&I.__m(t,i),u=!1),i=null}if(g==null)v===_||u&&e.data==_||(e.data=_);else{if(i=g=="textarea"&&_.defaultValue!=null?null:i&&ue.call(e.childNodes),!u&&i!=null)for(v={},c=0;c<e.attributes.length;c++)v[(p=e.attributes[c]).name]=p.value;for(c in v)p=v[c],c=="dangerouslySetInnerHTML"?h=p:c=="children"||c in _||c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _||be(e,c,null,p,o);for(c in _)p=_[c],c=="children"?l=p:c=="dangerouslySetInnerHTML"?f=p:c=="value"?m=p:c=="checked"?x=p:u&&typeof p!="function"||v[c]===p||be(e,c,p,v[c],o);if(f)u||h&&(f.__html==h.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(h&&(e.innerHTML=""),ct(t.type=="template"?e.content:e,he(l)?l:[l],t,n,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&V(n,0),u,d),i!=null)for(c=i.length;c--;)Pe(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!=v[c])&&be(e,c,m,v[c],o),c="checked",x!=null&&x!=e[c]&&be(e,c,x,v[c],o))}return e}function Fe(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){I.__e(o,n)}}function gt(e,t,n){var r,o;if(I.unmount&&I.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Fe(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){I.__e(i,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&gt(r[o],t,n||typeof e.type!="function");n||Pe(e.__e),e.__c=e.__=e.__e=void 0}function Sn(e,t,n){return this.constructor(e,n)}function mt(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),I.__&&I.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],a=[],je(t,e=(!r&&n||t).__k=bn(N,null,[e]),o||fe,fe,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?ue.call(t.childNodes):null,i,!r&&n?n:o?o.__e:t.firstChild,r,a),ht(i,e,a),e.props.children=null}ue=pe.slice,I={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(u){e=u}throw e}},nt=0,_n=function(e){return e!=null&&e.constructor===void 0},ge.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=W({},this.state);typeof e=="function"&&(e=e(W({},n),this.props)),e&&W(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),lt(this))},ge.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),lt(this))},ge.prototype.render=N,O=[],it=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ot=function(e,t){return e.__v.__b-t.__v.__b},me.__r=0,Ae=Math.random().toString(8),de="__d"+Ae,ne="__a"+Ae,st=/(PointerCapture)$|Capture$/i,He=0,Re=ft(!1),Ee=ft(!0),gn=0;var re,A,Be,bt,ie=0,vt=[],R=I,yt=R.__b,xt=R.__r,wt=R.diffed,St=R.__c,kt=R.unmount,$t=R.__;function De(e,t){R.__h&&R.__h(A,e,ie||t),ie=0;var n=A.__H||(A.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return ie=1,kn(It,e)}function kn(e,t,n){var r=De(re++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):It(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=A,!A.__f)){var o=function(u,d,c){if(!r.__c.__H)return!0;var f=!1,h=r.__c.props!==u;if(r.__c.__H.__.some(function(p){if(p.__N){f=!0;var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(h=!0)}}),i){var l=i.call(this,u,d,c);return f?l||h:l}return!f||h};A.__f=!0;var i=A.shouldComponentUpdate,a=A.componentWillUpdate;A.componentWillUpdate=function(u,d,c){if(this.__e){var f=i;i=void 0,o(u,d,c),i=f}a&&a.call(this,u,d,c)},A.shouldComponentUpdate=o}return r.__N||r.__}function P(e,t){var n=De(re++,3);!R.__s&&qt(n.__H,t)&&(n.__=e,n.u=t,A.__H.__h.push(n))}function B(e){return ie=5,ve(function(){return{current:e}},[])}function ve(e,t){var n=De(re++,7);return qt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function U(e,t){return ie=8,ve(function(){return e},t)}function $n(){for(var e;e=vt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ye),t.__h.some(We),t.__h=[]}catch(n){t.__h=[],R.__e(n,e.__v)}}}R.__b=function(e){A=null,yt&&yt(e)},R.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),$t&&$t(e,t)},R.__r=function(e){xt&&xt(e),re=0;var t=(A=e.__c).__H;t&&(Be===A?(t.__h=[],A.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ye),t.__h.some(We),t.__h=[],re=0)),Be=A},R.diffed=function(e){wt&&wt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vt.push(t)!==1&&bt===R.requestAnimationFrame||((bt=R.requestAnimationFrame)||Cn)($n)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Be=A=null},R.__c=function(e,t){t.some(function(n){try{n.__h.some(ye),n.__h=n.__h.filter(function(r){return!r.__||We(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],R.__e(r,n.__v)}}),St&&St(e,t)},R.unmount=function(e){kt&&kt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ye(r)}catch(o){t=o}}),n.__H=void 0,t&&R.__e(t,n.__v))};var Ct=typeof requestAnimationFrame=="function";function Cn(e){var t,n=function(){clearTimeout(r),Ct&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ct&&(t=requestAnimationFrame(n))}function ye(e){var t=A,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),A=t}function We(e){var t=A;e.__c=e.__(),A=t}function qt(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function It(e,t){return typeof t=="function"?t(e):t}var qn=`
3
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
4
  :host([hidden]){display:none}
5
5
  *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
@@ -31,8 +31,8 @@ img,video{display:block;max-width:100%}
31
31
  .uq-slide{animation:uq-slide .3s cubic-bezier(.32,.72,0,1) both}
32
32
  @keyframes uq-slide{from{transform:translateY(100%)}to{transform:none}}
33
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})({});
34
+ `;function oe(e,t){try{return window[e].getItem(t)}catch{return null}}function se(e,t,n){try{window[e].setItem(t,n)}catch{}}function Tt(e,t){try{window[e].removeItem(t)}catch{}}var In=2e3,Tn=20,Mn=100;function Le(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 Mt="usereq:visitor";function zt(){const e=oe("localStorage",Mt);if(e)return e;const t=Le();return se("localStorage",Mt,t),t}function zn(e,t){const n=[];let r=null;const o=zt(),i=()=>{for(r!==null&&(window.clearTimeout(r),r=null);n.length>0;){const u=n.splice(0,Mn);fn(e,{events:u})}},a=(u,d={})=>{n.push({id:Le(),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>=Tn?i():r===null&&(r=window.setTimeout(i,In))};return window.addEventListener("pagehide",i),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&i()}),{report:a,flush:i}}var At=e=>`usereq:once:${e}`;function Oe(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 An(e,t){switch(e.kind){case"path":return e.value==="*"||Oe(e.op,t.path,e.value);case"utm":var n;return Oe(e.op,(n=t.utm[e.param])!==null&&n!==void 0?n:"",e.value);case"device":return t.device===e.value;case"referrer":return Oe(e.op,t.referrer,e.value)}}function Hn(e,t){for(const n of e)if(!(n.once&&oe("sessionStorage",At(n.id)))&&n.conditions.every(r=>An(r,t)))return n;return null}function Ht(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 a;const d=String((a=t.selector)!==null&&a!==void 0?a:""),c=f=>{const h=f.target;if(!(!(h instanceof Element)||!d))try{h.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 h=null;try{h=d?document.querySelector(d):null}catch{h=null}return h?(c=new IntersectionObserver(l=>{l.some(p=>p.isIntersecting)&&i()}),c.observe(h),!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 Rt(e,t,n){const r=Hn(e,t);return r?Ht(r.trigger,r.triggerParams,()=>{r.once&&se("sessionStorage",At(r.id),"1"),n(r)}):()=>{}}var Et=e=>`usereq:split:${e}`,Pt=e=>`usereq:seq:${e}`;function Rn(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 xe(e){return[...e].sort((t,n)=>t.position-n.position)}function En(e){const t=xe(e.members);if(t.length===0)return null;const n=oe("localStorage",Et(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=Rn(`${zt()}:${e.config.salt}`)%o,a=t[t.length-1];for(const u of t){if(i<u.weight){a=u;break}i-=u.weight}return se("localStorage",Et(e.id),a.widget.id),a}function jt(e){var t,n;const r=xe(e.members);if(r.length===0)return null;const o=Number((t=oe("sessionStorage",Pt(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 Pn(e,t,n){if(!t.advanceOn)return()=>{};const r=xe(e.members),o=r.findIndex(i=>i.widget.id===t.widget.id);return Ht(t.advanceOn.kind,t.advanceOn.params,()=>{var i;const a=o+1<r.length?o+1:null;if(a===null){n(null);return}se("sessionStorage",Pt(e.id),String(a)),n((i=r[a])!==null&&i!==void 0?i:null)})}function jn(e){switch(e.mode){case"split":{const t=En(e);return t?[t.widget]:[]}case"sequence":{const t=jt(e);return t?[t.widget]:[]}case"parallel":return xe(e.members).map(t=>t.widget)}}function Fn(e){var t,n,r,o;if(e)return e==="dark";const i=(t=Ft(getComputedStyle(document.body).backgroundColor))!==null&&t!==void 0?t:Ft(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 Ft(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 Bn(e=window.innerWidth){return e<640?"mobile":e<1024?"tablet":"desktop"}function Dn(){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:Bn()}}function Bt(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 Wn(e){const{r:t,g:n,b:r}=Bt(e);return(.299*t+.587*n+.114*r)/255>.62?"#15171e":"#ffffff"}var ae=e=>e?"245,245,241":"21,23,30";function Ln(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:a}=Bt(r);return`rgba(${o},${i},${a},${n.alpha/100})`})(),accentText:Wn(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:ae(t),surfaceBg:t?"#181b22":"#ffffff",side:n.position==="bottom-right"?{right:n.offsetX}:{left:n.offsetX},offsetY:n.offsetY}}function k(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 On=0,Tr=Array.isArray;function s(e,t,n,r,o,i){t||(t={});var a,u,d=t;if("ref"in d)for(u in d={},t)u=="ref"?a=t[u]:d[u]=t[u];var c={type:e,props:d,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--On,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(u in a)d[u]===void 0&&(d[u]=a[u]);return I.vnode&&I.vnode(c),c}function j({size:e,children:t}){return s("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 Dt=({size:e})=>s(j,{size:e,children:[s("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"}),s("path",{d:"M20 2v4"}),s("path",{d:"M22 4h-4"}),s("circle",{cx:"4",cy:"20",r:"2"})]}),Wt=({size:e})=>s(j,{size:e,children:[s("path",{d:"M5 12h14"}),s("path",{d:"m12 5 7 7-7 7"})]}),we=({size:e})=>s(j,{size:e,children:[s("path",{d:"M18 6 6 18"}),s("path",{d:"m6 6 12 12"})]}),Ne=({size:e})=>s(j,{size:e,children:[s("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}),s("path",{d:"m15 9-6 6"}),s("path",{d:"m9 9 6 6"})]}),Nn=({size:e})=>s(j,{size:e,children:s("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"})}),Un=({size:e})=>s(j,{size:e,children:[s("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"}),s("rect",{x:"2",y:"6",width:"14",height:"12",rx:"2"})]}),Yn=({size:e})=>s(j,{size:e,children:[s("circle",{cx:"12",cy:"12",r:"10"}),s("path",{d:"M12 16v-4"}),s("path",{d:"M12 8h.01"})]}),Lt=({size:e})=>s(j,{size:e,children:s("path",{d:"m6 9 6 6 6-6"})}),Gn=({size:e})=>s(j,{size:e,children:s("path",{d:"M5 12h14"})}),Kn=({size:e})=>s(j,{size:e,children:[s("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"}),s("path",{d:"m21.854 2.147-10.94 10.939"})]}),Vn=({size:e})=>s(j,{size:e,children:[s("path",{d:"M15 3h6v6"}),s("path",{d:"M10 14 21 3"}),s("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),Xn=({size:e,d:t})=>s("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:s("path",{d:t})});function Jn({payload:e,look:t,reporter:n,open:r,setOpen:o,pinned:i}){var a;const u=e.config,{accentFill:d,accentText:c,rad:f}=t;if(!r)return null;const h=!((a=u.cta)===null||a===void 0)&&a.label.trim()?u.cta:null,l=(h==null?void 0:h.href.trim())||"",p=u.position==="bottom"?{bottom:0}:{top:0};return s("div",{class:k(u,"strip","uq-fixed uq-fade"),role:"region","aria-label":"Announcement",style:{left:0,right:0,...p,display:"flex",alignItems:"center",justifyContent:"center",gap:14,padding:"11px 14px",background:d,color:c},children:[s("span",{class:k(u,"text"),style:{fontSize:12.5,fontWeight:500},children:u.text}),h&&s("a",{class:k(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:h.label}),!i&&s("button",{type:"button",class:k(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:s(we,{size:14})})]})}var X={panelWidth:340,panelHeight:480,launcherSize:44,panelGap:10},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},Ue={holdMs:1260,gapMs:1520,jitterMs:100};function Qn(e,t=Math.random){const n=[];let r=0;for(let o=0;o<e;o++){if(o===0)r+=Ue.holdMs;else{const i=Math.round((t()*2-1)*Ue.jitterMs);r+=Math.max(0,Ue.gapMs+i)}n.push(r)}return n}var Se=e=>`usereq:session:${e}`;function Zn(e,t=Date.now()){const n=oe("localStorage",Se(e));if(!n)return null;try{const r=JSON.parse(n);if(typeof r!="object"||r===null||!("token"in r)||typeof r.token!="string"||!("conversationId"in r)||typeof r.conversationId!="string"||!("expiresAt"in r)||typeof r.expiresAt!="string")return null;const o=Date.parse(r.expiresAt);return!Number.isFinite(o)||o<=t?(Tt("localStorage",Se(e)),null):{token:r.token,conversationId:r.conversationId,expiresAt:r.expiresAt}}catch{return null}}function er(e,t){se("localStorage",Se(e),JSON.stringify(t))}function tr(e){Tt("localStorage",Se(e))}function nr(e){const t=e.parts.map(n=>n.text).filter(n=>n.trim());return t.length===0?null:{id:e.id,role:e.role,parts:t,shown:t.length}}function rr(e,t,n,r){const[o,i]=E([]),[a,u]=E(!1),[d,c]=E(null),[f,h]=E(null),[l,p]=E(null),m=B(null),x=B(null),v=B([]),_=B(null),g=()=>{for(const S of v.current)window.clearTimeout(S);v.current=[]};P(()=>()=>g(),[]);const y=t.id,$=U(()=>{m.current=null,h(null),tr(y)},[y]);P(()=>{const S=Zn(y);if(!S)return;let C=!1;return m.current={token:S.token,conversationId:S.conversationId},h(S.conversationId),cn(e,S.token).then(w=>{if(!C){if(w.ended){$();return}i(w.messages.flatMap(T=>{const M=nr(T);return M?[M]:[]}))}}).catch(w=>{C||w instanceof G&&w.status<500&&$()}),()=>{C=!0}},[e,y,$]);const q=U(async()=>{if(m.current)return m.current;const S=await ln(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 m.current={token:S.token,conversationId:S.conversationId},er(y,{token:S.token,conversationId:S.conversationId,expiresAt:S.expiresAt}),h(S.conversationId),m.current},[e,n.kind,n.id,t.id,r,y]),z=U(async(S,C)=>{var w;(w=x.current)===null||w===void 0||w.abort();const T=new AbortController;x.current=T,g(),u(!0),c(null);try{const{token:M}=await q(),Q=await dn(e,M,S,C,T.signal);if(T.signal.aborted)return;const F=Q.parts.filter(L=>L.trim());if(F.length===0)throw new Error("The agent did not answer. Try again.");i(L=>[...L,{id:Q.id,role:"assistant",parts:F,shown:0}]),v.current=Qn(F.length).map((L,ce)=>window.setTimeout(()=>{i(Y=>Y.map(D=>D.id===Q.id?{...D,shown:ce+1}:D)),ce===F.length-1&&u(!1)},L))}catch(M){if(T.signal.aborted)return;M instanceof G&&(M.status===401||M.status===409)&&$(),u(!1),c(M instanceof G?M.message:M instanceof TypeError?"Could not reach the agent. Try again.":M instanceof Error&&M.message?M.message:"Something went wrong. Try again.")}},[e,q,$]);return{turns:o,busy:a,error:d,sessionId:f,stopping:l,send:U(S=>{const C=S.trim().slice(0,4e3);if(!C||a||l)return;const w={id:Le(),text:C};_.current=w,i(T=>[...T,{id:w.id,role:"user",parts:[C],shown:1}]),z(w,"submit-message")},[a,l,z]),retry:U(()=>{!_.current||a||l||z(_.current,"regenerate-message")},[a,l,z]),stop:U(()=>{var S;(S=x.current)===null||S===void 0||S.abort(),x.current=null,g(),i(C=>C.map(w=>w.role==="assistant"&&w.shown<w.parts.length?{...w,shown:w.parts.length}:w)),u(!1)},[]),askToStop:U(()=>{!m.current||a||p({busy:!1,error:null})},[a]),answerStop:U(async S=>{const C=m.current;if(!S||!C){p(null);return}p({busy:!0,error:null});try{await un(e,C.token)}catch(w){if(!(w instanceof G&&(w.status===401||w.status===409))){p({busy:!1,error:w instanceof G?w.message:"Could not stop the conversation. Try again."});return}}$(),_.current=null,i([]),c(null),p(null)},[e,$])}}function ir(){const e="(max-width: 639px)",[t,n]=E(()=>{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 a=()=>n(i.matches);return i.addEventListener("change",a),()=>i.removeEventListener("change",a)},[]),t}var or=.5,Ot=120,Ye=()=>document.documentElement.clientHeight;function Nt({look:e,pinned:t,onClose:n,children:r}){const[o,i]=E("half"),[a,u]=E(null),d=B(null),c=B(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))},h=_=>{const g=c.current;if(!g)return;const y=_.timeStamp-g.lastAt;y>0&&(g.velocity=(_.clientY-g.lastY)/y),g.lastY=_.clientY,g.lastAt=_.timeStamp;const $=g.startHeight+(g.startY-_.clientY);u(Math.max(Ot,Math.min(Ye(),$)))},l=()=>{const _=c.current;if(!_)return;c.current=null;const g=Math.max(Ot,Math.min(Ye(),_.startHeight+(_.startY-_.lastY))),y=Ye();let $;if(_.velocity<-.5?$="full":_.velocity>or?$=o==="full"?"half":"closed":g>y*.75?$="full":g<y*.3?$="closed":$="half",u(null),$==="closed"){t?i("half"):n();return}i($)},{ink:p,surfaceBg:m,rad:x}=e,v=o==="full"&&a===null;return s("div",{ref:d,class:["uq-fixed uq-drawer uq-slide",v?"uq-drawer-full":"uq-drawer-half",a!==null&&"uq-drawer-held"].filter(Boolean).join(" "),role:"dialog","aria-modal":"false",style:{height:a!==null?a:void 0,borderRadius:v?0:`${x}px ${x}px 0 0`,borderTop:`1px solid rgba(${p},.12)`,background:m,boxShadow:"0 -12px 40px rgba(0,0,0,.18)"},children:[s("div",{class:"uq-grab",onPointerDown:f,onPointerMove:h,onPointerUp:l,onPointerCancel:l,"aria-label":v?"Drag down to shrink or close":"Drag up to expand",style:{background:m},children:s("span",{style:{background:`rgba(${p},.25)`}})}),r]})}var sr=3600,Ge=e=>e.welcome||"Hi! Ask me anything before you buy.";function Ut(e,t="Type your message…"){const n=e.spotlights.filter(a=>a.trim()),[r,o]=E(0);P(()=>{if(n.length<2)return;const a=window.setInterval(()=>o(u=>u+1),sr);return()=>window.clearInterval(a)},[n.length]);const i=e.placeholder||t;return n.length?n[r%n.length]:i}function ke(e){const t=B(null);return P(()=>{const n=t.current;n&&(n.scrollTop=n.scrollHeight)},e),t}function Yt(e){const t=e?"dark":"light";return{surface:b.surface[t],bubble:b.bubble[t],muted:b.muted[t],border:b.border[t]}}var J=(e,t={})=>({width:e,height:e,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,...t});function Ke({payload:e,size:t,font:n,palette:r,fallback:o}){var i,a,u,d;const c=(i=(a=e.agent)===null||a===void 0?void 0:a.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?s("img",{src:f,alt:"",width:t,height:t,style:J(t,{objectFit:"cover"})}):s("span",{style:J(t,{background:r.bubble,color:r.muted,fontSize:n,fontWeight:600,...o}),children:c?c.trim().charAt(0).toUpperCase():"A"})}function Ve({text:e,mine:t,runStart:n,look:r,config:o,payload:i,palette:a,children:u}){return s("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?s(Ke,{payload:i,size:b.avatarSize,font:12,palette:a}):s("span",{style:{width:b.avatarSize,flexShrink:0}})),s("div",{class:k(o,t?"userMessage":"botMessage"),style:{maxWidth:b.bubbleMaxWidth,padding:u?"8px 12px":b.bubblePadding,borderRadius:b.bubbleRadius,background:t?b.gradient:a.bubble,color:t?"#fff":`rgb(${r.ink})`,fontSize:b.bubbleFont,lineHeight:1.375,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:u!=null?u:e})]})}function ar({chat:e,stopping:t}){const n={padding:"6px 12px",borderRadius:999,fontSize:13,fontWeight:600,lineHeight:1.3,opacity:t.busy?.6:1};return s("div",{class:"uq-stop",style:{display:"flex",flexDirection:"column",gap:8},children:[s("span",{style:{fontWeight:600},children:"Stop the conversation?"}),s("span",{children:"Do you want to stop this conversation?"}),s("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[s("button",{type:"button",onClick:()=>e.answerStop(!1),disabled:t.busy,style:{...n,border:`1px solid ${b.blue}`,color:b.blue},children:"Keep chatting"}),s("button",{type:"button",onClick:()=>e.answerStop(!0),disabled:t.busy,style:{...n,background:b.gradient,color:"#fff"},children:t.busy?"Stopping…":"Stop conversation"})]}),t.error&&s("span",{class:"uq-fade",style:{opacity:.7},children:t.error})]})}function Gt({payload:e,config:t,look:n,chat:r,focus:o,onCta:i,mobile:a,fill:u=!1,onMinimize:d,onClose:c}){var f,h,l,p;const m=Yt(n.hostDark),{surface:x,bubble:v,muted:_,border:g}=m,y=Ut(t,b.composerPlaceholder),$=(f=(h=e.agent)===null||h===void 0?void 0:h.name)!==null&&f!==void 0?f:null,q=!!(!((l=e.agent)===null||l===void 0)&&l.live),z=ke([r.turns,r.busy,r.error,r.stopping]),[S,C]=E(""),w=B(null);P(()=>{var H;o>0&&((H=w.current)===null||H===void 0||H.focus())},[o]);const T=q&&!r.stopping,M=H=>{H.preventDefault(),T&&(r.send(S),C(""))},Q=!((p=t.cta)===null||p===void 0||(p=p.href)===null||p===void 0)&&p.trim()?t.cta:null,F=[{key:"welcome",text:Ge(t),mine:!1}];for(const H of r.turns)if(H.role==="user"){var L;F.push({key:H.id,text:(L=H.parts[0])!==null&&L!==void 0?L:"",mine:!0})}else H.parts.slice(0,H.shown).forEach((Z,Ze)=>{F.push({key:`${H.id}:${Ze}`,text:Z,mine:!1})});const ce=F[F.length-1],Y=(H,Z,Ze,et,nn)=>s("button",{type:"button",class:nn?k(t,nn):void 0,onClick:et,disabled:!et,"aria-label":Z,style:J(a?36:b.headerButton,{color:Ze,opacity:et?1:.6}),children:H}),D=b.headerIcon;return s("div",{class:k(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:x,color:`rgb(${n.ink})`,...u?{flex:1,minHeight:0}:{height:b.panelHeight,maxHeight:`calc(100vh - ${n.offsetY+b.launcherSize+b.panelGap+12}px)`}},children:[s("div",{class:k(t,"header"),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderBottom:`1px solid ${g}`},children:[s(Ke,{payload:e,size:b.headerAvatar,font:14,palette:m}),s("span",{style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:2},children:[s("span",{style:{fontSize:b.nameFont,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:$?$.split("—")[0].trim():"Chat"}),s("span",{style:{color:_,opacity:.7,display:"flex"},children:s(Lt,{size:16})})]}),Y(s(Nn,{size:D}),"Call (unavailable)",b.blue),Y(s(Un,{size:D}),"Video call (unavailable)",b.blue),Y(s(Yn,{size:D}),"Details (unavailable)",_),r.sessionId&&Y(s(Ne,{size:D}),"Stop conversation",_,r.busy||r.stopping?void 0:r.askToStop,"stopButton"),d&&Y(s(Gn,{size:D}),"Minimize chat",_,d),c&&Y(s(we,{size:D}),"Close chat",_,c,"close")]}),s("div",{ref:z,style:{flex:1,minHeight:0,padding:"6px 12px 12px",display:"flex",flexDirection:"column",overflowY:"auto",overscrollBehavior:"contain"},children:[F.map((H,Z)=>s(Ve,{text:H.text,mine:H.mine,runStart:Z===0||F[Z-1].mine!==H.mine,look:n,config:t,payload:e,palette:m},H.key)),r.stopping&&s(Ve,{mine:!1,runStart:ce.mine,look:n,config:t,payload:e,palette:m,children:s(ar,{chat:r,stopping:r.stopping})}),r.busy&&s(Ve,{mine:!1,runStart:ce.mine,look:n,config:t,payload:e,palette:m,children:s("span",{class:"uq-dots","aria-label":"Typing",style:{gap:4},children:[s("span",{style:{width:6,height:6}}),s("span",{style:{width:6,height:6}}),s("span",{style:{width:6,height:6}})]})}),r.error&&s("div",{class:"uq-error uq-fade",style:{display:"flex",gap:8,marginTop:6,paddingLeft:b.avatarSize+6,fontSize:12,color:_},children:[s("span",{children:r.error}),s("button",{type:"button",onClick:r.retry,style:{color:b.blue,fontWeight:500,textDecoration:"underline"},children:"Retry"})]})]}),Q&&s("div",{style:{display:"flex",justifyContent:"flex-end",padding:"8px 12px"},children:s("a",{class:"uq-cta",href:Q.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:[Q.label||"Learn more",s(Vn,{size:16})]})}),s("form",{class:k(t,"composer"),onSubmit:M,style:{display:"flex",alignItems:"center",gap:4,padding:8,borderTop:`1px solid ${g}`},children:[s("input",{ref:w,type:"text",value:S,onInput:H=>C(H.target.value),placeholder:y,disabled:!T,maxLength:4e3,"aria-label":"Message",autoComplete:"off",style:{flex:1,minHeight:b.composerHeight,padding:"0 12px",borderRadius:b.composerRadius,background:v,color:`rgb(${n.ink})`,fontSize:a?16:14,"--uq-placeholder":_}}),r.busy?s("button",{type:"button",class:k(t,"sendButton"),onClick:r.stop,"aria-label":"Stop",style:J(b.sendSize,{color:b.blue}),children:s("span",{style:{width:10,height:10,background:"currentColor",borderRadius:2}})}):s("button",{type:"submit",class:k(t,"sendButton"),disabled:!T||!S.trim(),"aria-label":"Send",style:J(b.sendSize,{color:b.blue,opacity:T&&S.trim()?1:.5}),children:s(Kn,{size:b.sendIcon})})]})]})}function lr({payload:e,config:t,look:n,chat:r,mobile:o,focus:i,open:a,setOpen:u,pinned:d,onCta:c}){const f=Yt(n.hostDark),{side:h,offsetY:l}=n,p=d?void 0:()=>u(!1);if(a&&o){const m={...n,surfaceBg:f.surface,rad:b.panelRadius};return s(Nt,{look:m,pinned:d,onClose:()=>u(!1),children:s(Gt,{payload:e,config:t,look:n,chat:r,focus:i,onCta:c,mobile:!0,fill:!0,onClose:p})})}return s(N,{children:[a&&s("div",{class:"uq-fixed uq-rise",style:{bottom:l+b.launcherSize+b.panelGap,width:b.panelWidth,...h},children:s(Gt,{payload:e,config:t,look:n,chat:r,focus:i,onCta:c,mobile:!1,onMinimize:p,onClose:p})}),s("button",{type:"button",class:k(t,"launcher","uq-fixed"),"aria-label":a?"Close chat":"Open chat","aria-expanded":a,onClick:()=>{a&&d||u(!a)},style:{bottom:l,...J(b.launcherSize,{boxShadow:b.launcherShadow}),...h},children:[s(Ke,{payload:e,size:b.launcherSize,font:16,palette:f,fallback:{background:b.gradient,color:"#fff"}}),a?s("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"rgba(0,0,0,.45)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff"},children:s(Lt,{size:28})}):s("span",{style:{position:"absolute",right:-4,bottom:-4,...J(b.badgeSize,{background:b.accent,color:"#fff",boxShadow:`0 0 0 2px ${f.surface}`})},children:s(Xn,{size:12,d:b.logo})})]})]})}function le({text:e,mine:t,onDark:n,look:r,config:o,children:i}){const a=ae(n),{isGlass:u,accentFill:d,accentText:c,rad:f}=r;return s("div",{class:k(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(${a},${n?.1:.06})`,color:t?c:u?"#fff":`rgb(${a})`,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 cr=e=>s(le,{mine:!1,...e,children:s("span",{class:"uq-dots","aria-label":"Typing",children:[s("span",{}),s("span",{}),s("span",{})]})});function ur({chat:e,onDark:t,look:n,config:r}){const o=e.stopping;if(!o)return null;const{isGlass:i,accent:a,accentFill:u,accentText:d,rad:c}=n,f=i?"#fff":a,h={padding:"5px 10px",borderRadius:c,fontSize:11.5,fontWeight:500,lineHeight:1.3,opacity:o.busy?.6:1};return s(le,{mine:!1,onDark:t,look:n,config:r,children:s("div",{class:"uq-stop",style:{display:"flex",flexDirection:"column",gap:8},children:[s("span",{style:{fontWeight:600},children:"Stop the conversation?"}),s("span",{children:"Do you want to stop this conversation?"}),s("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[s("button",{type:"button",onClick:()=>e.answerStop(!1),disabled:o.busy,style:{...h,border:`1px solid ${f}`,color:f},children:"Keep chatting"}),s("button",{type:"button",onClick:()=>e.answerStop(!0),disabled:o.busy,style:{...h,background:u,color:d},children:o.busy?"Stopping…":"Stop conversation"})]}),o.error&&s("span",{class:"uq-fade",style:{opacity:.7},children:o.error})]})})}function Kt({config:e,look:t,onDark:n,chat:r,size:o}){if(!r.sessionId)return null;const i=ae(n),a=!r.busy&&!r.stopping;return s("button",{type:"button",class:k(e,"stopButton"),onClick:r.askToStop,disabled:!a,"aria-label":"Stop conversation",style:{width:o,height:o,borderRadius:t.rad,color:t.isGlass?"#fff":`rgb(${i})`,opacity:a?.55:.3,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s(Ne,{size:o-9})})}function Vt({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?s("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 Xt({config:e,look:t,onDark:n,hint:r,chat:o,disabled:i,focus:a,withStop:u=!1}){const d=ae(n),{isGlass:c,accentFill:f,accentText:h,rad:l}=t,[p,m]=E(""),x=B(null);P(()=>{var y;a>0&&((y=x.current)===null||y===void 0||y.focus())},[a]);const v=i||!!o.stopping,_=y=>{y.preventDefault(),!v&&(o.send(p),m(""))},g=c?"rgba(255,255,255,.75)":`rgba(${d},${n?.6:.45})`;return s("form",{class:k(e,"composer"),onSubmit:_,style:{display:"flex",alignItems:"center",gap:8,padding:"7px 8px 7px 11px",borderRadius:l,border:c?"1px solid rgba(255,255,255,.35)":`1px solid rgba(${d},${n?.28:.12})`,background:c?"rgba(10,12,18,.3)":`rgba(${d},${n?.08:.02})`,backdropFilter:c||n?"blur(6px)":void 0},children:[s("input",{ref:x,type:"text",value:p,onInput:y=>m(y.target.value),placeholder:r||"Message…",disabled:v,maxLength:4e3,"aria-label":"Message",autoComplete:"off",style:{flex:1,fontSize:11.5,color:c?"#fff":`rgb(${d})`,"--uq-placeholder":g}}),u&&s(Kt,{config:e,look:t,onDark:n,chat:o,size:24}),o.busy?s("button",{type:"button",class:k(e,"sendButton"),onClick:o.stop,"aria-label":"Stop",style:{width:24,height:24,borderRadius:l,background:f,color:h,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s("span",{style:{width:8,height:8,background:"currentColor",borderRadius:1}})}):s("button",{type:"submit",class:k(e,"sendButton"),disabled:v,"aria-label":"Send",style:{width:24,height:24,borderRadius:l,background:f,color:h,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,opacity:v?.5:1},children:s(Wt,{size:13})})]})}function Xe({welcome:e,chat:t,onDark:n,look:r,config:o}){const i=ae(n);return s(N,{children:[s(le,{text:e,mine:!1,onDark:n,look:r,config:o}),t.turns.map(a=>a.role==="user"?s(le,{text:a.parts[0],mine:!0,onDark:n,look:r,config:o},a.id):a.parts.slice(0,a.shown).map((u,d)=>s(le,{text:u,mine:!1,onDark:n,look:r,config:o},`${a.id}:${d}`))),s(ur,{chat:t,onDark:n,look:r,config:o}),t.busy&&s(cr,{onDark:n,look:r,config:o}),t.error&&s("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:[s("span",{children:t.error}),s("button",{type:"button",onClick:t.retry,style:{color:r.isGlass?"#fff":r.accent,fontWeight:500,textDecoration:"underline"},children:"Retry"})]})]})}function Je({payload:e,config:t,look:n,chat:r,shadow:o,hint:i,focus:a,onCta:u,fill:d=!1,height:c=X.panelHeight,maxHeight:f,onClose:h}){var l,p,m;const{ink:x,surfaceBg:v,hostDark:_,accentFill:g,accentText:y,rad:$}=n,q=(l=(p=e.agent)===null||p===void 0?void 0:p.name)!==null&&l!==void 0?l:null,z=q?q.trim().charAt(0).toUpperCase():"A",S=Ge(t),C=ke([r.turns,r.busy,r.error,r.stopping]),w=!!(!((m=e.agent)===null||m===void 0)&&m.live);return s("div",{class:k(t,"panel"),style:{width:"100%",borderRadius:d?0:$,overflow:"hidden",border:d?void 0:`1px solid rgba(${x},.12)`,boxShadow:o?"0 18px 44px rgba(0,0,0,.16)":void 0,background:v,display:"flex",flexDirection:"column",...d?{flex:1,minHeight:0}:{height:c,maxHeight:f}},children:[s("div",{class:k(t,"header"),style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:g,color:y},children:[s("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:y},children:z}),s("span",{style:{fontSize:12,fontWeight:500},children:q?q.split("—")[0].trim():"Chat"}),s("span",{style:{marginLeft:"auto",fontSize:10,opacity:.8},children:w?"online":"offline"}),r.sessionId&&s("button",{type:"button",class:k(t,"stopButton"),onClick:r.askToStop,disabled:r.busy||!!r.stopping,"aria-label":"Stop conversation",style:{width:28,height:28,marginRight:h?0:-6,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",color:y,opacity:r.busy||r.stopping?.5:.9,flexShrink:0},children:s(Ne,{size:15})}),h&&s("button",{type:"button",class:k(t,"close"),onClick:h,"aria-label":"Close chat",style:{width:28,height:28,marginRight:-6,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",color:y,flexShrink:0},children:s(we,{size:16})})]}),s("div",{ref:C,style:{display:"flex",flexDirection:"column",gap:7,padding:12,background:v,flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},children:s(Xe,{welcome:S,chat:r,onDark:_,look:n,config:t})}),s("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"0 12px 12px",background:v},children:[s(Vt,{config:t,look:n,onClick:u}),s(Xt,{config:t,look:n,onDark:_,hint:i,chat:r,disabled:!w,focus:a})]})]})}function dr({payload:e,look:t,api:n,embed:r,page:o,reporter:i,open:a,setOpen:u,pinned:d,focus:c}){var f;const h=e.config,l=rr(n,e,r,o),p=Ut(h),{accentFill:m,accentText:x,rad:v,side:_,offsetY:g}=t,y=ir(),$=!!(!((f=e.agent)===null||f===void 0)&&f.live),q=Ge(h),z=()=>{var C,w;return i.report("cta.clicked",{widgetId:e.id,sessionId:(C=l.sessionId)!==null&&C!==void 0?C:void 0,payload:{href:(w=h.cta)===null||w===void 0?void 0:w.href}})};if(t.isMessenger)return s(lr,{payload:e,config:h,look:t,chat:l,mobile:y,focus:c,open:a,setOpen:u,pinned:d,onCta:z});if(h.variant==="bubble"){const C=g+X.launcherSize+X.panelGap;return a&&y?s(Nt,{look:t,pinned:d,onClose:()=>u(!1),children:s(Je,{payload:e,config:h,look:t,chat:l,shadow:!1,hint:p,focus:c,onCta:z,fill:!0,onClose:d?void 0:()=>u(!1)})}):s(N,{children:[a&&s("div",{class:"uq-fixed uq-rise",style:{bottom:C,width:X.panelWidth,..._},children:s(Je,{payload:e,config:h,look:t,chat:l,shadow:!0,hint:p,focus:c,onCta:z,maxHeight:`calc(100vh - ${C+12}px)`})}),s("button",{type:"button",class:k(h,"launcher","uq-fixed"),"aria-label":a?"Close chat":"Open chat","aria-expanded":a,onClick:()=>{a&&d||u(!a)},style:{bottom:g,width:X.launcherSize,height:X.launcherSize,borderRadius:Math.min(X.launcherSize/2,v*2),background:m,color:x,display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 10px 26px rgba(0,0,0,.24)",..._},children:s(Dt,{size:20})})]})}if(h.variant==="box")return s("div",{class:"uq-inline",children:s(Je,{payload:e,config:h,look:t,chat:l,shadow:!1,hint:p,focus:c,onCta:z})});const S={payload:e,config:h,look:t,chat:l,hint:p,mobile:y,focus:c,live:$,welcome:q,onCta:z};return h.variant==="chatbar"?s(fr,{...S}):s(pr,{...S})}function fr({config:e,look:t,chat:n,hint:r,mobile:o,focus:i,live:a,welcome:u}){const{ink:d,hostDark:c,accentFill:f,accentText:h,rad:l}=t,p=ke([n.turns,n.busy,n.error,n.stopping]),m=n.turns.length>0||n.stopping!==null,x=!a||n.stopping!==null;return s("div",{class:k(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&&s("div",{ref:p,style:{display:"flex",flexDirection:"column",gap:7,maxHeight:"min(50vh, 320px)",overflowY:"auto"},children:s(Xe,{welcome:u,chat:n,onDark:c,look:t,config:e})}),s("div",{style:{display:"flex",alignItems:"center",gap:10},children:[s("span",{class:k(e,"launcher"),style:{width:26,height:26,borderRadius:l,background:f,color:h,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s(Dt,{size:14})}),s("span",{class:k(e,"botMessage"),style:{flex:1,minWidth:0,fontSize:12,color:`rgb(${d})`,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:u}),s("form",{class:k(e,"composer"),onSubmit:v=>{v.preventDefault();const _=v.currentTarget.elements.namedItem("message");!_||x||(n.send(_.value),_.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:[s("input",{name:"message",type:"text",placeholder:r,disabled:x,maxLength:4e3,"aria-label":"Message",autoComplete:"off",ref:v=>{v&&i>0&&v.focus()},style:{flex:1,fontSize:11.5,color:`rgb(${d})`,"--uq-placeholder":`rgba(${d},.45)`}}),s(Kt,{config:e,look:t,onDark:c,chat:n,size:22}),s("button",{type:n.busy?"button":"submit",class:k(e,"sendButton"),onClick:n.busy?n.stop:void 0,disabled:x,"aria-label":n.busy?"Stop":"Send",style:{width:22,height:22,borderRadius:l,background:f,color:h,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:n.busy?s("span",{style:{width:7,height:7,background:"currentColor",borderRadius:1}}):s(Wt,{size:12})})]})]})]})}function pr({config:e,look:t,chat:n,hint:r,mobile:o,focus:i,live:a,welcome:u,onCta:d}){const{hostDark:c,side:f,offsetY:h}=t,l=c,p=ke([n.turns,n.busy,n.error,n.stopping]);return s("div",{class:k(e,"panel","uq-fixed"),style:{bottom:h,width:o?`calc(100% - ${e.appearance.offsetX*2}px)`:320,display:"flex",flexDirection:"column",gap:7,...f},children:[s("div",{ref:p,style:{display:"flex",flexDirection:"column",gap:7,maxHeight:"min(60vh, 420px)",overflowY:"auto"},children:s(Xe,{welcome:u,chat:n,onDark:l,look:t,config:e})}),s(Vt,{config:e,look:t,onClick:d}),s(Xt,{config:e,look:t,onDark:l,hint:r,chat:n,disabled:!a,focus:i,withStop:!0})]})}var hr=e=>/^https?:\/\//i.test(e);function _r({config:e,block:t,index:n,look:r,onCta:o}){const{ink:i,accent:a,accentFill:u,accentText:d,rad:c}=r,f=["uq-block",`uq-block-${t.kind}`,t.cssClass.trim()].filter(Boolean).join(" "),h="align"in t?t.align:"center",l={class:f,"data-uq-block":n};switch(t.kind){case"headline":return s("div",{...l,style:{fontFamily:"var(--font-display, inherit)",fontSize:t.size==="lg"?21:t.size==="sm"?15:18,fontWeight:600,letterSpacing:"-0.02em",textAlign:h,color:t.color||`rgb(${i})`},children:t.text});case"text":return s("div",{...l,style:{fontSize:12.5,lineHeight:1.5,textAlign:h,color:t.color||`rgba(${i},.65)`,whiteSpace:"pre-wrap"},children:t.text});case"media":return!t.src||!hr(t.src)?null:t.mediaType==="video"?s("video",{...l,src:t.src,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,style:{width:"100%",maxHeight:200,objectFit:"cover",borderRadius:c,background:"#000"}}):s("img",{...l,src:t.src,alt:t.alt||"",style:{width:"100%",maxHeight:200,objectFit:"cover",borderRadius:c}});case"quote":return s("div",{...l,style:{textAlign:"center"},children:[s("div",{style:{fontSize:13,fontStyle:"italic",color:`rgb(${i})`},children:["“",t.text,"”"]}),s("div",{style:{fontSize:11,color:`rgba(${i},.55)`,marginTop:4},children:t.author})]});case"cta":return s("a",{...l,class:`${k(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 ${a}`:void 0,color:t.style==="outline"?a:d,fontSize:13,fontWeight:500,textAlign:"center"},children:t.label})}}function gr({payload:e,look:t,reporter:n,open:r,setOpen:o,pinned:i}){const a=e.config,{ink:u,surfaceBg:d,rad:c}=t;if(!r)return null;const f=()=>{i||o(!1)},h=l=>n.report("cta.clicked",{widgetId:e.id,payload:{href:l}});return s("div",{class:k(a,"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:s("div",{class:k(a,"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&&s("button",{type:"button",class:k(a,"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:s(we,{size:14})}),a.blocks.map((l,p)=>s(_r,{config:a,block:l,index:p,look:t,onCta:h},p))]})})}var mr=3600;function br({payload:e,look:t,open:n}){const r=e.config,{ink:o,accent:i,surfaceBg:a,rad:u}=t,d=r.quotes,[c,f]=E(0);if(P(()=>{if(d.length<2)return;const p=window.setInterval(()=>f(m=>m+1),mr);return()=>window.clearInterval(p)},[d.length]),!n||d.length===0)return null;const h=c%d.length,l=d[h];return s("div",{class:"uq-fixed uq-fade",style:{left:0,right:0,bottom:0,display:"flex",justifyContent:"center",padding:24,pointerEvents:"none"},children:s("figure",{class:k(r,"frame"),style:{width:"100%",maxWidth:440,background:a,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:[s("blockquote",{class:k(r,"quote","uq-fade"),style:{fontSize:13.5,lineHeight:1.55,color:`rgb(${o})`},children:["“",l.text||"…","”"]},h),s("figcaption",{style:{display:"flex",alignItems:"center",gap:10},children:[s("span",{class:k(r,"author"),style:{fontFamily:"monospace",fontSize:11,color:`rgba(${o},.55)`},children:l.author||"—"}),s("span",{class:k(r,"dots"),style:{marginLeft:"auto",display:"flex",gap:4},children:d.map((p,m)=>s("span",{style:{width:5,height:5,borderRadius:"50%",background:m===h?i:`rgba(${o},.18)`}},m))})]})]})})}function vr(e){switch(e.config.type){case"chat":case"exit-popup":return!1;case"banner":case"testimonial":return!0}}function yr(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 Jt({payload:e,api:t,embed:n,page:r,reporter:o,hostDark:i,kick:a=null}){const u=ve(()=>Ln(e.config,i),[e,i]),d=ve(()=>yr(e),[e]),[c,f]=E(d.length===0),[h,l]=E(()=>d.length===0&&vr(e)),[p,m]=E(!1),[x,v]=E(0),_=B(h),g=q=>{l(q),q!==_.current&&(_.current=q,o.report(q?"surface.opened":"surface.closed",{widgetId:e.id}))},y=({autoStart:q,pinned:z})=>{f(!0),m(z),g(!0),q&&v(S=>S+1)};if(P(()=>Rt(d,r,q=>{o.report("rule.fired",{widgetId:e.id,payload:{ruleId:q.id,trigger:q.trigger}}),y(q.actionConfig)}),[e.id]),P(()=>{a&&y(a.action)},[a]),!c)return null;const $={payload:e,look:u,api:t,embed:n,page:r,reporter:o,open:h,setOpen:g,pinned:p,focus:x};switch(e.config.type){case"chat":return s(dr,{...$});case"exit-popup":return s(gr,{...$});case"banner":return s(Jn,{...$});case"testimonial":return s(br,{...$})}}function xr(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 wr(e){return e.kind==="widget"?[e.payload]:e.payload.members.map(t=>t.widget)}var Sr={report:()=>{},flush:()=>{}};function kr({group:e,...t}){const[n,r]=E(e.rules.length===0),[o,i]=E(null),[a,u]=E(()=>jn(e));return P(()=>Rt(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=jt(e);if(d)return Pn(e,d,c=>u(c?[c.widget]:[]))},[e.id,e.mode,n,a]),n?s(N,{children:a.map(d=>s("div",{"data-uq-widget":d.id,style:"display:contents",children:s(Jt,{payload:d,kick:o,...t})},d.id))}):null}function $r({snapshot:e,...t}){const n={kind:e.kind,id:e.payload.id};return e.kind==="group"?s(kr,{group:e.payload,embed:n,...t}):s("div",{"data-uq-widget":e.payload.id,style:"display:contents",children:s(Jt,{payload:e.payload,embed:n,...t})})}function Qt(e,t,n={}){var r,o,i;const a=(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:zn(u,d),f=Fn((i=n.theme)!==null&&i!==void 0?i:null),h=Dn(),l=document.createElement("style");a.appendChild(l);const p=document.createElement("div");p.setAttribute("data-uq-root",""),p.style.display="contents",a.appendChild(p);const m=x=>{l.textContent=[qn,...wr(x).map(xr)].join(`
36
+ `),mt(s($r,{snapshot:x,api:u,page:h,reporter:c,hostDark:f}),p)};return m(e),c.report("embed.loaded",{payload:{version:e.payload.version}}),{update:m,unmount:()=>{mt(null,p),c.flush(),l.remove(),p.remove()}}}function Zt(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Cr(e,t){Zt(e,t),t.add(e)}function en(e,t,n){Zt(e,t),t.set(e,n)}function $e(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 Ce(e,t){return e.get($e(e,t))}function qe(e,t,n){return e.set($e(e,t),n),n}var qr={widget:{element:"usereq-widget",attribute:"widget-id"},group:{element:"usereq-group",attribute:"group-id"}};function Qe(e){console.warn(`[usereq] ${e}`)}function tn(e){const{element:t,attribute:n}=qr[e];if(customElements.get(t))return;var r=new WeakMap,o=new WeakMap,i=new WeakSet;class a extends HTMLElement{constructor(...c){super(...c),Cr(this,i),en(this,r,null),en(this,o,0)}connectedCallback(){$e(i,this,u).call(this)}disconnectedCallback(){var c;(c=Ce(r,this))===null||c===void 0||c.unmount(),qe(r,this,null)}attributeChangedCallback(c,f,h){f!==h&&this.isConnected&&$e(i,this,u).call(this)}}async function u(){var d,c,f,h;const l=(d=this.getAttribute(n))===null||d===void 0?void 0:d.trim();if(!l)return;const p=qe(o,this,(c=Ce(o,this),++c));(f=Ce(r,this))===null||f===void 0||f.unmount(),qe(r,this,null);const m=((h=this.getAttribute("api-url"))!==null&&h!==void 0?h:"https://api.usereq.com").replace(/\/+$/,""),x=this.getAttribute("theme"),v=x==="light"||x==="dark"?x:null;let _;try{const g=await an({base:m},e,l);_=hn(g,e)}catch(g){g instanceof G?Qe(`${t} ${l}: ${g.message} (${g.code})`):Qe(`${t} ${l}: could not reach ${m}.`);return}if(!(p!==Ce(o,this)||!this.isConnected)){if(!_){Qe(`${t} ${l}: the response was not a ${e} snapshot.`);return}qe(r,this,Qt(_,this,{apiUrl:m,theme:v}))}}Te(a,"observedAttributes",[n,"api-url","theme"]),customElements.define(t,a)}function Ir(){tn("widget"),tn("group")}return Ir(),Ie.render=Qt,Ie})({});
37
37
 
38
38
  //# sourceMappingURL=embed.js.map