@squadico/chatbot 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -20
- package/dist/answer-CDGrP8YE.js +1193 -0
- package/dist/answer-CDGrP8YE.js.map +1 -0
- package/dist/answer-DRaV2dVt.cjs +8 -0
- package/dist/answer-DRaV2dVt.cjs.map +1 -0
- package/dist/chatbot-widgets.global.js +4 -0
- package/dist/chatbot-widgets.global.js.map +1 -0
- package/dist/chatbot.global.js +12 -7
- package/dist/chatbot.global.js.map +1 -1
- package/dist/components/ChatbotWidget.d.ts.map +1 -1
- package/dist/components/MessageList.d.ts +4 -1
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/RichText.d.ts +6 -4
- package/dist/components/RichText.d.ts.map +1 -1
- package/dist/extras-ClIRRLqo.js +604 -0
- package/dist/extras-ClIRRLqo.js.map +1 -0
- package/dist/extras-lsCe4xgN.cjs +4 -0
- package/dist/extras-lsCe4xgN.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/jsx.d.ts +41 -0
- package/dist/jsx.d.ts.map +1 -1
- package/dist/lib/client.d.ts +8 -4
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/i18n.d.ts +20 -0
- package/dist/lib/i18n.d.ts.map +1 -1
- package/dist/lib/useChat.d.ts.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/src-BjqOavOO.js +1984 -0
- package/dist/src-BjqOavOO.js.map +1 -0
- package/dist/src-DS8P9HdZ.cjs +7 -0
- package/dist/src-DS8P9HdZ.cjs.map +1 -0
- package/dist/types.d.ts +11 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/widgets/approval/SqcApproval.d.ts +17 -0
- package/dist/widgets/approval/SqcApproval.d.ts.map +1 -0
- package/dist/widgets/approval/name.d.ts +3 -0
- package/dist/widgets/approval/name.d.ts.map +1 -0
- package/dist/widgets/chart/SqcChart.d.ts +19 -0
- package/dist/widgets/chart/SqcChart.d.ts.map +1 -0
- package/dist/widgets/chart/draw.d.ts +31 -0
- package/dist/widgets/chart/draw.d.ts.map +1 -0
- package/dist/widgets/chart/png.d.ts +10 -0
- package/dist/widgets/chart/png.d.ts.map +1 -0
- package/dist/widgets/chart/read.d.ts +11 -0
- package/dist/widgets/chart/read.d.ts.map +1 -0
- package/dist/widgets/chart/strings.d.ts +32 -0
- package/dist/widgets/chart/strings.d.ts.map +1 -0
- package/dist/widgets/choices/SqcChoices.d.ts +17 -0
- package/dist/widgets/choices/SqcChoices.d.ts.map +1 -0
- package/dist/widgets/confirm/SqcConfirm.d.ts +12 -0
- package/dist/widgets/confirm/SqcConfirm.d.ts.map +1 -0
- package/dist/widgets/define.d.ts +8 -0
- package/dist/widgets/define.d.ts.map +1 -0
- package/dist/widgets/element.d.ts +26 -0
- package/dist/widgets/element.d.ts.map +1 -0
- package/dist/widgets/extras-loader.d.ts +21 -0
- package/dist/widgets/extras-loader.d.ts.map +1 -0
- package/dist/widgets/extras.d.ts +3 -0
- package/dist/widgets/extras.d.ts.map +1 -0
- package/dist/widgets/extras.global.d.ts +2 -0
- package/dist/widgets/extras.global.d.ts.map +1 -0
- package/dist/widgets/form/SqcForm.d.ts +14 -0
- package/dist/widgets/form/SqcForm.d.ts.map +1 -0
- package/dist/widgets/form/reply.d.ts +7 -0
- package/dist/widgets/form/reply.d.ts.map +1 -0
- package/dist/widgets/i18n.d.ts +4 -0
- package/dist/widgets/i18n.d.ts.map +1 -0
- package/dist/widgets/index.d.ts +10 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/dist/widgets/inline.d.ts +11 -0
- package/dist/widgets/inline.d.ts.map +1 -0
- package/dist/widgets/live.d.ts +12 -0
- package/dist/widgets/live.d.ts.map +1 -0
- package/dist/widgets/names.d.ts +10 -0
- package/dist/widgets/names.d.ts.map +1 -0
- package/dist/widgets/parse/answer.d.ts +11 -0
- package/dist/widgets/parse/answer.d.ts.map +1 -0
- package/dist/widgets/parse/confirm.d.ts +19 -0
- package/dist/widgets/parse/confirm.d.ts.map +1 -0
- package/dist/widgets/parse/form.d.ts +6 -0
- package/dist/widgets/parse/form.d.ts.map +1 -0
- package/dist/widgets/styles.d.ts +3 -0
- package/dist/widgets/styles.d.ts.map +1 -0
- package/dist/widgets/table/SqcTable.d.ts +16 -0
- package/dist/widgets/table/SqcTable.d.ts.map +1 -0
- package/dist/widgets/types.d.ts +68 -0
- package/dist/widgets/types.d.ts.map +1 -0
- package/dist/widgets.cjs +1 -0
- package/dist/widgets.js +3 -0
- package/package.json +7 -2
- package/dist/components/Approval.d.ts +0 -37
- package/dist/components/Approval.d.ts.map +0 -1
- package/dist/components/Choices.d.ts +0 -27
- package/dist/components/Choices.d.ts.map +0 -1
- package/dist/components/Confirm.d.ts +0 -16
- package/dist/components/Confirm.d.ts.map +0 -1
- package/dist/lib/confirm.d.ts +0 -17
- package/dist/lib/confirm.d.ts.map +0 -1
- package/dist/src-DcJyi601.cjs +0 -8
- package/dist/src-DcJyi601.cjs.map +0 -1
- package/dist/src-Nh5rZvti.js +0 -2710
- package/dist/src-Nh5rZvti.js.map +0 -1
package/dist/widgets.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { r as e, t } from "./extras-ClIRRLqo.js";
|
|
2
|
+
import { a as n, l as r, n as i, r as a, t as o } from "./answer-CDGrP8YE.js";
|
|
3
|
+
export { r as WIDGET_TAGS, n as defineChatWidgets, t as defineWidgetExtras, i as isLive, a as loadWidgetExtras, o as parseAnswer, e as readChart };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squadico/chatbot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Chatbot Squadico — web component (HTML, Next.js, Vue 2, Vue 3)",
|
|
5
5
|
"homepage": "https://www.squadico.com/integrations/website",
|
|
6
6
|
"keywords": [
|
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
"import": "./dist/react.js",
|
|
41
41
|
"require": "./dist/react.cjs"
|
|
42
42
|
},
|
|
43
|
+
"./widgets": {
|
|
44
|
+
"types": "./dist/widgets/index.d.ts",
|
|
45
|
+
"import": "./dist/widgets.js",
|
|
46
|
+
"require": "./dist/widgets.cjs"
|
|
47
|
+
},
|
|
43
48
|
"./jsx": {
|
|
44
49
|
"types": "./dist/jsx.d.ts"
|
|
45
50
|
},
|
|
@@ -49,7 +54,7 @@
|
|
|
49
54
|
"scripts": {
|
|
50
55
|
"dev": "vite",
|
|
51
56
|
"build": "npm run build:bundles && npm run build:types",
|
|
52
|
-
"build:bundles": "vite build && vite build --config vite.config.standalone.ts",
|
|
57
|
+
"build:bundles": "vite build && vite build --config vite.config.standalone.ts && vite build --config vite.config.widgets.ts",
|
|
53
58
|
"build:types": "tsc -p tsconfig.build.json",
|
|
54
59
|
"type-check": "tsc --noEmit",
|
|
55
60
|
"test": "vitest run",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decision on a tool call the agent stopped before making: yes, or no.
|
|
3
|
-
*
|
|
4
|
-
* The agent paused before calling the tool and wrote what it would do (that is the
|
|
5
|
-
* message body); these buttons are what releases the call, not a bare "yes"
|
|
6
|
-
* interpreted by the model. Nothing has been written while they are here.
|
|
7
|
-
*
|
|
8
|
-
* **When it wrote nothing, the call speaks for itself.** Several models ask for a
|
|
9
|
-
* tool with no sentence at all, and a visitor then faces an empty bubble with two
|
|
10
|
-
* buttons under it — a decision nobody can take. So `call`, passed only in that
|
|
11
|
-
* case, names what would be used and with what: approving "read a pull request"
|
|
12
|
-
* is not approving *which* one. The values come from a model and are printed as
|
|
13
|
-
* text, never as markup.
|
|
14
|
-
*
|
|
15
|
-
* Two answers and no third. There used to be a "correct it" button that opened an
|
|
16
|
-
* input, and the API has never had anything to send it to — a control that cannot be
|
|
17
|
-
* honoured is worse than one that is missing. Saying something else is a new
|
|
18
|
-
* message, and the backend closes the pending call as it goes out: asking instead of
|
|
19
|
-
* deciding is a decision too.
|
|
20
|
-
*
|
|
21
|
-
* Once the decision is made the group is frozen — the history has to stay readable,
|
|
22
|
-
* and a call is not approved twice.
|
|
23
|
-
*/
|
|
24
|
-
import type { JSX } from 'preact';
|
|
25
|
-
import type { Locale } from '../lib/i18n';
|
|
26
|
-
import type { PendingApproval } from '../types';
|
|
27
|
-
export interface ApprovalProps {
|
|
28
|
-
locale: Locale;
|
|
29
|
-
/** The paused call, when the agent asked for it without a word of its own.
|
|
30
|
-
* Absent when it explained itself: its sentence is the message body, and
|
|
31
|
-
* saying the same thing twice reads as two requests. */
|
|
32
|
-
call?: PendingApproval;
|
|
33
|
-
/** Absent when the group is frozen: decision already made, or turn in flight. */
|
|
34
|
-
onDecide?: (approved: boolean, label: string) => void;
|
|
35
|
-
}
|
|
36
|
-
export declare function Approval({ locale, call, onDecide }: ApprovalProps): JSX.Element;
|
|
37
|
-
//# sourceMappingURL=Approval.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Approval.d.ts","sourceRoot":"","sources":["../../src/components/Approval.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAGjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd;;6DAEyD;IACzD,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACtD;AA+BD,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAmD/E"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clickable options built from the Markdown checkboxes (`- [ ] Name`) the
|
|
3
|
-
* assistant writes when it offers candidates.
|
|
4
|
-
*
|
|
5
|
-
* The agent resolves the answer by name, so clicking an option amounts to
|
|
6
|
-
* sending its exact label as a message. The choice is single — the agent expects
|
|
7
|
-
* one candidate per turn — and the group locks as soon as an option is taken, so
|
|
8
|
-
* the history stays readable.
|
|
9
|
-
*/
|
|
10
|
-
import type { ComponentChildren, JSX } from 'preact';
|
|
11
|
-
import type { Locale } from '../lib/i18n';
|
|
12
|
-
export interface ChoiceItem {
|
|
13
|
-
/** Plain text sent to the agent. */
|
|
14
|
-
label: string;
|
|
15
|
-
/** Checkbox already ticked in the Markdown (`- [x] …`). */
|
|
16
|
-
checked: boolean;
|
|
17
|
-
/** Rendered label (inline Markdown is already applied to it). */
|
|
18
|
-
content: ComponentChildren;
|
|
19
|
-
}
|
|
20
|
-
export interface ChoicesProps {
|
|
21
|
-
items: ChoiceItem[];
|
|
22
|
-
locale: Locale;
|
|
23
|
-
/** Absent when the group is frozen: older message, or turn in flight. */
|
|
24
|
-
onPick?: (label: string) => void;
|
|
25
|
-
}
|
|
26
|
-
export declare function Choices({ items, locale, onPick }: ChoicesProps): JSX.Element;
|
|
27
|
-
//# sourceMappingURL=Choices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Choices.d.ts","sourceRoot":"","sources":["../../src/components/Choices.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAA;IAChB,iEAAiE;IACjE,OAAO,EAAE,iBAAiB,CAAA;CAC3B;AAUD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACjC;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CA+B5E"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* "Yes" / "No" buttons under a closed question from the assistant.
|
|
3
|
-
*
|
|
4
|
-
* A bare "yes" or "no" is recognised agent-side without going through the LLM,
|
|
5
|
-
* so clicking is exactly the same as typing the answer. As with the tickable
|
|
6
|
-
* options, the group locks on the choice made, so the history stays readable.
|
|
7
|
-
*/
|
|
8
|
-
import type { JSX } from 'preact';
|
|
9
|
-
import type { Locale } from '../lib/i18n';
|
|
10
|
-
export interface ConfirmProps {
|
|
11
|
-
locale: Locale;
|
|
12
|
-
/** Absent when the group is frozen: older message, or turn in flight. */
|
|
13
|
-
onPick?: (answer: string) => void;
|
|
14
|
-
}
|
|
15
|
-
export declare function Confirm({ locale, onPick }: ConfirmProps): JSX.Element;
|
|
16
|
-
//# sourceMappingURL=Confirm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Confirm.d.ts","sourceRoot":"","sources":["../../src/components/Confirm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,yEAAyE;IACzE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC;AAED,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CA8BrE"}
|
package/dist/lib/confirm.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detection of the assistant's closed questions, so "Yes" / "No" can be offered
|
|
3
|
-
* instead of making the user retype the answer.
|
|
4
|
-
*
|
|
5
|
-
* The protocol exposes nothing explicit for this (the API only returns text), so
|
|
6
|
-
* this leans on the phrasings agents actually produce. The list is deliberately
|
|
7
|
-
* narrow: an open question ("Which records would you like to see?") must not
|
|
8
|
-
* bring up buttons.
|
|
9
|
-
*
|
|
10
|
-
* A question asked in the user's language is only recognisable with that
|
|
11
|
-
* language's phrasings: the patterns are therefore keyed by language, and the
|
|
12
|
-
* widget's locale picks the set — a single English set would leave a
|
|
13
|
-
* French-speaking host without buttons.
|
|
14
|
-
*/
|
|
15
|
-
import { type LanguageCode } from './i18n';
|
|
16
|
-
export declare function isConfirmationPrompt(text: string, language?: LanguageCode): boolean;
|
|
17
|
-
//# sourceMappingURL=confirm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../src/lib/confirm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAA;AAuC5D,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,YAA+B,GACxC,OAAO,CAcT"}
|
package/dist/src-DcJyi601.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m={},h=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function y(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(t,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),typeof t==`function`&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return x(t,s,i,a,null)}function x(e,r,i,a,o){var s={type:e,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++n,__i:-1,__u:0};return o==null&&t.vnode!=null&&t.vnode(s),s}function S(e){return e.children}function C(e,t){this.props=e,this.context=t}function w(e,t){if(t==null)return e.__?w(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`?w(e):null}function T(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],a=[],o=v({},n);o.__v=n.__v+1,t.vnode&&t.vnode(o),I(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??w(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,L(i,o,a),n.__e=n.__=null,o.__e!=r&&E(o)}}function E(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}),E(e)}function D(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!O.__r++||i!=t.debounceRendering)&&((i=t.debounceRendering)||a)(O)}function O(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,T(e)}finally{r.length=O.__r=0}}function k(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,y=r&&r.__k||h,b=t.length;for(c=A(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&y[p.__i]||m,p.__i=d,v=I(e,p,f,i,a,o,s,c,l,u),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&ne(f.ref,null,p),u.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),4&p.__u?(c=j(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=x(null,o,null,null,null):_(o)?o=e.__k[a]=x(S,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=M(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=w(s)),re(s,s));return r}function j(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=j(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=w(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function N(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||g.test(t)?n:n+`px`}function P(e,t,n,r,i){var a,o;n: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||N(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||N(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(u,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n[l]=r[l]:(n[l]=d,e.addEventListener(t,a?p:f,a)):e.removeEventListener(t,a?p:f,a);else{if(i==`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??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function F(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[c]==null)n[c]=d++;else if(n[c]<r[l])return;return r(t.event?t.event(n):n)}}}function I(e,n,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,x,T,E,D,O,A,j,M,N,P,F=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=n.__e=r.__e]),(d=t.__b)&&d(n);n:if(typeof F==`function`){f=s.length;try{if(E=n.props,D=F.prototype&&F.prototype.render,O=(d=F.contextType)&&i[d.__c],A=d?O?O.props.value:d.__:i,r.__c?T=(p=n.__c=r.__c).__=p.__E:(D?n.__c=p=new F(E,A):(n.__c=p=new C(E,A),p.constructor=F,p.render=ie),O&&O.sub(p),p.state||(p.state={}),p.__n=i,m=p.__d=!0,p.__h=[],p._sb=[]),D&&p.__s==null&&(p.__s=p.state),D&&F.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,F.getDerivedStateFromProps(E,p.__s))),g=p.props,b=p.state,p.__v=n,m)D&&F.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),D&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(D&&F.getDerivedStateFromProps==null&&E!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,A),n.__v==r.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(E,p.__s,A)){n.__v!=r.__v&&(p.props=E,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),h.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),c=w(r);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(E,p.__s,A),D&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,b,x)})}if(p.context=A,p.props=E,p.__P=e,p.__e=!1,j=t.__r,M=0,D)p.state=p.__s,p.__d=!1,j&&j(n),d=p.render(p.props,p.state,p.context),h.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,j&&j(n),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++M<25);p.state=p.__s,p.getChildContext!=null&&(i=v(v({},i),p.getChildContext())),D&&!m&&p.getSnapshotBeforeUpdate!=null&&(x=p.getSnapshotBeforeUpdate(g,b)),N=d!=null&&d.type===S&&d.key==null?te(d.props.children):d,c=k(e,_(N)?N:[N],n,r,i,a,o,s,c,l,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),T&&(p.__E=p.__=null)}catch(e){if(s.length=f,n.__v=null,l||o!=null){if(e.then){for(n.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),n.__e=c}else if(o!=null)for(P=o.length;P--;)y(o[P])}else n.__e=r.__e;n.__k??(n.__k=r.__k||[]),e.then||ee(n),t.__e(e,n,r)}}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=R(r.__e,n,r,i,a,o,s,l,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:c}function ee(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ee))}function L(e,n,r){for(var i=0;i<r.length;i++)ne(r[i],r[++i],r[++i]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function te(e){return typeof e!=`object`||!e||e.__b>0?e:_(e)?e.map(te):e.constructor===void 0?v({},e):null}function R(n,r,i,a,o,s,c,l,u){var d,f,p,h,g,v,b,x=i.props||m,S=r.props,C=r.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||(o=`http://www.w3.org/1999/xhtml`),s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){n=g,s[d]=null;break}}if(n==null){if(C==null)return document.createTextNode(S);n=document.createElementNS(o,C,S.is&&S),l&&(t.__m&&t.__m(r,s),l=!1),s=null}if(C==null)x===S||l&&n.data==S||(n.data=S);else{if(s=C==`textarea`&&S.defaultValue!=null?null:s&&e.call(n.childNodes),!l&&s!=null)for(x={},d=0;d<n.attributes.length;d++)x[(g=n.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||P(n,d,null,g,o);for(d in S)g=S[d],d==`children`?h=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?v=g:d==`checked`?b=g:l&&typeof g!=`function`||x[d]===g||P(n,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),r.__k=[];else if(p&&(n.innerHTML=``),k(r.type==`template`?n.content:n,_(h)?h:[h],r,i,a,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&w(i,0),l,u),s!=null)for(d=s.length;d--;)y(s[d]);l&&C!=`textarea`||(d=`value`,C==`progress`&&v==null?n.removeAttribute(`value`):v!=null&&(v!==n[d]||C==`progress`&&!v||C==`option`&&v!=x[d])&&P(n,d,v,x[d],o),d=`checked`,b!=null&&b!=n[d]&&P(n,d,b,x[d],o))}return n}function ne(e,n,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function re(e,n,r){var i,a;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ne(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&re(i[a],n,r||typeof e.type!=`function`);r||y(e.__e),e.__c=e.__=e.__e=void 0}function ie(e,t,n){return this.constructor(e,n)}function ae(n,r,i){var a,o,s,c;r==document&&(r=document.documentElement),t.__&&t.__(n,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],I(r,n=(!a&&i||r).__k=b(S,null,[n]),o||m,m,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?e.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),L(s,n,c),n.props.children=null}e=h.slice,t={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},n=0,C.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=v({},this.state);typeof e==`function`&&(e=e(v({},n),this.props)),e&&v(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),D(this))},C.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),D(this))},C.prototype.render=S,r=[],a=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,s=Math.random().toString(8),c=`__d`+s,l=`__a`+s,u=/(PointerCapture)$|Capture$/i,d=0,f=F(!1),p=F(!0);var z,B,V,oe,H=0,se=[],U=t,ce=U.__b,le=U.__r,ue=U.diffed,de=U.__c,fe=U.unmount,pe=U.__;function me(e,t){U.__h&&U.__h(B,e,H||t),H=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function W(e){return H=1,he(we,e)}function he(e,t,n){var r=me(z++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):we(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};B.__f=!0;var a=B.shouldComponentUpdate,o=B.componentWillUpdate;B.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},B.shouldComponentUpdate=i}return r.__N||r.__}function G(e,t){var n=me(z++,3);!U.__s&&Ce(n.__H,t)&&(n.__=e,n.u=t,B.__H.__h.push(n))}function ge(e,t){var n=me(z++,4);!U.__s&&Ce(n.__H,t)&&(n.__=e,n.u=t,B.__h.push(n))}function K(e){return H=5,_e(function(){return{current:e}},[])}function _e(e,t){var n=me(z++,7);return Ce(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function q(e,t){return H=8,_e(function(){return e},t)}function ve(){for(var e;e=se.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(xe),t.__h.some(Se),t.__h=[]}catch(n){t.__h=[],U.__e(n,e.__v)}}}U.__b=function(e){B=null,ce&&ce(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),pe&&pe(e,t)},U.__r=function(e){le&&le(e),z=0;var t=(B=e.__c).__H;t&&(V===B?(t.__h=[],B.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(xe),t.__h.some(Se),t.__h=[],z=0)),V=B},U.diffed=function(e){ue&&ue(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(se.push(t)!==1&&oe===U.requestAnimationFrame||((oe=U.requestAnimationFrame)||be)(ve)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),V=B=null},U.__c=function(e,t){t.some(function(e){try{e.__h.some(xe),e.__h=e.__h.filter(function(e){return!e.__||Se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],U.__e(n,e.__v)}}),de&&de(e,t)},U.unmount=function(e){fe&&fe(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{xe(e)}catch(e){t=e}}),n.__H=void 0,t&&U.__e(t,n.__v))};var ye=typeof requestAnimationFrame==`function`;function be(e){var t,n=function(){clearTimeout(r),ye&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ye&&(t=requestAnimationFrame(n))}function xe(e){var t=B,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),B=t}function Se(e){var t=B;e.__c=e.__(),B=t}function Ce(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function we(e,t){return typeof t==`function`?t(e):t}var Te=new Set([`sessionId`]);function Ee(e){if(typeof e==`string`)return e.length>0?{id:e}:void 0;if(!e||typeof e!=`object`||Array.isArray(e))return;let{id:t,name:n}=e;if(typeof t==`string`&&t.length!==0)return typeof n==`string`&&n.length>0?{id:t,name:n}:{id:t}}function De(e){let t=Ee(e);if(t)return t.name??t.id}function Oe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ke(e){let t={};for(let[n,r]of Object.entries(e)){if(Te.has(n)||!Oe(r)){t[n]=r;continue}let e=Ee(r);e&&(t[`${n}Id`]=e.id,e.name&&(t[`${n}Name`]=e.name))}return t}var Ae=`en`,je=[`en`,`fr`,`es`],Me={en:{heading:`Assistant`,subheading:`Squadico`,placeholder:`Ask your question…`,greeting:`Hello! I am your assistant. What would you like to do?`,hint:`The assistant proposes an action; nothing is applied without your confirmation.`,assistant:`Assistant`,typing:`The assistant is writing its answer`,newConversation:`New conversation`,close:`Close the assistant`,closeTitle:`Close`,history:{open:`Conversation history`,menu:`Previous conversations`,loading:`Loading…`,empty:`No previous conversation.`,untitled:`Conversation`},context:{region:`Context sent to the assistant`},approval:{group:`Write confirmation`,approve:`Yes, apply`,reject:`No, cancel`,request:`The agent wants to use {tool}.`,arguments:`With`,edit:`Change…`,correction:`What to change — e.g. “the due date is next Monday”`,correctionLabel:`Correction to make before approving`,send:`Send`},confirm:{group:`Confirmation`,yes:`Yes`,no:`No`,yesValue:`yes`,noValue:`no`},choices:`Suggested options`,poweredBy:`Powered by Squadico`,handles:{picker:`Agents you can address`,unknown:`Nobody answers to that name here:`,instead:`You can address:`,rail:`Agents`},selection:{group:`Suggested choice`,single:`Pick one option.`,multiple:`Pick one or more options, then validate.`,validate:`Validate`},composer:{label:`Your message`,send:`Send the message`,sendTitle:`Send`,stop:`Stop the answer`,stopTitle:`Stop`,attach:`Attach a file`,attachTitle:`Attach`,remove:`Remove {name}`},attachments:{unsupported:`This kind of file cannot be attached to a message.`,tooLarge:`This file is too large.`,tooMany:`This message already carries as many files as it may.`,unreadable:`This file could not be read.`,failed:`This file could not be attached.`},error:`Something went wrong, the assistant could not answer. Try again in a moment.`,withHuman:`A member of the team will reply to you here.`},fr:{heading:`Assistant`,subheading:`Squadico`,placeholder:`Posez votre question…`,greeting:`Bonjour ! Je suis votre assistant. Que souhaitez-vous faire ?`,hint:`L'assistant propose une action ; rien n'est appliqué sans votre confirmation.`,assistant:`Assistant`,typing:`L'assistant rédige sa réponse`,newConversation:`Nouvelle conversation`,close:`Fermer l'assistant`,closeTitle:`Fermer`,history:{open:`Historique des conversations`,menu:`Conversations précédentes`,loading:`Chargement…`,empty:`Aucune conversation précédente.`,untitled:`Conversation`},context:{region:`Contexte transmis à l'assistant`},approval:{group:`Validation de l'écriture`,approve:`Oui, appliquer`,reject:`Non, annuler`,request:`L'agent souhaite utiliser {tool}.`,arguments:`Avec`,edit:`Modifier…`,correction:`Ce qu'il faut changer — ex. « l'échéance est lundi prochain »`,correctionLabel:`Correction à apporter avant validation`,send:`Envoyer`},confirm:{group:`Confirmation`,yes:`Oui`,no:`Non`,yesValue:`oui`,noValue:`non`},choices:`Options proposées`,poweredBy:`Propulsé par Squadico`,handles:{picker:`Agents que vous pouvez adresser`,unknown:`Personne ne répond à ce nom ici :`,instead:`Vous pouvez adresser :`,rail:`Agents`},selection:{group:`Choix proposé`,single:`Sélectionnez une option.`,multiple:`Sélectionnez une ou plusieurs options, puis validez.`,validate:`Valider`},composer:{label:`Votre message`,send:`Envoyer le message`,sendTitle:`Envoyer`,stop:`Interrompre la réponse`,stopTitle:`Interrompre`,attach:`Joindre un fichier`,attachTitle:`Joindre`,remove:`Retirer {name}`},attachments:{unsupported:`Ce format de fichier ne peut pas être joint à un message.`,tooLarge:`Ce fichier est trop volumineux.`,tooMany:`Ce message porte déjà autant de fichiers qu'il le peut.`,unreadable:`Ce fichier n'a pas pu être lu.`,failed:`Impossible de joindre ce fichier.`},error:`Une erreur est survenue, l'assistant n'a pas pu répondre. Réessayez dans un instant.`,withHuman:`Un membre de l'équipe va vous répondre ici.`},es:{heading:`Asistente`,subheading:`Squadico`,placeholder:`Haga su pregunta…`,greeting:`¡Hola! Soy su asistente. ¿Qué desea hacer?`,hint:`El asistente propone una acción; no se aplica nada sin su confirmación.`,assistant:`Asistente`,typing:`El asistente está redactando su respuesta`,newConversation:`Nueva conversación`,close:`Cerrar el asistente`,closeTitle:`Cerrar`,history:{open:`Historial de conversaciones`,menu:`Conversaciones anteriores`,loading:`Cargando…`,empty:`Ninguna conversación anterior.`,untitled:`Conversación`},context:{region:`Contexto enviado al asistente`},approval:{group:`Validación de la escritura`,approve:`Sí, aplicar`,reject:`No, cancelar`,request:`El agente quiere usar {tool}.`,arguments:`Con`,edit:`Modificar…`,correction:`Lo que hay que cambiar — p. ej. «el vencimiento es el lunes»`,correctionLabel:`Corrección antes de validar`,send:`Enviar`},confirm:{group:`Confirmación`,yes:`Sí`,no:`No`,yesValue:`sí`,noValue:`no`},choices:`Opciones propuestas`,poweredBy:`Con la tecnología de Squadico`,handles:{picker:`Agentes a los que puedes dirigirte`,unknown:`Nadie responde a ese nombre aquí:`,instead:`Puedes dirigirte a:`,rail:`Agentes`},selection:{group:`Opción propuesta`,single:`Seleccione una opción.`,multiple:`Seleccione una o varias opciones y valide.`,validate:`Validar`},composer:{label:`Su mensaje`,send:`Enviar el mensaje`,sendTitle:`Enviar`,stop:`Interrumpir la respuesta`,stopTitle:`Interrumpir`,attach:`Adjuntar un archivo`,attachTitle:`Adjuntar`,remove:`Quitar {name}`},attachments:{unsupported:`Este tipo de archivo no se puede adjuntar a un mensaje.`,tooLarge:`Este archivo es demasiado grande.`,tooMany:`Este mensaje ya lleva todos los archivos que puede llevar.`,unreadable:`No se ha podido leer este archivo.`,failed:`No se ha podido adjuntar este archivo.`},error:`Se ha producido un error, el asistente no ha podido responder. Inténtelo de nuevo.`,withHuman:`Un miembro del equipo le responderá aquí.`}},Ne={en:`en-GB`,fr:`fr-FR`,es:`es-ES`};function Pe(e){let t=e?.trim().toLowerCase().split(/[-_]/)[0];return t&&t in Me?t:void 0}function Fe(){return typeof navigator>`u`?[]:navigator.languages?.length?navigator.languages:[navigator.language]}function Ie(e){let t=e?.trim(),n=(t?[t]:Fe()).find(Pe),r=Pe(n)??`en`;return{code:r,tag:n?.includes(`-`)?n:Ne[r],t:Me[r]}}var Le=`squadico-chatbot:open`;function Re(){try{if(typeof sessionStorage>`u`)return;let e=sessionStorage.getItem(Le);return e===`1`||e!==`0`&&void 0}catch{return}}function ze(e){try{if(typeof sessionStorage>`u`)return;sessionStorage.setItem(Le,e?`1`:`0`)}catch{}}function Be(e,t){return t===!1?e??!1:Re()??e??!1}function Ve(e,t){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.role===`assistant`&&n.agent)return n.agent.handle}return t}function He(e,t,n){return!t||t===n||e.trimStart().startsWith(`@`)?e:`@${t} ${e}`}function Ue(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);if(e&&typeof e.getRandomValues==`function`)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[];for(let e=0;e<16;e++)n.push(t[e].toString(16).padStart(2,`0`));return n.slice(0,4).join(``)+`-`+n.slice(4,6).join(``)+`-`+n.slice(6,8).join(``)+`-`+n.slice(8,10).join(``)+`-`+n.slice(10,16).join(``)}function We(e){"@babel/helpers - typeof";return We=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},We(e)}function Ge(e,t){if(We(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(We(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ke(e){var t=Ge(e,`string`);return We(t)==`symbol`?t:t+``}function qe(e,t,n){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Je=`https://api.squadico.com`,Ye=2e4,J=class extends Error{constructor(e,t,n){super(e),qe(this,`status`,void 0),qe(this,`code`,void 0),this.name=`ChatHttpError`,this.status=t,this.code=n}};function Xe(e,t){return`${e.replace(/\/+$/,``)}${t}`}function Ze(e,t){return{"Content-Type":`application/json`,Accept:`text/event-stream, application/json`,...e?{"X-Visitor-Token":e}:{},...t?{"X-Subject-Token":t}:{}}}function Qe(e){if(!e||typeof e!=`object`)return;let{loc:t,msg:n}=e;if(typeof n!=`string`||!n)return;let r=(Array.isArray(t)?t.filter(e=>typeof e==`string`):[]).at(-1);return r&&r!==`body`?`${r}: ${n}`:n}async function $e(e){let t=``,n;try{let r=await e.text();if(r)try{let e=JSON.parse(r),i=e.detail??e.message;if(Array.isArray(i)){let e=i.map(e=>Qe(e)??(typeof e==`string`?e:void 0)).filter(e=>e!==void 0);t=e.length>0?e.join(`, `):r}else t=typeof i==`string`?i:r;n=typeof e.code==`string`?e.code:void 0}catch{t=r}}catch{}return new J(t||`The API answered ${e.status}`,e.status,n)}function et(e,t){if(!e||typeof e!=`object`)return;let n=e;if(!(typeof n.handle!=`string`||!n.handle))return{handle:n.handle,name:typeof n.name==`string`?n.name:n.handle,avatarUrl:typeof n.avatar_url==`string`&&n.avatar_url?Xe(t,n.avatar_url):void 0,color:typeof n.color==`string`?n.color:void 0}}function tt(e,t){return(Array.isArray(e)?e:[]).map(e=>et(e,t)).filter(e=>e!==void 0)}function nt(e){if(!e||typeof e!=`object`)return;let t=e;if(!(typeof t.tool_call_id!=`string`||!t.tool_call_id))return{toolCallId:t.tool_call_id,tool:typeof t.tool==`string`?t.tool:``,arguments:t.arguments&&typeof t.arguments==`object`?t.arguments:{}}}var rt=new Set([`user`,`assistant`]);function it(e,t){if(typeof e.role!=`string`||!rt.has(e.role)||typeof e.content!=`string`||!e.content)return null;let n=typeof e.created_at==`string`?Date.parse(e.created_at):NaN;return{id:typeof e.id==`string`&&e.id?e.id:Ue(),role:e.role,content:e.content,createdAt:Number.isNaN(n)?Date.now():n,agent:et(e.agent,t),attachments:at(e.attachments),authorName:e.kind===`human`&&typeof e.author_name==`string`&&e.author_name?e.author_name:void 0}}function at(e){if(!Array.isArray(e))return;let t=e.map(e=>ot(e)).filter(e=>e!==null);return t.length>0?t:void 0}function ot(e){if(!e||typeof e!=`object`)return null;let{id:t,kind:n,filename:r,content_type:i}=e;return typeof t!=`string`||!t||typeof r!=`string`||!r?null:{id:t,kind:n===`image`?`image`:`document`,filename:r,contentType:typeof i==`string`?i:`application/octet-stream`}}async function st(e){let t=e.agent?`?agent=${encodeURIComponent(e.agent)}`:``,n=await fetch(Xe(e.apiUrl,`/public/applications/${encodeURIComponent(e.embedKey)}${t}`),{method:`GET`,headers:Ze(),signal:e.signal});if(!n.ok)throw await $e(n);let r=await n.json();return{welcomeMessage:typeof r.welcome_message==`string`&&r.welcome_message?r.welcome_message:void 0,agent:et(r.agent,e.apiUrl),handles:tt(r.handles,e.apiUrl),agentHandle:typeof r.agent_handle==`string`&&r.agent_handle?r.agent_handle:void 0,branding:r.branding===!0}}async function ct(e){let t=await fetch(Xe(e.apiUrl,`/public/applications/${encodeURIComponent(e.embedKey)}/conversations`),{method:`POST`,headers:Ze(),body:JSON.stringify({...e.user?{user:e.user}:{},...e.agent?{agent:e.agent}:{}}),signal:e.signal});if(!t.ok)throw await $e(t);let n=await t.json();if(typeof n.id!=`string`||typeof n.visitor_token!=`string`)throw new J(`The API opened a conversation without an id or a token`);let r=(Array.isArray(n.messages)?n.messages:[]).map(t=>it(t,e.apiUrl)).filter(e=>e!==null);return{conversationId:n.id,visitorToken:n.visitor_token,agentName:typeof n.agent_name==`string`?n.agent_name:``,agentSlug:typeof n.agent_slug==`string`?n.agent_slug:``,welcomeMessage:typeof n.welcome_message==`string`&&n.welcome_message?n.welcome_message:void 0,messages:r,handles:tt(n.handles,e.apiUrl),agentHandle:typeof n.agent_handle==`string`&&n.agent_handle?n.agent_handle:void 0,withHuman:typeof n.handling==`string`&&n.handling!==`agents`,branding:n.branding===!0}}async function lt(e){let t=await fetch(Xe(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}`),{method:`GET`,headers:Ze(e.visitorToken),signal:e.signal});if(!t.ok)throw await $e(t);let n=await t.json();if(typeof n.id!=`string`)throw new J(`The API replayed a conversation without an id`);return{conversationId:n.id,visitorToken:e.visitorToken,agentName:typeof n.agent_name==`string`?n.agent_name:``,agentSlug:typeof n.agent_slug==`string`?n.agent_slug:``,welcomeMessage:typeof n.welcome_message==`string`&&n.welcome_message?n.welcome_message:void 0,messages:(Array.isArray(n.messages)?n.messages:[]).map(t=>it(t,e.apiUrl)).filter(e=>e!==null),handles:tt(n.handles,e.apiUrl),agentHandle:typeof n.agent_handle==`string`&&n.agent_handle?n.agent_handle:void 0,withHuman:typeof n.handling==`string`&&n.handling!==`agents`,branding:n.branding===!0}}async function ut(e){let t=new FormData;t.append(`file`,e.file);let n=await fetch(pt(e),{method:`POST`,headers:{"X-Visitor-Token":e.visitorToken},body:t,signal:e.signal});if(!n.ok)throw await $e(n);let r=ot(await n.json());if(!r)throw new J(`The upload could not be read`,n.status);return r}async function dt(e){let t=await fetch(`${pt(e)}/${encodeURIComponent(e.attachmentId)}`,{method:`DELETE`,headers:{"X-Visitor-Token":e.visitorToken},signal:e.signal});if(!t.ok)throw await $e(t)}async function ft(e){let t=await fetch(`${pt(e)}/${encodeURIComponent(e.attachmentId)}/content`,{headers:{"X-Visitor-Token":e.visitorToken},signal:e.signal});if(!t.ok)throw await $e(t);return t.blob()}function pt(e){return Xe(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`)}async function mt(e){return gt(Xe(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}/messages`),{content:e.message,attachment_ids:e.attachmentIds??[],...e.context&&Object.keys(e.context).length>0?{context:e.context}:{}},e)}async function ht(e){return gt(Xe(e.apiUrl,`/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`),{tool_call_id:e.toolCallId,approved:e.approved},e)}async function gt(e,t,n){let r=await fetch(e,{method:`POST`,headers:Ze(n.visitorToken,n.subjectToken),body:JSON.stringify(t),signal:n.signal});if(!r.ok)throw await $e(r);if(!r.body)throw new J(`Answer with no stream body`);let i=r.body.getReader(),a=new TextDecoder,o=``,s=``,c=``,l,u,d={answer:``};try{for(;;){let{value:e,done:t}=await i.read();if(t)break;o+=a.decode(e,{stream:!0});let r=o.split(`
|
|
2
|
-
`);o=r.pop()??``;for(let e of r){let t=e.trim();if(!t){s=``;continue}if(t.startsWith(`event:`)){s=t.slice(6).trim();continue}if(!t.startsWith(`data:`))continue;let r=t.slice(5).trim();if(!r)continue;let i;try{i=JSON.parse(r)}catch{continue}s===`token`&&typeof i.text==`string`?(c+=i.text,n.onToken(i.text)):s===`done`?(d.answer=typeof i.content==`string`?i.content:c,d.agent=et(i.agent,n.apiUrl),typeof i.unknown_handle==`string`&&i.unknown_handle&&(d.unknownHandle=i.unknown_handle,d.offered=tt(i.handles,n.apiUrl))):s===`handoff`?(typeof i.to_agent_name==`string`&&(u=i.to_agent_name),c=``):s===`escalated`?d.withHuman=!0:s===`held`?(d.held=!0,d.withHuman=!0):s===`approval_required`?d.approval=nt(i):s===`error`&&(l=typeof i.detail==`string`?i.detail:`The turn failed`)}if(l)break}}finally{i.cancel().catch(()=>void 0)}if(l)throw new J(l);return!d.answer&&!d.approval&&(d.answer=c),u&&!d.agent&&(d.authorName=u),d}var _t=`squadico-chatbot:conversation`;function vt(){try{if(typeof sessionStorage>`u`)return;let e=sessionStorage.getItem(_t);if(!e)return;let t=JSON.parse(e);return!t.sessionId||!t.visitorToken||!t.embedKey?void 0:{sessionId:t.sessionId,visitorToken:t.visitorToken,embedKey:t.embedKey,user:typeof t.user==`string`?t.user:void 0}}catch{return}}function yt(e){try{if(typeof sessionStorage>`u`)return;sessionStorage.setItem(_t,JSON.stringify(e))}catch{}}function bt(){try{if(typeof sessionStorage>`u`)return;sessionStorage.removeItem(_t)}catch{}}function xt(e,{embedKey:t,user:n}){return e.embedKey===t&&e.user===n}async function St(e){if(e)try{return await e()||void 0}catch{return}}var Ct=`preview-welcome`;function wt(e){let t=e instanceof J?e.status:void 0;return t===415?`unsupported`:t===413?`tooLarge`:t===409?`tooMany`:t===422?`unreadable`:`failed`}var Tt=5e3;function Et(e){return e instanceof J&&e.code===`conversation_retired`}function Dt(e){let[t,n]=W([]),[r,i]=W(!1),[a,o]=W(``),[s,c]=W([]),[l,u]=W(``),[d,f]=W(``),[p,m]=W(null),[h,g]=W(!1),[_,v]=W(!1),[y,b]=W([]),[x,S]=W([]),[C,w]=W(null),T=K(null),E=K(e);E.current=e;let D=K(null),O=K(null),k=K(null),A=K(null),j=K(void 0),M=e.greeting,N=_e(()=>M?{id:`greeting`,role:`assistant`,content:M,createdAt:Date.now()}:null,[M]),P=q(e=>{E.current.onEvent?.(e)},[]),F=q((e,t)=>{n(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),I=q((e,t)=>{let n=e instanceof J?e.status:void 0,r=e instanceof Error?e.message:String(e),i=(E.current.locale??Ie(void 0)).t.error;t&&F(t,{content:i,streaming:!1,error:!0}),P({type:`chatbot-error`,message:r,status:n,sessionId:O.current?.sessionId??``}),typeof console<`u`&&console.error(`[squadico-chatbot]`,r)},[P,F]),ee=q(()=>{let e=E.current;if(!e.embedKey)throw new J(`No embed key: nothing says which application to open`);return{opts:e,apiUrl:e.apiUrl??`https://api.squadico.com`,embedKey:e.embedKey,claim:e.user}},[]),L=q((e,t)=>{let r={sessionId:t.conversationId,visitorToken:t.visitorToken};return O.current=r,j.current=e.claim?.id,yt({...r,embedKey:e.embedKey,user:e.claim?.id}),o(t.conversationId),c(t.handles),u(e.opts.agent&&t.agentHandle?t.agentHandle:``),f(t.agentHandle??``),g(!!t.withHuman),v(t.branding),n(e=>[...t.messages,...e.filter(e=>e.id!==Ct)]),r},[]),te=q(e=>{if(k.current)return k.current;let t=vt();if(!t||!xt(t,{embedKey:e.embedKey,user:e.claim?.id}))return Promise.resolve(null);let n=lt({apiUrl:e.apiUrl,conversationId:t.sessionId,visitorToken:t.visitorToken}).then(t=>L(e,t)).catch(()=>(bt(),null)).finally(()=>{k.current=null});return k.current=n,n},[L]),R=q(async()=>{if(O.current)return O.current;if(D.current)return D.current;let e=ee(),t=te(e).then(t=>t??ct({apiUrl:e.apiUrl,embedKey:e.embedKey,user:e.claim,agent:e.opts.agent}).then(t=>L(e,t)));D.current=t;try{return await t}finally{D.current=null}},[L,te,ee]),ne=q(()=>{if(O.current||D.current||A.current)return;let e;try{e=ee()}catch(e){I(e);return}let t=te(e).then(async t=>{if(t||O.current||D.current)return;let r=await st({apiUrl:e.apiUrl,embedKey:e.embedKey,agent:e.opts.agent});if(O.current||D.current)return;c(r.handles),u(e.opts.agent&&r.agentHandle?r.agentHandle:``),f(r.agentHandle??``),v(r.branding);let i=r.welcomeMessage;i&&n(e=>e.length>0?e:[{id:Ct,role:`assistant`,content:i,createdAt:Date.now(),agent:r.agent}])});A.current=t,t.catch(e=>{A.current=null,I(e)})},[I,te,ee]),re=q((e,t,{retry:r=!1,carried:a=[]}={})=>{if(T.current)return;let o=new AbortController;T.current=o,i(!0),m(null);let s=Ue();n(t=>[...t,{id:Ue(),role:`user`,content:e,createdAt:Date.now(),attachments:a.length>0?a:void 0},{id:s,role:`assistant`,content:``,createdAt:Date.now(),streaming:!0}]),(async()=>{let i=await R();P({type:`chatbot-message`,role:`user`,content:e,sessionId:i.sessionId});let a=``,c=e=>{a+=e,F(s,{content:a})},l;try{l=await t(i,c,o.signal)}catch(e){if(!Et(e)||(bt(),O.current=null,D.current=null,!r))throw e;i=await R(),a=``,F(s,{content:``}),l=await t(i,c,o.signal)}if(l.withHuman&&g(!0),l.held){n(e=>e.filter(e=>e.id!==s));return}F(s,{content:l.answer,streaming:!1,agent:l.agent,authorName:l.authorName,approval:l.approval,unknownHandle:l.unknownHandle,offered:l.offered}),m(l.approval??null),P({type:`chatbot-message`,role:`assistant`,content:l.answer,sessionId:i.sessionId,agent:l.agent?.handle})})().catch(e=>{if(o.signal.aborted){F(s,{streaming:!1});return}I(e,s)}).finally(()=>{T.current=null,i(!1)})},[R,P,I,F]),ie=q(e=>{let t=e.trim();if(!t&&y.length===0)return;let n=y;b([]),w(null),re(t,async(e,r,i)=>mt({subjectToken:await St(E.current.getSubjectToken),apiUrl:E.current.apiUrl??`https://api.squadico.com`,conversationId:e.sessionId,visitorToken:e.visitorToken,message:t,attachmentIds:n.map(e=>e.id),context:E.current.context?ke(E.current.context):void 0,onToken:r,signal:i}),{retry:!0,carried:n})},[y,re]),ae=q(e=>{w(null),S(t=>[...t,e.name]),R().then(t=>ut({apiUrl:E.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,file:e})).then(e=>b(t=>[...t,e])).catch(e=>w(wt(e))).finally(()=>S(t=>{let n=t.indexOf(e.name);return n<0?t:[...t.slice(0,n),...t.slice(n+1)]}))},[R]),z=q(e=>{b(t=>t.filter(t=>t.id!==e));let t=O.current;t&&dt({apiUrl:E.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,attachmentId:e}).catch(()=>{})},[]),B=q(async e=>{let t=O.current;if(!t)throw new J(`No conversation to read that file from`);return ft({apiUrl:E.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,attachmentId:e})},[]),V=q((e,t)=>{let n=p;n&&re(t,async(t,r,i)=>ht({subjectToken:await St(E.current.getSubjectToken),apiUrl:E.current.apiUrl??`https://api.squadico.com`,conversationId:t.sessionId,visitorToken:t.visitorToken,toolCallId:n.toolCallId,approved:e,onToken:r,signal:i}))},[p,re]),oe=q(()=>{T.current?.abort(),T.current=null,i(!1)},[]),H=q(()=>{T.current?.abort(),T.current=null,O.current=null,D.current=null,k.current=null,A.current=null,j.current=void 0,bt(),i(!1),m(null),g(!1),o(``),u(``),f(``),n([]),P({type:`chatbot-reset`,sessionId:``})},[P]),se=e.humanPollMs??Tt;G(()=>{if(!h||!a)return;let e=setInterval(()=>{let e=O.current;!e||T.current||lt({apiUrl:E.current.apiUrl??`https://api.squadico.com`,conversationId:e.sessionId,visitorToken:e.visitorToken}).then(e=>{n(e.messages),g(!!e.withHuman)}).catch(()=>{})},se);return()=>clearInterval(e)},[h,a,se]);let U=e.user?.id;return G(()=>{O.current&&j.current!==U&&H()},[U,H]),{messages:_e(()=>t.length===0&&N?[N]:t,[N,t]),busy:r,sessionId:a,handles:s,addressee:l,agentHandle:d,approval:p,withHuman:h,branding:_,start:ne,send:ie,attachments:y,uploading:x,attachmentError:C,attach:ae,detach:z,loadAttachment:B,decide:V,stop:oe,reset:H}}var Ot=0;Array.isArray;function Y(e,n,r,i,a,o){n||(n={});var s,c,l=n;if(`ref`in l)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ot,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return t.vnode&&t.vnode(u),u}function kt({name:e,color:t,url:n,size:r=16}){let[i,a]=W(void 0),o=!!n&&i!==n;return Y(`span`,{class:`sqc-avatar`,"aria-hidden":`true`,style:{width:`${r}px`,height:`${r}px`,fontSize:`${Math.round(r*.45)}px`,borderRadius:`${Math.round(r*.25)}px`,...o||!t?{}:{backgroundColor:t}},children:o?Y(`img`,{src:n,alt:``,onError:()=>a(n)}):At(e)})}function At(e){let t=Array.from(e.trim())[0];return t?t.toLocaleUpperCase():`?`}function jt({handles:e,active:t,disabled:n,onPick:r,label:i}){return Y(`nav`,{class:`sqc-rail`,"aria-label":i,children:e.map(e=>Y(`button`,{type:`button`,class:`sqc-rail__item`,"aria-label":e.name,"aria-pressed":e.handle===t,"data-tip":e.name,disabled:n,onClick:()=>r(e.handle),children:[Y(kt,{name:e.name,color:e.color,url:e.avatarUrl,size:40}),Y(`span`,{class:`sqc-rail__label`,"aria-hidden":`true`,children:Mt(e.handle)})]},e.handle))})}function Mt(e){let t=e.split(/[-_]/)[0]??e;return t.charAt(0).toUpperCase()+t.slice(1)}var Nt=132,Pt=`image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json`,Ft=/^[a-zA-Z0-9_-]*$/;function It(e,t){let n=e.slice(0,t),r=n.lastIndexOf(`@`);if(r<0||r>0&&!/\s/.test(n[r-1]??``))return null;let i=n.slice(r+1);return Ft.test(i)?{start:r,query:i}:null}function Lt({placeholder:e,locale:t,busy:n,autoFocus:r,handles:i,addressee:a,attachments:o=[],uploading:s=[],attachmentError:c,onAttach:l,onDetach:u,onSend:d,onStop:f}){let[p,m]=W(``),[h,g]=W(null),[_,v]=W(0),[y,b]=W(!1),x=K(null),C=K(null),w=!!l,T=s.length>0,E=_e(()=>{if(!h||!i||i.length===0)return[];let e=h.query.toLowerCase();return i.filter(t=>t.handle.startsWith(e))},[i,h]),D=E.length>0,O=q(()=>{let e=x.current;if(!e)return;e.style.height=`auto`;let t=e.scrollHeight>Nt;e.style.height=`${Math.min(e.scrollHeight,Nt)}px`,e.style.overflowY=t?`auto`:`hidden`},[]);G(()=>{r&&x.current?.focus(),O()},[r,O]),G(()=>{a&&(m(e=>e||`@${a} `),requestAnimationFrame(O))},[a,O]);let k=q(e=>{g(It(e.value,e.selectionStart??e.value.length)),v(0)},[]),A=q(e=>{let t=x.current;if(!t||!h)return;let n=t.selectionStart??t.value.length,r=`${p.slice(0,h.start)}@${e} ${p.slice(n)}`,i=h.start+e.length+2;m(r),g(null),requestAnimationFrame(()=>{t.focus(),t.setSelectionRange(i,i),O()})},[O,h,p]),j=q(e=>{if(!(!l||!e))for(let t of Array.from(e))l(t)},[l]),M=q(()=>{let e=p.trim();!e&&o.length===0||n||T||(d(e),m(``),g(null),requestAnimationFrame(O))},[o.length,n,O,d,p,T]),N=q(e=>{if(D&&!e.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:E.length-1;v(e=>(e+t)%E.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),A((E[_]??E[0]).handle);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),g(null);return}}e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),M())},[_,E,A,D,M]),P=Ye-p.length;return Y(`form`,{class:`sqc-composer${y?` sqc-composer--dropping`:``}`,onSubmit:e=>{e.preventDefault(),M()},onDragOver:e=>{w&&(e.preventDefault(),b(!0))},onDragLeave:()=>b(!1),onDrop:e=>{w&&(e.preventDefault(),b(!1),j(e.dataTransfer?.files??null))},children:[(o.length>0||T||c)&&Y(`div`,{class:`sqc-attachments`,children:[o.map(e=>Y(`span`,{class:`sqc-chip`,"data-kind":e.kind,children:[Y(`span`,{class:`sqc-chip__name`,children:e.filename}),Y(`button`,{type:`button`,class:`sqc-chip__remove`,"aria-label":t.t.composer.remove.replace(`{name}`,e.filename),onClick:()=>u?.(e.id),children:`×`})]},e.id)),s.map(e=>Y(`span`,{class:`sqc-chip sqc-chip--waiting`,children:Y(`span`,{class:`sqc-chip__name`,children:e})},e)),c&&Y(`p`,{class:`sqc-attachments__error`,role:`status`,children:c})]}),Y(`div`,{class:`sqc-composer__field`,children:[D&&Y(`ul`,{class:`sqc-mentions`,role:`listbox`,"aria-label":t.t.handles.picker,children:E.map((e,t)=>Y(`li`,{role:`option`,"aria-selected":t===_,class:`sqc-mention${t===_?` sqc-mention--active`:``}`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>v(t),onClick:()=>A(e.handle),children:[Y(`span`,{class:`sqc-mention__icon`,children:Y(kt,{name:e.name,color:e.color,url:e.avatarUrl,size:18})}),Y(`span`,{class:`sqc-mention__handle`,children:[`@`,e.handle]}),Y(`span`,{class:`sqc-mention__name`,children:e.name})]},e.handle))}),Y(`textarea`,{ref:x,class:`sqc-composer__input`,rows:1,value:p,placeholder:e,maxLength:Ye,"aria-label":t.t.composer.label,onInput:e=>{m(e.currentTarget.value),k(e.currentTarget),O()},onKeyDown:N,onClick:e=>k(e.currentTarget),onPaste:e=>{let t=e.clipboardData?.files;!w||!t||t.length===0||(e.preventDefault(),j(t))}}),P<=200&&Y(`span`,{class:`sqc-composer__count`,"aria-live":`polite`,children:P})]}),w&&Y(S,{children:[Y(`input`,{ref:C,type:`file`,multiple:!0,accept:Pt,class:`sqc-file-input`,onChange:e=>{j(e.currentTarget.files),e.currentTarget.value=``}}),Y(`button`,{type:`button`,class:`sqc-btn sqc-btn--attach`,onClick:()=>C.current?.click(),"aria-label":t.t.composer.attach,title:t.t.composer.attachTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.9`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:Y(`path`,{d:`M21 11.5l-8.8 8.8a5 5 0 01-7.1-7.1l9-9a3.3 3.3 0 014.7 4.7l-9 9a1.6 1.6 0 01-2.3-2.3l8.3-8.3`})})})]}),n?Y(`button`,{type:`button`,class:`sqc-btn sqc-btn--stop`,onClick:f,"aria-label":t.t.composer.stop,title:t.t.composer.stopTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:Y(`rect`,{x:`7`,y:`7`,width:`10`,height:`10`,rx:`2`,fill:`currentColor`})})}):Y(`button`,{type:`submit`,class:`sqc-btn sqc-btn--send`,disabled:!p.trim()&&o.length===0||T,"aria-label":t.t.composer.send,title:t.t.composer.sendTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.9`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:Y(`path`,{d:`M5 12l14-7-5 14-2.5-5.5L5 12z`})})})]})}var Rt={fr:/\br[ée]ponde?z? +«?\s*oui\b/i,en:/\b(?:reply|answer|respond) +[“"']?\s*yes\b/i,es:/\bresponda?e?d? +«?\s*s[íi]\b/i},zt={fr:[/\b(?:confirmes?[- ]tu|confirmez[- ]vous)\b/i,/\b(?:valides?[- ]tu|validez[- ]vous)\b/i,/\b(?:es[- ]tu s[ûu]re?|[êe]tes[- ]vous s[ûu]re?s?)\b/i,/\b(?:dois[- ]je|puis[- ]je)\b/i,/\b(?:je continue|on continue|on y va|je lance)\b/i,Rt.fr],en:[/\bdo you confirm\b/i,/\bdo you (?:want|wish) me to\b/i,/\b(?:shall|should) I\b/i,/\bare you sure\b/i,/\b(?:shall we|should I) (?:proceed|continue|go ahead)\b/i,Rt.en],es:[/\b(?:confirmas|confirma|confirm[áa]is)\b/i,/\b(?:validas|valida|valid[áa]is)\b/i,/\best[áa]s? seguro\b/i,/\b(?:contin[úu]o|procedo|lo lanzo|lo hago)\b/i,/\bquieres? que\b/i,Rt.es]},Bt=/^\s*(?:[-*•]\s+)?\[[ xX]\]\s+/m;function Vt(e,t=`en`){if(Bt.test(e))return!1;let n=e.split(`
|
|
3
|
-
`).map(e=>e.trim()).filter(Boolean),r=n[n.length-1];return!r||!r.includes(`?`)&&!Rt[t].test(r)?!1:zt[t].some(e=>e.test(r))}var Ht=/^(?:mcp|custom|a2a)_[0-9a-f]{8}_/;function Ut(e){let t=e.replace(Ht,``).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim().toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):e}function Wt(e,t){return e===!0?t.t.confirm.yes:e===!1?t.t.confirm.no:typeof e==`string`?e:JSON.stringify(e)??String(e)}function Gt({locale:e,call:t,onDecide:n}){let{approval:r,confirm:i}=e.t,[a,o]=W(null),s=!!n&&a===null,c=(e,t)=>{o(t),n?.(e,t)},l=t?Object.entries(t.arguments):[];return Y(`div`,{class:`sqc-approval`,role:`group`,"aria-label":r.group,children:[t&&Y(`p`,{class:`sqc-approval__request`,"data-testid":`sqc-approval-tool`,children:r.request.replace(`{tool}`,Ut(t.tool))}),l.length>0&&Y(`dl`,{class:`sqc-approval__args`,"data-testid":`sqc-approval-arguments`,children:l.map(([t,n])=>Y(`div`,{class:`sqc-approval__arg`,children:[Y(`dt`,{class:`sqc-approval__arg-name`,children:Ut(t)}),Y(`dd`,{class:`sqc-approval__arg-value`,children:Wt(n,e)})]},t))}),Y(`div`,{class:`sqc-approval__actions`,children:[Y(`button`,{type:`button`,class:`sqc-approval__btn sqc-approval__btn--yes`,"aria-pressed":a===i.yes,disabled:!s,onClick:()=>c(!0,i.yes),children:r.approve}),Y(`button`,{type:`button`,class:`sqc-approval__btn sqc-approval__btn--no`,"aria-pressed":a===i.no,disabled:!s,onClick:()=>c(!1,i.no),children:r.reject})]})]})}function Kt({locale:e,onPick:t}){let[n,r]=W(null),i=!!t&&n===null,{confirm:a}=e.t,o=[{value:a.yesValue,label:a.yes,kind:`yes`},{value:a.noValue,label:a.no,kind:`no`}];return Y(`div`,{class:`sqc-confirm`,role:`group`,"aria-label":a.group,children:o.map(e=>Y(`button`,{type:`button`,class:`sqc-confirm__btn sqc-confirm__btn--${e.kind}`,"aria-pressed":n===e.value,disabled:!i,onClick:()=>{r(e.value),t?.(e.value)},children:e.label},e.value))})}function qt(){return Y(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"aria-hidden":`true`,children:Y(`path`,{d:`M3.5 8.5l3 3 6-7`,"stroke-linecap":`round`,"stroke-linejoin":`round`})})}function Jt({items:e,locale:t,onPick:n}){let[r,i]=W(null),a=!!n&&r===null;return Y(`div`,{class:`sqc-choices`,role:`group`,"aria-label":t.t.choices,children:e.map((e,t)=>{let o=r===null?e.checked:r===e.label;return Y(`button`,{type:`button`,class:`sqc-choice`,"aria-pressed":o,disabled:!a,onClick:()=>{i(e.label),n?.(e.label)},children:[Y(`span`,{class:`sqc-choice__box${o?` sqc-choice__box--on`:``}`,"aria-hidden":`true`,children:o&&Y(qt,{})}),Y(`span`,{class:`sqc-choice__label`,children:e.content})]},`${t}-${e.label}`)})})}var Yt=/(\*\*[^*\n]+\*\*|`[^`\n]+`|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\s]+\)|\*[^*\n]+\*|https?:\/\/[^\s<>()]+)/g,Xt=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/,Zt=/^(https?:|mailto:)/i;function Qt(e,t,n){return Zt.test(e)?Y(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t},n):t}function $t(e,t){let n=e.split(Yt),r=[];return n.forEach((e,n)=>{if(!e)return;let i=`${t}-${n}`,a=Xt.exec(e);e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>4?r.push(Y(`strong`,{children:e.slice(2,-2)},i)):e.startsWith("`")&&e.endsWith("`")&&e.length>2?r.push(Y(`code`,{children:e.slice(1,-1)},i)):e.startsWith(`~~`)&&e.endsWith(`~~`)&&e.length>4?r.push(Y(`del`,{children:e.slice(2,-2)},i)):a?r.push(Qt(a[2],a[1],i)):e.startsWith(`*`)&&e.endsWith(`*`)&&e.length>2?r.push(Y(`em`,{children:e.slice(1,-1)},i)):/^https?:\/\//.test(e)?r.push(Qt(e,e,i)):r.push(e)}),r}var en=/^\s*(?:[-*•]\s+)?\[([ xX])\]\s+(.+)$/;function tn(e){return e.replace(/\[([^\]\n]+)\]\([^)\s]+\)/g,`$1`).replace(/\*\*|~~|`|\*/g,``).trim()}var nn=/^(\s*)[-*•]\s+/,rn=/^(\s*)\d+[.)]\s+/,an=/^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/,on=/^\s*([-*_])(?:\s*\1){2,}\s*$/,sn=/^\s*>\s?(.*)$/,cn=/^\s*\|.*\|\s*$/,ln=/^\s*\|(?:\s*:?-{1,}:?\s*\|)+\s*$/,un=/^\s*```/;function dn(e){return e.replace(/^\s*\|/,``).replace(/\|\s*$/,``).split(`|`).map(e=>e.trim())}function fn(e,t,n,r){let i=e[t].ordered,a=[],o=t;for(;o<e.length&&e[o].depth>=n;){let t=e[o];if(t.depth===n&&t.ordered!==i)break;if(t.depth>n){let[n,i]=fn(e,o,t.depth,`${r}-${o}`),s=a[a.length-1];s?s.nested.push(n):a.push({key:`${r}-${o}`,text:null,nested:[n]}),o=i;continue}a.push({key:`${r}-${o}`,text:t.text,nested:[]}),o+=1}let s=a.map(e=>Y(`li`,{children:[e.text===null?null:$t(e.text,e.key),e.nested]},e.key));return[Y(i?`ol`:`ul`,{children:s},r),o]}function pn({text:e,locale:t,onChoice:n}){let r=e.split(`
|
|
4
|
-
`),i=[],a=[],o=[],s=[],c=()=>{if(!a.length)return;let e=`p${i.length}`;i.push(Y(`p`,{children:$t(a.join(`
|
|
5
|
-
`),e)},e)),a=[]},l=()=>{if(!o.length)return;let e=0;for(;e<o.length;){let t=`l${i.length}`,[n,r]=fn(o,e,o[e].depth,t);i.push(n),e=r}o=[]},u=()=>{if(!s.length)return;let e=`q${i.length}`;i.push(Y(`blockquote`,{children:$t(s.join(`
|
|
6
|
-
`),e)},e)),s=[]},d=()=>{c(),l(),u()};for(let e=0;e<r.length;e+=1){let f=r[e];if(un.test(f)){d();let t=[];for(e+=1;e<r.length&&!un.test(r[e]);)t.push(r[e]),e+=1;let n=`c${i.length}`;i.push(Y(`pre`,{children:Y(`code`,{children:t.join(`
|
|
7
|
-
`)})},n));continue}if(cn.test(f)&&e+1<r.length&&ln.test(r[e+1])){d();let t=dn(f),n=[];for(e+=2;e<r.length&&cn.test(r[e]);)n.push(dn(r[e])),e+=1;--e;let a=`t${i.length}`;i.push(Y(`div`,{class:`sqc-table`,children:Y(`table`,{children:[Y(`thead`,{children:Y(`tr`,{children:t.map((e,t)=>Y(`th`,{children:$t(e,`${a}-h${t}`)},`${a}-h${t}`))})}),Y(`tbody`,{children:n.map((e,n)=>Y(`tr`,{children:t.map((t,r)=>Y(`td`,{children:$t(e[r]??``,`${a}-r${n}c${r}`)},`${a}-r${n}c${r}`))},`${a}-r${n}`))})]})},a));continue}if(!f.trim()){d();continue}if(en.test(f)){d();let a=[];for(;e<r.length;){let t=en.exec(r[e]);if(!t)break;let n=t[2].trim(),o=`o${i.length}-${a.length}`;a.push({label:tn(n),checked:t[1].toLowerCase()===`x`,content:$t(n,o)}),e+=1}--e,i.push(Y(Jt,{items:a,locale:t,onPick:n},`o${i.length}`));continue}let p=an.exec(f);if(p){d();let e=p[1].length,t=e<=2?`h3`:e===3?`h4`:`h5`,n=`h${i.length}`;i.push(Y(t,{children:$t(p[2],n)},n));continue}if(on.test(f)){d(),i.push(Y(`hr`,{},`r${i.length}`));continue}let m=sn.exec(f);if(m){c(),l(),s.push(m[1]);continue}let h=nn.exec(f),g=h?null:rn.exec(f),_=h??g;if(_){c(),u(),o.push({depth:_[1].replace(/\t/g,` `).length,ordered:!!g,text:f.slice(_[0].length)});continue}l(),u(),a.push(f)}return d(),Y(S,{children:i})}var mn=80;function hn({at:e,locale:t}){let n=new Date(e);return Y(`time`,{class:`sqc-msg__time`,dateTime:n.toISOString(),children:n.toLocaleTimeString(t.tag,{hour:`2-digit`,minute:`2-digit`})})}function gn({file:e,load:t}){let[n,r]=W(null);return G(()=>{let n=null,i=!0;return t(e.id).then(e=>{i&&(n=URL.createObjectURL(e),r(n))}).catch(()=>{}),()=>{i=!1,n&&URL.revokeObjectURL(n)}},[e.id,t]),n?Y(`img`,{class:`sqc-attachment__image`,src:n,alt:e.filename}):Y(`span`,{class:`sqc-chip sqc-chip--waiting`,children:e.filename})}function _n({files:e,load:t}){return e.length===0||!t?null:Y(`div`,{class:`sqc-attachments sqc-attachments--sent`,children:e.map(e=>e.kind===`image`?Y(gn,{file:e,load:t},e.id):Y(`span`,{class:`sqc-chip`,"data-kind":`document`,children:Y(`span`,{class:`sqc-chip__name`,children:e.filename})},e.id))})}function vn({message:e,locale:t,assistantName:n,onChoice:r,onDecide:i,onLoadAttachment:a}){let o=e.streaming&&!e.content,s=!!e.approval;return Y(`div`,{class:`sqc-msg sqc-msg--${e.role}${e.error?` sqc-msg--error`:``}`,children:[e.role===`assistant`&&Y(`div`,{class:`sqc-msg__who`,children:[e.agent?Y(kt,{name:e.agent.name,color:e.agent.color,url:e.agent.avatarUrl}):Y(bn,{}),e.authorName??e.agent?.name??n]}),Y(`div`,{class:`sqc-msg__bubble`,children:[o?Y(`span`,{class:`sqc-typing`,"aria-label":t.t.typing,children:[Y(`i`,{}),Y(`i`,{}),Y(`i`,{})]}):Y(`div`,{class:`sqc-msg__body`,children:[Y(pn,{text:e.content,locale:t,onChoice:r}),e.streaming&&Y(`span`,{class:`sqc-caret`,"aria-hidden":`true`}),s&&Y(Gt,{locale:t,call:e.content.trim()===``?e.approval:void 0,onDecide:i}),e.role===`assistant`&&!s&&!e.streaming&&!e.error&&Vt(e.content,t.code)&&Y(Kt,{locale:t,onPick:r}),e.unknownHandle&&!e.streaming&&Y(yn,{message:e,locale:t}),Y(_n,{files:e.attachments??[],load:a})]}),!o&&Y(hn,{at:e.createdAt,locale:t})]})]})}function yn({message:e,locale:t}){let n=e.offered??[];return Y(`p`,{class:`sqc-msg__unaddressed`,children:[Y(`span`,{children:t.t.handles.unknown}),` `,Y(`code`,{children:[`@`,e.unknownHandle]}),n.length>0&&Y(S,{children:[` `,Y(`span`,{children:t.t.handles.instead}),` `,n.map(e=>Y(`code`,{children:[`@`,e.handle]},e.handle))]})]})}function bn(){return Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:Y(`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`})})}function xn({messages:e,locale:t,assistantName:n,suggestions:r,showSuggestions:i,busy:a,withHuman:o,onSuggestion:s,onChoice:c,onDecide:l,onLoadAttachment:u}){let d=K(null),f=K(!0);return ge(()=>{let e=d.current;e&&f.current&&(e.scrollTop=e.scrollHeight)},[e]),G(()=>{let e=d.current;if(!e)return;let t=()=>{f.current=e.scrollHeight-e.scrollTop-e.clientHeight<mn};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),Y(`div`,{class:`sqc-messages`,ref:d,role:`log`,"aria-live":`polite`,"aria-atomic":`false`,children:[e.map((r,i)=>Y(vn,{message:r,locale:t,assistantName:n,onChoice:!a&&r.role===`assistant`&&i===e.length-1?c:void 0,onDecide:!a&&r.role===`assistant`&&i===e.length-1?l:void 0,onLoadAttachment:u},r.id)),o&&Y(`p`,{class:`sqc-with-human`,role:`status`,children:t.t.withHuman}),i&&r&&r.length>0&&Y(`div`,{class:`sqc-suggestions`,children:r.map(e=>Y(`button`,{type:`button`,class:`sqc-suggestion`,onClick:()=>s(e),children:e},e))})]})}var Sn={width:`min(392px, 100vw)`},Cn=new Set([`sessionId`]);function wn(e){let t=e.replace(/Id$|Ref$/,``).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim().toLowerCase();return t?t.charAt(0).toUpperCase()+t.slice(1):e}function Tn(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e)){if(Cn.has(n)||typeof r!=`string`&&!Oe(r))continue;let e=De(r);e&&t.push({label:wn(n),value:e})}return t}function En(e,t){return e?.trim()?e:t}function Dn(e){let[t,n]=W(!1);return G(()=>{if(e!==`auto`||typeof matchMedia!=`function`)return;let t=matchMedia(`(prefers-color-scheme: dark)`);n(t.matches);let r=e=>n(e.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),e===`dark`?`dark`:e===`light`?`light`:t?`dark`:`light`}function On(e){let t=e.persistOpen??!0,[n,r]=W(()=>Be(e.defaultOpen,t)),[i,a]=W(!1),[o,s]=W(!1),c=K(null),l=K(null),u=Dn(e.theme??`light`),d=_e(()=>Ie(e.locale),[e.locale]),f=d.t,p=En(e.heading,f.heading),m=En(e.assistantName,f.assistant),h=En(e.greeting,f.greeting),g=e.onEvent,{send:_,reset:v,decide:y,stop:b,start:x,busy:S,messages:C,withHuman:w,branding:T,sessionId:E,handles:D,addressee:O,agentHandle:k,attachments:A,uploading:j,attachmentError:M,attach:N,detach:P,loadAttachment:F}=Dt({embedKey:e.embedKey,user:e.user,getSubjectToken:e.getSubjectToken,agent:e.agent,context:e.context,greeting:h,locale:d,onEvent:g});G(()=>{!n&&C.some(e=>e.role===`assistant`&&e.id!==`greeting`)&&s(!0)},[C,n]);let I=K(n);I.current=n;let ee=q(()=>{s(!1),!I.current&&(I.current=!0,r(!0),t&&ze(!0),g?.({type:`chatbot-open`,sessionId:E}))},[g,t,E]),L=q(()=>{I.current&&(I.current=!1,r(!1),t&&ze(!1),g?.({type:`chatbot-close`,sessionId:E}),l.current?.focus())},[g,t,E]);G(()=>{n&&x()},[n,x]);let te=D.length>=2,R=Ve(C,k||void 0),[ne,re]=W(void 0),ie=K(void 0),ae=q(e=>{ie.current=e,re(e)},[]);G(()=>{ie.current=void 0,re(void 0)},[R]);let z=q(e=>{a(!0),_(te?He(e,ie.current,R):e)},[_,te,R]),B=q(()=>{a(!1),s(!1),v()},[v]),V=K({openPanel:ee,closePanel:L,send:z,reset:B,sessionId:E});V.current={openPanel:ee,closePanel:L,send:z,reset:B,sessionId:E};let oe=K({open:()=>V.current.openPanel(),close:()=>V.current.closePanel(),toggle:()=>I.current?V.current.closePanel():V.current.openPanel(),reset:()=>V.current.reset(),send:e=>{V.current.openPanel(),V.current.send(e)},isOpen:()=>I.current,sessionId:()=>V.current.sessionId}),H=e.bind;ge(()=>(H?.(oe.current),()=>H?.(null)),[H]),G(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),L())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[L,n]);let se=_e(()=>C.some(e=>e.id!==`greeting`),[C]),U=_e(()=>Tn(e.context),[e.context]),ce={...e.accent?{"--sqc-accent":e.accent}:{},"--sqc-width":e.width??Sn.width};return Y(`div`,{class:`sqc`,"data-theme":u,"data-position":e.position??`bottom-right`,"data-layout":e.layout??`sidebar`,"data-open":n?`true`:`false`,style:ce,children:[Y(`button`,{ref:l,type:`button`,class:`sqc-launcher`,"aria-label":p,"aria-expanded":n,"aria-haspopup":`dialog`,onClick:ee,children:[Y(`span`,{class:`sqc-launcher__icon`,children:Y(`slot`,{name:`launcher-icon`,class:`sqc-slot-icon`,children:Y(bn,{})})}),o&&Y(`span`,{class:`sqc-launcher__badge`,"aria-hidden":`true`})]}),Y(`aside`,{ref:c,class:`sqc-panel`,role:`dialog`,"aria-modal":`false`,"aria-label":p,...n?{}:{inert:!0},children:[Y(`header`,{class:`sqc-header`,children:[Y(`span`,{class:`sqc-header__icon`,"aria-hidden":`true`,children:Y(bn,{})}),Y(`div`,{class:`sqc-header__titles`,children:[Y(`p`,{class:`sqc-header__heading`,children:p}),Y(`p`,{class:`sqc-header__sub`,children:En(e.subheading,f.subheading)})]}),Y(`button`,{type:`button`,class:`sqc-icon-btn`,onClick:B,"aria-label":f.newConversation,"data-tip":f.newConversation,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,children:Y(`path`,{d:`M20 12a8 8 0 1 1-2.6-5.9M20 4v4h-4`,"stroke-linecap":`round`})})}),Y(`button`,{type:`button`,class:`sqc-icon-btn`,onClick:L,"aria-label":f.close,"data-tip":f.closeTitle,children:Y(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,children:Y(`path`,{d:`M6 6l12 12M18 6L6 18`,"stroke-linecap":`round`})})})]}),Y(`div`,{class:`sqc-panel__body`,children:[te&&Y(jt,{handles:D,active:ne??R,disabled:w,onPick:ae,label:f.handles.rail}),Y(`div`,{class:`sqc-panel__main`,children:[(e.showContext??!0)&&U.length>0&&Y(`div`,{class:`sqc-context`,"aria-label":f.context.region,children:U.map(e=>Y(`span`,{class:`sqc-chip`,title:`${e.label}: ${e.value}`,children:[Y(`b`,{children:e.label}),e.value]},e.label))}),Y(xn,{messages:C,locale:d,assistantName:m,suggestions:e.suggestions,showSuggestions:!i&&!se,busy:S,withHuman:w,onSuggestion:z,onChoice:z,onDecide:y,onLoadAttachment:F}),Y(Lt,{placeholder:En(e.placeholder,f.placeholder),locale:d,busy:S,autoFocus:n,handles:D,addressee:O,attachments:A,uploading:j,attachmentError:M?f.attachments[M]:void 0,onAttach:N,onDetach:P,onSend:z,onStop:b}),Y(`p`,{class:`sqc-hint`,children:f.hint}),T&&Y(`p`,{class:`sqc-powered`,children:Y(`a`,{href:`https://squadico.com`,target:`_blank`,rel:`noopener noreferrer`,children:f.poweredBy})})]})]})]})]})}var kn=`:host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480000;--sqc-radius:16px;--sqc-font-family:"Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--sqc-font-heading:var(--sqc-font-family);z-index:var(--sqc-z);pointer-events:none;font-family:var(--sqc-font-family);-webkit-font-smoothing:antialiased;text-align:left;font-size:14px;line-height:1.5;display:block;position:fixed;top:0;bottom:0;left:0;right:0;margin:0!important}:host([hidden]){display:none}.sqc{--sqc-neutral-50:#f8fafc;--sqc-neutral-100:#f1f5f9;--sqc-neutral-200:#e2e8f0;--sqc-neutral-300:#cbd5e1;--sqc-neutral-400:#94a3b8;--sqc-neutral-500:#64748b;--sqc-neutral-600:#475569;--sqc-neutral-900:#0f172a;--sqc-error-50:#fff1f2;--sqc-error-100:#ffe4e6;--sqc-error-600:#e11d48;--sqc-accent-default:#000;--sqc-accent-color:var(--sqc-accent,var(--sqc-accent-default));--sqc-on-accent:#fff;--sqc-accent-hover:color-mix(in oklab, var(--sqc-accent-color) 84%, var(--sqc-on-accent));--sqc-accent-fg:var(--sqc-accent,var(--sqc-text));--sqc-bg:#fff;--sqc-surface:var(--sqc-neutral-50);--sqc-selected:var(--sqc-neutral-100);--sqc-border:var(--sqc-neutral-200);--sqc-border-strong:var(--sqc-neutral-300);--sqc-text:var(--sqc-neutral-900);--sqc-text-muted:var(--sqc-neutral-500);--sqc-link:#2563eb;--sqc-bubble-user:var(--sqc-accent-color);--sqc-bubble-user-text:var(--sqc-on-accent);--sqc-code-bg:var(--sqc-neutral-100);--sqc-disabled:var(--sqc-neutral-300);--sqc-shadow:0 10px 15px -3px #0f172a1a, 0 4px 6px -4px #0f172a1a;--sqc-shadow-bottom:0 6px 8px -6px #0f172a2e;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #0f172a4d;--sqc-focus-input:0 0 0 3px #0f172a1a;--sqc-danger:var(--sqc-error-600);color:var(--sqc-text);position:absolute;top:0;bottom:0;left:0;right:0}.sqc[data-theme=dark]{--sqc-neutral-50:#172033;--sqc-neutral-100:#1e293b;--sqc-neutral-200:#334155;--sqc-neutral-300:#475569;--sqc-neutral-400:#64748b;--sqc-neutral-500:#94a3b8;--sqc-neutral-600:#cbd5e1;--sqc-neutral-900:#f8fafc;--sqc-error-50:#2a0a12;--sqc-error-100:#4c0519;--sqc-error-600:#fb7185;--sqc-accent-default:#fff;--sqc-on-accent:#0f172a;--sqc-bg:#0f172a;--sqc-link:#60a5fa;--sqc-code-bg:#020617;--sqc-shadow:0 10px 24px -4px #0000008c;--sqc-shadow-bottom:0 6px 8px -6px #0000008c;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #f8fafc59;--sqc-focus-input:0 0 0 3px #f8fafc1f}@supports (color:oklch(from red l c h)){.sqc{--sqc-on-accent:oklch(from var(--sqc-accent-color) clamp(.208, (.62 - l) * 1000, 1) 0 0)}}.sqc *,.sqc :before,.sqc :after{box-sizing:border-box}.sqc-launcher{background:var(--sqc-accent-color);width:56px;height:56px;color:var(--sqc-on-accent);cursor:pointer;pointer-events:auto;box-shadow:var(--sqc-shadow);border:none;border-radius:50%;place-items:center;padding:0;transition:transform .18s,opacity .18s,background .18s,box-shadow .18s;display:grid;position:absolute;bottom:24px;right:24px}.sqc[data-position=bottom-left] .sqc-launcher{left:24px;right:auto}.sqc-launcher:hover{background:var(--sqc-accent-hover);transform:scale(1.06)}.sqc-launcher:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc[data-open=true] .sqc-launcher{opacity:0;pointer-events:none;transform:scale(.5)}.sqc-launcher__icon svg{width:26px;height:26px;display:block}.sqc-slot-icon::slotted(*){justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.sqc-launcher__badge{background:var(--sqc-error-600);border:2px solid var(--sqc-bg);border-radius:50%;width:12px;height:12px;position:absolute;top:6px;right:6px}.sqc-panel{width:var(--sqc-width);background:var(--sqc-bg);border-left:1px solid var(--sqc-border);box-shadow:var(--sqc-shadow);pointer-events:auto;visibility:hidden;flex-direction:column;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;display:flex;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.sqc-panel__body{flex:1;min-height:0;display:flex}.sqc-panel__main{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sqc-rail{border-right:1px solid var(--sqc-border);background:color-mix(in oklab, var(--sqc-accent-color) 7%, var(--sqc-bg));flex-direction:column;flex-shrink:0;align-items:stretch;gap:6px;width:72px;padding:12px 0;display:flex;overflow:visible}.sqc-rail__item{color:var(--sqc-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;flex-direction:column;align-items:center;gap:4px;padding:4px 0;display:flex;position:relative}.sqc-rail__label{white-space:nowrap;text-overflow:ellipsis;max-width:64px;font-size:10.5px;font-weight:500;line-height:1.2;overflow:hidden}.sqc-rail__item:hover,.sqc-rail__item[aria-pressed=true]{color:var(--sqc-text)}.sqc-rail__item[aria-pressed=true] .sqc-rail__label{font-weight:600}.sqc-rail__item .sqc-avatar{transition:box-shadow .15s}.sqc-rail__item[aria-pressed=true] .sqc-avatar{box-shadow:0 0 0 2px var(--sqc-bg), 0 0 0 4px var(--sqc-accent-color)}.sqc-rail__item:before{content:"";background:var(--sqc-text);border-radius:0 4px 4px 0;width:4px;height:0;transition:height .15s;position:absolute;top:24px;left:0;transform:translateY(-50%)}.sqc-rail__item:hover:before{height:12px}.sqc-rail__item[aria-pressed=true]:before{height:32px}.sqc-rail__item:focus-visible{outline:2px solid var(--sqc-accent-color);outline-offset:-2px;border-radius:8px}.sqc-rail__item:disabled{cursor:not-allowed;opacity:.5}.sqc-rail__item[data-tip]:after{content:attr(data-tip);z-index:2;background:var(--sqc-text);color:var(--sqc-bg);white-space:nowrap;pointer-events:none;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;transition:opacity .12s;position:absolute;top:24px;left:calc(100% + 6px);transform:translateY(-50%)}.sqc-rail__item[data-tip]:hover:after{opacity:1}.sqc-rail__item[data-tip]:focus-visible:after{opacity:1}.sqc[data-open=true] .sqc-panel{visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility;transform:translate(0)}.sqc[data-layout=floating] .sqc-panel{max-width:calc(100% - 48px);height:var(--sqc-height);border:1px solid var(--sqc-border);border-radius:var(--sqc-radius);opacity:0;transform-origin:100% 100%;max-height:calc(100% - 48px);transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility 0s linear .22s;top:auto;bottom:24px;right:24px;overflow:hidden;transform:translateY(16px)scale(.96)}.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{transform-origin:0 100%;left:24px;right:auto}.sqc[data-layout=floating][data-open=true] .sqc-panel{opacity:1;transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility;transform:none}.sqc-header{background:var(--sqc-bg);color:var(--sqc-text);border-bottom:1px solid var(--sqc-border);flex-shrink:0;align-items:center;gap:8px;padding:13px 12px 13px 16px;display:flex}.sqc-header__icon{color:var(--sqc-accent-fg);flex-shrink:0;place-items:center;display:grid}.sqc-header__icon svg{width:17px;height:17px;display:block}.sqc-header__titles{flex:1;min-width:0}.sqc-header__heading,.sqc-header__sub{text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.sqc-header__heading{font-family:var(--sqc-font-heading);letter-spacing:-.2px;font-size:15px;font-weight:700}.sqc-header__sub{color:var(--sqc-text-muted);font-size:12px}.sqc-icon-btn{width:26px;height:26px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:none;border-radius:8px;flex-shrink:0;place-items:center;transition:background .15s;display:grid}.sqc-icon-btn:hover{background:var(--sqc-surface);color:var(--sqc-text)}.sqc-icon-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-icon-btn svg{width:16px;height:16px}.sqc-icon-btn[data-tip]{position:relative}.sqc-icon-btn[data-tip]:after{content:attr(data-tip);z-index:6;background:var(--sqc-text);color:var(--sqc-bg);font-family:var(--sqc-font-family);white-space:nowrap;pointer-events:none;opacity:0;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:500;line-height:1.3;transition:opacity .12s .15s;position:absolute;top:calc(100% + 6px);right:0}.sqc-icon-btn[data-tip]:hover:after{opacity:1}.sqc-icon-btn[data-tip]:focus-visible:after{opacity:1}.sqc-history-pop{z-index:5;position:absolute;top:54px;left:0;right:0}.sqc-history{background:var(--sqc-bg);max-height:320px;box-shadow:var(--sqc-shadow-bottom);flex-direction:column;display:flex;overflow-y:auto}.sqc-history__empty{color:var(--sqc-text-muted);text-align:center;margin:0;padding:14px 16px;font-size:12px}.sqc-history__item{border:none;border-bottom:1px solid var(--sqc-border);width:100%;color:var(--sqc-text);text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 16px;transition:background .15s;display:flex}.sqc-history__item:last-child{border-bottom:none}.sqc-history__item:hover{background:var(--sqc-surface)}.sqc-history__item:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-history__item[aria-current=true]{background:var(--sqc-selected)}.sqc-history__item[aria-current=true] .sqc-history__title{color:var(--sqc-text);font-weight:600}.sqc-history__title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.sqc-history__date{color:var(--sqc-text-muted);font-size:11px}.sqc-context{background:var(--sqc-selected);border:1px solid var(--sqc-border);color:var(--sqc-text);border-radius:12px;flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;margin:12px 16px 4px;padding:8px 11px;font-size:12px;display:flex}.sqc-chip{text-overflow:ellipsis;white-space:nowrap;align-items:baseline;gap:4px;max-width:100%;display:inline-flex;overflow:hidden}.sqc-chip b{font-weight:600}.sqc-chip:not(:last-child):after{content:"·";opacity:.5;margin-left:4px}.sqc-messages{overscroll-behavior:contain;background:var(--sqc-bg);scrollbar-width:thin;scrollbar-color:var(--sqc-neutral-300) transparent;flex-direction:column;flex:1;gap:13px;min-height:0;padding:12px 16px;display:flex;overflow-y:auto}.sqc-messages::-webkit-scrollbar{width:6px}.sqc-messages::-webkit-scrollbar-thumb{background:var(--sqc-neutral-300);border-radius:99px}.sqc-msg{flex-direction:column;max-width:93%;font-size:13.5px;display:flex}.sqc-msg--assistant{align-self:flex-start}.sqc-msg--user{align-self:flex-end}.sqc-msg__who{color:var(--sqc-text-muted);align-items:center;gap:6px;margin-bottom:4px;font-size:11px;font-weight:500;display:flex}.sqc-msg__who svg{width:12px;height:12px;color:var(--sqc-accent-fg);flex-shrink:0}.sqc-avatar{background:var(--sqc-accent-color);color:var(--sqc-on-accent);-webkit-user-select:none;user-select:none;flex-shrink:0;justify-content:center;align-items:center;font-weight:600;line-height:1;display:inline-flex;overflow:hidden}.sqc-avatar img{object-fit:cover;width:100%;height:100%}.sqc-msg__unaddressed{color:var(--sqc-text-muted);margin:8px 0 0;font-size:11.5px;line-height:1.5}.sqc-msg__unaddressed code{background:var(--sqc-code-bg);color:var(--sqc-text);border-radius:4px;margin-right:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.sqc-msg--user .sqc-msg__bubble{background:var(--sqc-bubble-user);color:var(--sqc-bubble-user-text);border-radius:var(--sqc-radius) var(--sqc-radius) 4px var(--sqc-radius);padding:9px 13px}.sqc-msg--error .sqc-msg__bubble{background:var(--sqc-error-50);color:var(--sqc-error-600);border:1px solid var(--sqc-error-100);border-radius:12px;padding:11px}.sqc-msg__body{overflow-wrap:anywhere}.sqc-msg--assistant .sqc-msg__body{font-size:14px;line-height:1.6}.sqc-msg__body>:first-child{margin-top:0}.sqc-msg__body>:last-child{margin-bottom:0}.sqc-msg__body p{white-space:pre-wrap;margin:0 0 8px}.sqc-msg__body ul,.sqc-msg__body ol{margin:0 0 8px;padding-left:20px}.sqc-msg__body li{margin-bottom:3px}.sqc-msg__body code{background:var(--sqc-code-bg);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.85em}.sqc-msg--user .sqc-msg__body code{background:#ffffff38}.sqc-msg__body pre{background:var(--sqc-code-bg);border-radius:8px;margin:0 0 8px;padding:9px 11px;overflow-x:auto}.sqc-msg__body pre code{background:0 0;padding:0}.sqc-msg__body a{color:inherit;text-underline-offset:2px;text-decoration:underline}.sqc-msg--assistant .sqc-msg__body a{color:var(--sqc-link);text-decoration:none}.sqc-msg--assistant .sqc-msg__body a:hover{text-decoration:underline}.sqc-msg__body h3,.sqc-msg__body h4,.sqc-msg__body h5,.sqc-msg__body h6{font-family:var(--sqc-font-heading);letter-spacing:-.2px;margin:12px 0 6px;font-weight:700;line-height:1.3}.sqc-msg__body h3{font-size:1.05em}.sqc-msg__body h4{font-size:1em}.sqc-msg__body h5,.sqc-msg__body h6{font-size:.94em}.sqc-msg__body ul ul,.sqc-msg__body ul ol,.sqc-msg__body ol ul,.sqc-msg__body ol ol{margin:3px 0 0}.sqc-msg__body blockquote{border-left:2px solid var(--sqc-border-strong);color:var(--sqc-text-muted);white-space:pre-wrap;margin:0 0 8px;padding:2px 0 2px 10px}.sqc-msg--user .sqc-msg__body blockquote{color:inherit;opacity:.85;border-left-color:#ffffff73}.sqc-msg__body hr{border:0;border-top:1px solid var(--sqc-border);margin:10px 0}.sqc-msg--user .sqc-msg__body hr{border-top-color:#ffffff4d}.sqc-msg__body del{opacity:.7}.sqc-approval{flex-direction:column;gap:8px;margin:11px 0 2px;display:flex}.sqc-approval__actions{flex-wrap:wrap;gap:8px;display:flex}.sqc-approval__request{color:var(--sqc-text);margin:0;font-size:13px}.sqc-approval__args{border:1px solid var(--sqc-border);background:var(--sqc-surface);border-radius:12px;flex-direction:column;gap:4px;margin:0;padding:8px 10px;font-size:12px;display:flex}.sqc-approval__arg{gap:8px;display:flex}.sqc-approval__arg-name{color:var(--sqc-text-muted);flex:none;font-weight:500}.sqc-approval__arg-value{overflow-wrap:anywhere;min-width:0;color:var(--sqc-text);margin:0}.sqc-approval__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-approval__btn--yes:not(:disabled),.sqc-approval__btn--send:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-approval__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-approval__btn--yes:hover:not(:disabled),.sqc-approval__btn--send:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-approval__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-approval__btn:disabled{cursor:default}.sqc-approval__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-approval__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-approval__edit{flex-direction:column;gap:8px;display:flex}.sqc-approval__input{width:100%;font-family:var(--sqc-font-family);color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border-strong);resize:vertical;border-radius:12px;padding:8px 10px;font-size:13px;line-height:1.4}.sqc-approval__input:focus-visible{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input);outline:none}.sqc-approval__btn--send{flex:none;align-self:flex-end}.sqc-confirm{gap:8px;margin:11px 0 2px;display:flex}.sqc-confirm__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:1 1 0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-confirm__btn--yes:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-confirm__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-confirm__btn--yes:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-confirm__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-confirm__btn:disabled{cursor:default}.sqc-confirm__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-confirm__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-choices{flex-direction:column;gap:7px;margin:10px 0 2px;display:flex}.sqc-choice{width:100%;font-family:var(--sqc-font-family);text-align:left;color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border);cursor:pointer;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:border-color .12s,background .12s;display:flex}.sqc-choice:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-choice:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-choice:disabled{cursor:default}.sqc-choice:disabled[aria-pressed=false]{opacity:.55}.sqc-choice[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected)}.sqc-choice__box{border:1.5px solid var(--sqc-border-strong);border-radius:4px;flex:none;justify-content:center;align-items:center;width:15px;height:15px;display:inline-flex}.sqc-choice__box--on{color:var(--sqc-on-accent);background:var(--sqc-accent-color);border-color:var(--sqc-accent-color)}.sqc-choice__box svg{width:11px;height:11px}.sqc-choice__label{overflow-wrap:anywhere}.sqc-choice__detail{color:var(--sqc-text-muted);margin-top:1px;font-size:11.5px;display:block}.sqc-selection{flex-direction:column;gap:10px;margin:2px 0;display:flex}.sqc-selection__question{flex-direction:column;gap:2px;display:flex}.sqc-selection__ask{font-family:var(--sqc-font-family);color:var(--sqc-text);margin:0;font-size:13px;font-weight:600}.sqc-selection__actions{display:flex}.sqc-selection__validate{height:32px;font-family:var(--sqc-font-family);color:var(--sqc-on-accent);background:var(--sqc-accent-color);cursor:pointer;border:1px solid #0000;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:600;transition:filter .12s,background .12s;display:inline-flex}.sqc-selection__validate:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-selection__validate:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-selection__validate:disabled{cursor:not-allowed;color:#fff;background:var(--sqc-disabled)}.sqc-selection__hint{font-family:var(--sqc-font-family);color:var(--sqc-text-muted);margin:0;font-size:11.5px}.sqc-table{scrollbar-width:thin;margin:0 0 8px;overflow-x:auto}.sqc-table table{border-collapse:collapse;min-width:100%;font-family:var(--sqc-font-family);white-space:nowrap;font-size:12.5px}.sqc-table th,.sqc-table td{text-align:left;vertical-align:top;border-bottom:1px solid var(--sqc-border);padding:6px 10px 6px 0}.sqc-table thead th{text-transform:uppercase;letter-spacing:.05em;color:var(--sqc-text-muted);font-size:10.5px;font-weight:600}.sqc-table tbody th{font-weight:500}.sqc-msg--user .sqc-table th,.sqc-msg--user .sqc-table td{border-bottom-color:#ffffff40}.sqc-msg--user .sqc-table thead th{color:#fffc}.sqc-table tbody tr:last-child th,.sqc-table tbody tr:last-child td{border-bottom:0}.sqc-msg__time{color:var(--sqc-text-muted);font-variant-numeric:tabular-nums;margin-top:3px;font-size:10px;display:block}.sqc-msg--user .sqc-msg__time{color:#ffffffb3;text-align:right}.sqc-caret{vertical-align:text-bottom;background:currentColor;width:2px;height:1em;margin-left:2px;animation:1s step-end infinite sqc-blink;display:inline-block}@keyframes sqc-blink{0%,to{opacity:1}50%{opacity:0}}.sqc-typing{gap:3px;padding:2px 0;display:inline-flex}.sqc-typing i{background:var(--sqc-neutral-400);border-radius:50%;width:5px;height:5px;animation:1.2s infinite sqc-pulse}.sqc-typing i:nth-child(2){animation-delay:.2s}.sqc-typing i:nth-child(3){animation-delay:.4s}@keyframes sqc-pulse{0%,60%,to{opacity:.25}30%{opacity:1}}.sqc-suggestions{flex-direction:column;gap:7px;display:flex}.sqc-suggestion{border:1px solid var(--sqc-border);background:var(--sqc-bg);width:100%;color:var(--sqc-text);font-family:var(--sqc-font-family);cursor:pointer;text-align:left;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:background .15s,border-color .15s;display:flex}.sqc-suggestion:before{content:"";background:var(--sqc-accent-fg);border-radius:50%;flex:none;width:5px;height:5px}.sqc-suggestion:hover{background:var(--sqc-surface);border-color:var(--sqc-border-strong)}.sqc-suggestion:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-composer{border-top:1px solid var(--sqc-border);background:var(--sqc-bg);flex-wrap:wrap;flex-shrink:0;align-items:flex-end;gap:8px;padding:12px 14px;display:flex}.sqc-composer--dropping{outline:2px dashed var(--sqc-accent-color);outline-offset:-4px}.sqc-attachments{flex-wrap:wrap;flex-basis:100%;gap:6px;display:flex}.sqc-attachments--sent{margin-top:8px}.sqc-chip{border:1px solid var(--sqc-border);background:var(--sqc-selected);max-width:100%;color:var(--sqc-text);border-radius:999px;align-items:center;gap:4px;padding:3px 4px 3px 10px;font-size:12px;display:inline-flex}.sqc-chip--waiting{opacity:.6;padding-right:10px}.sqc-chip__name{text-overflow:ellipsis;white-space:nowrap;max-width:180px;overflow:hidden}.sqc-chip__remove{width:18px;height:18px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.sqc-chip__remove:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-attachments__error{color:var(--sqc-error-600);flex-basis:100%;margin:0;font-size:12px}.sqc-attachment__image{border-radius:12px;max-width:100%;max-height:180px;display:block}.sqc-file-input{display:none}.sqc-btn--attach{color:var(--sqc-text-muted);background:0 0}.sqc-btn--attach:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-composer__field{flex:1;min-width:0;position:relative}.sqc-composer__input{border:1px solid var(--sqc-border-strong);background:var(--sqc-bg);width:100%;min-height:38px;max-height:132px;color:var(--sqc-text);font-family:var(--sqc-font-family);resize:none;border-radius:12px;outline:none;padding:9px 12px;font-size:13.5px;line-height:1.4;transition:border-color .15s,box-shadow .15s;display:block;overflow-y:hidden}.sqc-composer__input::placeholder{color:var(--sqc-neutral-400)}.sqc-composer__input:focus{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input)}.sqc-mentions{z-index:2;border:1px solid var(--sqc-border);background:var(--sqc-bg);max-height:184px;box-shadow:var(--sqc-shadow);scrollbar-width:thin;border-radius:12px;margin:0;padding:4px;list-style:none;position:absolute;bottom:calc(100% + 6px);left:0;right:0;overflow-y:auto}.sqc-mention{cursor:pointer;color:var(--sqc-text);border-radius:8px;align-items:baseline;gap:6px;padding:6px 8px;font-size:12.5px;display:flex}.sqc-mention--active{background:var(--sqc-neutral-100)}.sqc-mention__icon{flex-shrink:0}.sqc-mention__handle{font-weight:600}.sqc-mention__name{text-overflow:ellipsis;white-space:nowrap;color:var(--sqc-text-muted);overflow:hidden}.sqc-composer__count{color:var(--sqc-text-muted);pointer-events:none;font-variant-numeric:tabular-nums;font-size:10px;position:absolute;bottom:4px;right:8px}.sqc-btn{cursor:pointer;border:none;border-radius:12px;flex-shrink:0;place-items:center;width:38px;height:38px;transition:background .15s,opacity .15s;display:grid}.sqc-btn svg{width:17px;height:17px}.sqc-btn--send{background:var(--sqc-accent-color);color:var(--sqc-on-accent)}.sqc-btn--send:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-btn--send:disabled{background:var(--sqc-disabled);color:#fff;cursor:not-allowed}.sqc-btn--stop{background:var(--sqc-bg);color:var(--sqc-text);border:1px solid var(--sqc-border)}.sqc-btn--stop:hover{border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-hint{padding:0 16px max(9px, env(safe-area-inset-bottom));color:var(--sqc-text-muted);text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered{padding:0 16px max(9px, env(safe-area-inset-bottom));text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered a{color:var(--sqc-text-muted);text-decoration:none}.sqc-powered a:hover{text-decoration:underline}@media (max-width:520px){.sqc{--sqc-width:100vw}.sqc-panel{border-left:none}.sqc-launcher{bottom:16px;right:16px}.sqc[data-position=bottom-left] .sqc-launcher{left:16px}.sqc[data-layout=floating] .sqc-panel,.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{border:none;border-radius:0;max-width:none;height:auto;max-height:none;top:0;bottom:0;left:0;right:0}}@media (prefers-reduced-motion:reduce){.sqc-launcher,.sqc-panel,.sqc-btn,.sqc-suggestion,.sqc-choice,.sqc-confirm__btn,.sqc-icon-btn,.sqc-icon-btn[data-tip]:after,.sqc-rail__item:before,.sqc-rail__item[data-tip]:after,.sqc-rail__item .sqc-avatar{transition:none}.sqc-typing i,.sqc-caret{animation:none}}.sqc-with-human{border:1px solid var(--sqc-border);background:var(--sqc-selected);color:var(--sqc-neutral-600);border-radius:12px;margin:8px 0 0;padding:8px 12px;font-size:13px}`;function An(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function jn(e,t){An(e,t),t.add(e)}function X(e,t,n){An(e,t),t.set(e,n)}function Z(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function Q(e,t,n){return e.set(Z(e,t),n),n}function $(e,t){return e.get(Z(e,t))}var Mn=`squadico-chatbot`,Nn=[`embed-key`,`context`,`user`,`agent`,`heading`,`subheading`,`assistant-name`,`placeholder`,`greeting`,`suggestions`,`width`,`accent`,`theme`,`position`,`layout`,`open`,`persist-open`,`show-context`,`locale`],Pn;function Fn(){if(Pn!==void 0)return Pn;try{let e=new CSSStyleSheet;e.replaceSync(kn),Pn=e}catch{Pn=null}return Pn}function In(e,t){typeof console<`u`&&console.warn(`[${Mn}] ${e}`,t??``)}function Ln(e){if(!(!e||!e.trim()))try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t;if(typeof e.id==`string`&&e.id)return{id:e.id,name:typeof e.name==`string`&&e.name?e.name:void 0,digest:typeof e.digest==`string`&&e.digest?e.digest:void 0}}In(`the "user" attribute needs an object with an id`,e)}catch(e){In(`the "user" attribute is not valid JSON`,e)}}function Rn(e){if(!(!e||!e.trim()))try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t;In("the `context` attribute must be a JSON object",e)}catch(e){In("the `context` attribute is not valid JSON",e)}}function zn(e){if(!(!e||!e.trim())){if(e.trim().startsWith(`[`))try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(String)}catch(e){In("the `suggestions` attribute is not valid JSON",e);return}return e.split(`|`).map(e=>e.trim()).filter(Boolean)}}function Bn(e){if(e!==null)return e!==`false`&&e!==`0`}function Vn(e){return e===`dark`||e===`light`||e===`auto`?e:void 0}function Hn(e){return e===`bottom-left`||e===`bottom-right`?e:void 0}function Un(e){return e===`floating`||e===`sidebar`?e:void 0}var Wn=[`context`,`embedKey`,`user`,`getSubjectToken`,`agent`];function Gn(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p;return t=new WeakMap,n=new WeakMap,r=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakSet,f=new WeakMap,p=new WeakMap,e=class extends HTMLElement{constructor(){super(),jn(this,d),X(this,t,void 0),X(this,n,null),X(this,r,!1),X(this,i,!1),X(this,a,``),X(this,o,void 0),X(this,s,void 0),X(this,c,void 0),X(this,l,void 0),X(this,u,void 0),X(this,f,e=>{let{type:t,...n}=e;Q(a,this,n.sessionId),this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}),X(this,p,e=>{Q(n,this,e),e&&Q(a,this,e.sessionId())});let e=this.attachShadow({mode:`open`}),m=Fn();if(m)e.adoptedStyleSheets=[m];else{let t=document.createElement(`style`);t.textContent=kn,e.append(t)}Q(t,this,document.createElement(`div`)),e.append($(t,this));for(let e of Wn){if(!Object.hasOwn(this,e))continue;let t=this[e];delete this[e],this[e]=t}}connectedCallback(){Q(i,this,!0),Z(d,this,h).call(this)}disconnectedCallback(){Q(i,this,!1),ae(null,$(t,this)),Q(n,this,null)}attributeChangedCallback(e,t,r){if(t!==r){if(e===`open`&&$(n,this)){Bn(r)?$(n,this).open():$(n,this).close();return}Z(d,this,m).call(this)}}get context(){return $(o,this)??Rn(this.getAttribute(`context`))}set context(e){Q(o,this,e),Z(d,this,m).call(this)}get embedKey(){return $(u,this)??this.getAttribute(`embed-key`)??void 0}set embedKey(e){Q(u,this,e),Z(d,this,m).call(this)}get user(){return $(s,this)??Ln(this.getAttribute(`user`))}set user(e){Q(s,this,e),Z(d,this,m).call(this)}get getSubjectToken(){return $(c,this)}set getSubjectToken(e){Q(c,this,e),Z(d,this,m).call(this)}get agent(){return $(l,this)??this.getAttribute(`agent`)??void 0}set agent(e){Q(l,this,e),Z(d,this,m).call(this)}get open(){return $(n,this)?.isOpen()??Bn(this.getAttribute(`open`))??!1}set open(e){e?this.openChat():this.closeChat()}get sessionId(){return $(n,this)?.sessionId()??$(a,this)}openChat(){$(n,this)?.open()}closeChat(){$(n,this)?.close()}toggleChat(){$(n,this)?.toggle()}reset(){$(n,this)?.reset()}sendMessage(e){if(!$(n,this)){In(`sendMessage() called before the component was mounted — ignored`);return}$(n,this).send(e)}},qe(e,`observedAttributes`,Nn),e;function m(){$(r,this)||!$(i,this)||(Q(r,this,!0),queueMicrotask(()=>{Q(r,this,!1),$(i,this)&&Z(d,this,h).call(this)}))}function h(){let e=e=>this.getAttribute(e)??void 0;ae(Y(On,{embedKey:this.embedKey,context:this.context,user:this.user,getSubjectToken:this.getSubjectToken,agent:this.agent,heading:e(`heading`),subheading:e(`subheading`),assistantName:e(`assistant-name`),placeholder:e(`placeholder`),greeting:e(`greeting`),suggestions:zn(this.getAttribute(`suggestions`)),width:e(`width`),accent:e(`accent`),theme:Vn(this.getAttribute(`theme`)),position:Hn(this.getAttribute(`position`)),layout:Un(this.getAttribute(`layout`)),defaultOpen:Bn(this.getAttribute(`open`))??!1,persistOpen:Bn(this.getAttribute(`persist-open`))??!0,showContext:Bn(this.getAttribute(`show-context`))??!0,locale:e(`locale`),onEvent:$(f,this),bind:$(p,this)}),$(t,this))}}var Kn;function qn(e=Mn){typeof window>`u`||typeof HTMLElement>`u`||(Kn??(Kn=Gn()),window.customElements.get(e)||window.customElements.define(e,Kn))}qn(),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return qn}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Mn}});
|
|
8
|
-
//# sourceMappingURL=src-DcJyi601.cjs.map
|