@sendbird/ai-agent-messenger-react 1.34.0 → 1.34.1
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/dist/cjs/ZOM6SoNd.cjs +1 -0
- package/dist/es/{tbfFzmFJ.js → ClcdzLx5.js} +75 -70
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +59 -59
- package/package.json +4 -4
- package/dist/cjs/BjKg30ip.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),E=require("styled-components"),w=require("@sendbird/react-uikit-message-template-view"),h=require("@sendbird/uikit-message-template"),n=require("../index.cjs"),M=e=>e&&e.__esModule?e:{default:e};function A(e){if(e&&e.__esModule)return e;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(s,r,t.get?t:{enumerable:!0,get:()=>e[r]})}}return s.default=e,Object.freeze(s)}const y=A(S),I=M(E),v={VARIABLE:e=>new RegExp(`\\{${e}\\}`,"g"),VIEW_VARIABLE:e=>new RegExp(`"{@${e}}"`,"g")};function g({uiTemplateString:e,variables:s={}}){const r=n.flattenObject(s);return n.replaceVariablesSync({template:e,variables:r,variableKeyPattern:t=>v.VARIABLE(t)})}function V({theme:e,uiTemplateString:s,colorVariables:r={}}){return n.replaceVariablesSync({template:s,variables:r,variableKeyPattern:t=>v.VARIABLE(t),variableValueTransformer:t=>n.pickColorByTheme(e,t)})}function O({theme:e,uiTemplateString:s,viewVariables:r={},aiAgentColorVariables:t,internalVariables:i,onRequestTemplate:l}){const u=Object.values(r).flat().map(o=>o.key);return[...new Set(u)].some(o=>!l(o))?null:n.replaceVariablesSync({template:s,variables:r,variableKeyPattern:o=>v.VIEW_VARIABLE(o),variableValueTransformer:o=>{const f=o.map(({key:m,variables:T})=>{const d=l(m),{ui_template:c,color_variables:_}=n.parseToMessageTemplate(d);let p=JSON.stringify(c);return p=g({uiTemplateString:p,variables:i}),p=V({theme:e,uiTemplateString:p,colorVariables:_}),p=V({theme:e,uiTemplateString:p,colorVariables:t}),p=g({uiTemplateString:p,variables:T}),n.parseToUITemplate(p)});return JSON.stringify(f)}})}async function R({theme:e,uiTemplateString:s,viewVariables:r={},aiAgentColorVariables:t,internalVariables:i,onRequestTemplate:l}){return n.replaceVariablesAsync({template:s,variables:r,variableKeyPattern:a=>v.VIEW_VARIABLE(a),variableValueTransformer:async a=>{const u=a.map(async({key:o,variables:f})=>{const m=await l(o),{ui_template:T,color_variables:d}=n.parseToMessageTemplate(m);let c=JSON.stringify(T);return c=g({uiTemplateString:c,variables:i}),c=V({theme:e,uiTemplateString:c,colorVariables:d}),c=V({theme:e,uiTemplateString:c,colorVariables:t}),c=g({uiTemplateString:c,variables:f}),n.parseToUITemplate(c)}),b=await Promise.all(u);return JSON.stringify(b)}})}const C=({rawTemplate:e,aiAgentColorVariables:s,internalVariables:r,...t})=>{const{ui_template:i,color_variables:l}=n.parseToMessageTemplate(e);let a=JSON.stringify(i);if(Object.keys(t.viewVariables??{}).length>0){const b=O({...t,uiTemplateString:a,aiAgentColorVariables:s,internalVariables:r});if(b===null)return null;a=b}return a=g({...t,uiTemplateString:a,variables:r}),a=V({...t,uiTemplateString:a,colorVariables:l}),a=V({...t,uiTemplateString:a,colorVariables:s}),a=g({...t,uiTemplateString:a}),n.parseToUITemplate(a)},j=async({rawTemplate:e,aiAgentColorVariables:s,internalVariables:r,...t})=>{const{ui_template:i,color_variables:l}=n.parseToMessageTemplate(e);let a=JSON.stringify(i);return Object.keys(t.viewVariables??{}).length>0&&(a=await R({...t,uiTemplateString:a,aiAgentColorVariables:s,internalVariables:r})),a=g({...t,uiTemplateString:a,variables:r}),a=V({...t,uiTemplateString:a,colorVariables:l}),a=V({...t,uiTemplateString:a,colorVariables:s}),a=g({...t,uiTemplateString:a}),n.parseToUITemplate(a)},q=e=>{const{aiAgentColorVariables:s={}}=e,{internalVariables:r}=n.useMessageTemplateFetchingContext();return S.useState(()=>{const t=e.onGetCachedTemplate(e.templateKey);return t?C({...e,rawTemplate:t,aiAgentColorVariables:s,internalVariables:r,onRequestTemplate:e.onGetCachedTemplate}):null})},N=e=>{const[s]=q(e);if(s)return s;const{aiAgentColorVariables:r={}}=e,{internalVariables:t,fetchTemplate:i,suspend:l}=n.useMessageTemplateFetchingContext();return l(e.templateKey,async()=>{const u=await i({...e,suspense:!0});return await j({...e,rawTemplate:u,aiAgentColorVariables:r,internalVariables:t})}).value},P=new Set(["default"]),{MessageTemplate:U}=h.createMessageTemplate({parser:w.parser,renderer:w.renderer,Container:e=>y.createElement("div",{...e})}),K=({extendedMessagePayload:e,onGetCachedMessageTemplate:s=()=>null,onRequestMessageTemplate:r,onHandleTemplateInternalAction:t=n.noop,onClickLink:i})=>{const l=e==null?void 0:e.message_template;if(!P.has((l==null?void 0:l.type)??"default"))throw new Error("Unsupported template type");if(!r)throw new Error("onRequestMessageTemplate is required");const u=l==null?void 0:l.key;if(!u)throw new Error("Template key is missing");const{theme:b}=n.useMessengerThemeContext(),o=N({onRequestTemplate:r,onGetCachedTemplate:s,theme:b.selectedTheme,templateKey:u,variables:l==null?void 0:l.variables,viewVariables:l==null?void 0:l.view_variables,aiAgentColorVariables:b.aiAgentColorVariables});let f;return i&&(f=(m,T)=>{m.preventDefault(),m.stopPropagation(),T.data&&i({url:T.data})}),y.createElement(k,{id:`${n.ID_INCOMING}-ext-message-template`},y.createElement(w.MessageProvider,{handleWebAction:f,handleInternalAction:(m,T)=>{m.stopPropagation(),t==null||t(T)}},y.createElement(U,{templateItems:o.body.items,templateVersion:o.version})))},k=I.default.div`box-sizing:border-box;overflow:hidden;width:100%;`;exports.MessageTemplateWrapper=K;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as f from "react";
|
|
2
2
|
import { useState as A } from "react";
|
|
3
3
|
import _ from "styled-components";
|
|
4
4
|
import { MessageProvider as I, renderer as R, parser as C } from "@sendbird/react-uikit-message-template-view";
|
|
5
5
|
import { createMessageTemplate as O } from "@sendbird/uikit-message-template";
|
|
6
|
-
import { r as M, f as K, a as S, p as N, b as
|
|
7
|
-
const
|
|
6
|
+
import { r as M, f as K, a as S, p as N, b as v, d as y, u as h, g as B, I as G, n as J } from "../index.js";
|
|
7
|
+
const w = {
|
|
8
8
|
VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
|
|
9
9
|
VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function T({ uiTemplateString: e, variables: l = {} }) {
|
|
12
12
|
const s = K(l);
|
|
13
13
|
return S({
|
|
14
14
|
template: e,
|
|
15
15
|
variables: s,
|
|
16
|
-
variableKeyPattern: (t) =>
|
|
16
|
+
variableKeyPattern: (t) => w.VARIABLE(t)
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function V({
|
|
20
20
|
theme: e,
|
|
21
21
|
uiTemplateString: l,
|
|
22
22
|
colorVariables: s = {}
|
|
@@ -24,121 +24,121 @@ function b({
|
|
|
24
24
|
return S({
|
|
25
25
|
template: l,
|
|
26
26
|
variables: s,
|
|
27
|
-
variableKeyPattern: (t) =>
|
|
27
|
+
variableKeyPattern: (t) => w.VARIABLE(t),
|
|
28
28
|
variableValueTransformer: (t) => N(e, t)
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function L({
|
|
32
32
|
theme: e,
|
|
33
33
|
uiTemplateString: l,
|
|
34
34
|
viewVariables: s = {},
|
|
35
35
|
aiAgentColorVariables: t,
|
|
36
|
-
internalVariables:
|
|
37
|
-
onRequestTemplate:
|
|
36
|
+
internalVariables: i,
|
|
37
|
+
onRequestTemplate: a
|
|
38
38
|
}) {
|
|
39
39
|
const c = Object.values(s).flat().map((n) => n.key);
|
|
40
|
-
return [...new Set(c)].some((n) => !
|
|
40
|
+
return [...new Set(c)].some((n) => !a(n)) ? null : S({
|
|
41
41
|
template: l,
|
|
42
42
|
variables: s,
|
|
43
|
-
variableKeyPattern: (n) =>
|
|
43
|
+
variableKeyPattern: (n) => w.VIEW_VARIABLE(n),
|
|
44
44
|
variableValueTransformer: (n) => {
|
|
45
|
-
const
|
|
46
|
-
const E =
|
|
45
|
+
const g = n.map(({ key: m, variables: b }) => {
|
|
46
|
+
const E = a(m), { ui_template: o, color_variables: d } = v(E);
|
|
47
47
|
let u = JSON.stringify(o);
|
|
48
|
-
return u =
|
|
48
|
+
return u = T({
|
|
49
49
|
uiTemplateString: u,
|
|
50
|
-
variables:
|
|
51
|
-
}), u =
|
|
50
|
+
variables: i
|
|
51
|
+
}), u = V({
|
|
52
52
|
theme: e,
|
|
53
53
|
uiTemplateString: u,
|
|
54
54
|
colorVariables: d
|
|
55
|
-
}), u =
|
|
55
|
+
}), u = V({
|
|
56
56
|
theme: e,
|
|
57
57
|
uiTemplateString: u,
|
|
58
58
|
colorVariables: t
|
|
59
|
-
}), u =
|
|
59
|
+
}), u = T({
|
|
60
60
|
uiTemplateString: u,
|
|
61
|
-
variables:
|
|
62
|
-
}),
|
|
61
|
+
variables: b
|
|
62
|
+
}), y(u);
|
|
63
63
|
});
|
|
64
|
-
return JSON.stringify(
|
|
64
|
+
return JSON.stringify(g);
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
68
|
+
async function P({
|
|
69
69
|
theme: e,
|
|
70
70
|
uiTemplateString: l,
|
|
71
71
|
viewVariables: s = {},
|
|
72
72
|
aiAgentColorVariables: t,
|
|
73
|
-
internalVariables:
|
|
74
|
-
onRequestTemplate:
|
|
73
|
+
internalVariables: i,
|
|
74
|
+
onRequestTemplate: a
|
|
75
75
|
}) {
|
|
76
76
|
return M({
|
|
77
77
|
template: l,
|
|
78
78
|
variables: s,
|
|
79
|
-
variableKeyPattern: (r) =>
|
|
79
|
+
variableKeyPattern: (r) => w.VIEW_VARIABLE(r),
|
|
80
80
|
variableValueTransformer: async (r) => {
|
|
81
|
-
const c = r.map(async ({ key: n, variables:
|
|
82
|
-
const
|
|
83
|
-
let o = JSON.stringify(
|
|
84
|
-
return o =
|
|
81
|
+
const c = r.map(async ({ key: n, variables: g }) => {
|
|
82
|
+
const m = await a(n), { ui_template: b, color_variables: E } = v(m);
|
|
83
|
+
let o = JSON.stringify(b);
|
|
84
|
+
return o = T({
|
|
85
85
|
uiTemplateString: o,
|
|
86
|
-
variables:
|
|
87
|
-
}), o =
|
|
86
|
+
variables: i
|
|
87
|
+
}), o = V({
|
|
88
88
|
theme: e,
|
|
89
89
|
uiTemplateString: o,
|
|
90
90
|
colorVariables: E
|
|
91
|
-
}), o =
|
|
91
|
+
}), o = V({
|
|
92
92
|
theme: e,
|
|
93
93
|
uiTemplateString: o,
|
|
94
94
|
colorVariables: t
|
|
95
|
-
}), o =
|
|
95
|
+
}), o = T({
|
|
96
96
|
uiTemplateString: o,
|
|
97
|
-
variables:
|
|
98
|
-
}),
|
|
99
|
-
}),
|
|
100
|
-
return JSON.stringify(
|
|
97
|
+
variables: g
|
|
98
|
+
}), y(o);
|
|
99
|
+
}), p = await Promise.all(c);
|
|
100
|
+
return JSON.stringify(p);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const U = ({
|
|
105
105
|
rawTemplate: e,
|
|
106
106
|
aiAgentColorVariables: l,
|
|
107
107
|
internalVariables: s,
|
|
108
108
|
...t
|
|
109
109
|
}) => {
|
|
110
|
-
const { ui_template:
|
|
111
|
-
let r = JSON.stringify(
|
|
110
|
+
const { ui_template: i, color_variables: a } = v(e);
|
|
111
|
+
let r = JSON.stringify(i);
|
|
112
112
|
if (Object.keys(t.viewVariables ?? {}).length > 0) {
|
|
113
|
-
const
|
|
113
|
+
const p = L({
|
|
114
114
|
...t,
|
|
115
115
|
uiTemplateString: r,
|
|
116
116
|
aiAgentColorVariables: l,
|
|
117
117
|
internalVariables: s
|
|
118
118
|
});
|
|
119
|
-
if (
|
|
120
|
-
r =
|
|
119
|
+
if (p === null) return null;
|
|
120
|
+
r = p;
|
|
121
121
|
}
|
|
122
|
-
return r =
|
|
123
|
-
},
|
|
122
|
+
return r = T({ ...t, uiTemplateString: r, variables: s }), r = V({ ...t, uiTemplateString: r, colorVariables: a }), r = V({ ...t, uiTemplateString: r, colorVariables: l }), r = T({ ...t, uiTemplateString: r }), y(r);
|
|
123
|
+
}, W = async ({
|
|
124
124
|
rawTemplate: e,
|
|
125
125
|
aiAgentColorVariables: l,
|
|
126
126
|
internalVariables: s,
|
|
127
127
|
...t
|
|
128
128
|
}) => {
|
|
129
|
-
const { ui_template:
|
|
130
|
-
let r = JSON.stringify(
|
|
131
|
-
return Object.keys(t.viewVariables ?? {}).length > 0 && (r = await
|
|
129
|
+
const { ui_template: i, color_variables: a } = v(e);
|
|
130
|
+
let r = JSON.stringify(i);
|
|
131
|
+
return Object.keys(t.viewVariables ?? {}).length > 0 && (r = await P({
|
|
132
132
|
...t,
|
|
133
133
|
uiTemplateString: r,
|
|
134
134
|
aiAgentColorVariables: l,
|
|
135
135
|
internalVariables: s
|
|
136
|
-
})), r =
|
|
136
|
+
})), r = T({ ...t, uiTemplateString: r, variables: s }), r = V({ ...t, uiTemplateString: r, colorVariables: a }), r = V({ ...t, uiTemplateString: r, colorVariables: l }), r = T({ ...t, uiTemplateString: r }), y(r);
|
|
137
137
|
}, j = (e) => {
|
|
138
138
|
const { aiAgentColorVariables: l = {} } = e, { internalVariables: s } = h();
|
|
139
139
|
return A(() => {
|
|
140
140
|
const t = e.onGetCachedTemplate(e.templateKey);
|
|
141
|
-
return t ?
|
|
141
|
+
return t ? U({
|
|
142
142
|
...e,
|
|
143
143
|
rawTemplate: t,
|
|
144
144
|
aiAgentColorVariables: l,
|
|
@@ -146,51 +146,56 @@ const P = ({
|
|
|
146
146
|
onRequestTemplate: e.onGetCachedTemplate
|
|
147
147
|
}) : null;
|
|
148
148
|
});
|
|
149
|
-
},
|
|
149
|
+
}, k = (e) => {
|
|
150
150
|
const [l] = j(e);
|
|
151
151
|
if (l) return l;
|
|
152
|
-
const { aiAgentColorVariables: s = {} } = e, { internalVariables: t, fetchTemplate:
|
|
153
|
-
return
|
|
154
|
-
const c = await
|
|
155
|
-
return await
|
|
152
|
+
const { aiAgentColorVariables: s = {} } = e, { internalVariables: t, fetchTemplate: i, suspend: a } = h();
|
|
153
|
+
return a(e.templateKey, async () => {
|
|
154
|
+
const c = await i({ ...e, suspense: !0 });
|
|
155
|
+
return await W({
|
|
156
156
|
...e,
|
|
157
157
|
rawTemplate: c,
|
|
158
158
|
aiAgentColorVariables: s,
|
|
159
159
|
internalVariables: t
|
|
160
160
|
});
|
|
161
161
|
}).value;
|
|
162
|
-
},
|
|
162
|
+
}, q = /* @__PURE__ */ new Set(["default"]), { MessageTemplate: x } = O({
|
|
163
163
|
parser: C,
|
|
164
164
|
renderer: R,
|
|
165
|
-
Container: (e) => /* @__PURE__ */
|
|
165
|
+
Container: (e) => /* @__PURE__ */ f.createElement("div", { ...e })
|
|
166
166
|
}), Y = ({
|
|
167
167
|
extendedMessagePayload: e,
|
|
168
168
|
onGetCachedMessageTemplate: l = () => null,
|
|
169
169
|
onRequestMessageTemplate: s,
|
|
170
|
-
onHandleTemplateInternalAction: t =
|
|
170
|
+
onHandleTemplateInternalAction: t = J,
|
|
171
|
+
onClickLink: i
|
|
171
172
|
}) => {
|
|
172
173
|
const a = e == null ? void 0 : e.message_template;
|
|
173
|
-
if (!
|
|
174
|
+
if (!q.has((a == null ? void 0 : a.type) ?? "default")) throw new Error("Unsupported template type");
|
|
174
175
|
if (!s) throw new Error("onRequestMessageTemplate is required");
|
|
175
|
-
const
|
|
176
|
-
if (!
|
|
177
|
-
const { theme:
|
|
176
|
+
const c = a == null ? void 0 : a.key;
|
|
177
|
+
if (!c) throw new Error("Template key is missing");
|
|
178
|
+
const { theme: p } = B(), n = k({
|
|
178
179
|
onRequestTemplate: s,
|
|
179
180
|
onGetCachedTemplate: l,
|
|
180
|
-
theme:
|
|
181
|
-
templateKey:
|
|
181
|
+
theme: p.selectedTheme,
|
|
182
|
+
templateKey: c,
|
|
182
183
|
variables: a == null ? void 0 : a.variables,
|
|
183
184
|
viewVariables: a == null ? void 0 : a.view_variables,
|
|
184
|
-
aiAgentColorVariables:
|
|
185
|
+
aiAgentColorVariables: p.aiAgentColorVariables
|
|
185
186
|
});
|
|
186
|
-
|
|
187
|
+
let g;
|
|
188
|
+
return i && (g = (m, b) => {
|
|
189
|
+
m.preventDefault(), m.stopPropagation(), b.data && i({ url: b.data });
|
|
190
|
+
}), /* @__PURE__ */ f.createElement($, { id: `${G}-ext-message-template` }, /* @__PURE__ */ f.createElement(
|
|
187
191
|
I,
|
|
188
192
|
{
|
|
189
|
-
|
|
190
|
-
|
|
193
|
+
handleWebAction: g,
|
|
194
|
+
handleInternalAction: (m, b) => {
|
|
195
|
+
m.stopPropagation(), t == null || t(b);
|
|
191
196
|
}
|
|
192
197
|
},
|
|
193
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ f.createElement(x, { templateItems: n.body.items, templateVersion: n.version })
|
|
194
199
|
));
|
|
195
200
|
}, $ = _.div`box-sizing:border-box;overflow:hidden;width:100%;`;
|
|
196
201
|
export {
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
`),r=[];let s=0;for(;s<n.length;){const o=n[s],i=Rm(o);if(!i){r.push(o),s+=1;continue}let c=-1;for(let u=s+1;u<n.length;u++)if(Mm(n[u],i)){c=u;break}if(c===-1){r.push(o),s+=1;continue}r.push(` ${t} `),s=c+1}return r.join(`
|
|
5
5
|
`)},Tn=(e,t)=>{let n=0,r=t-1;for(;r>=0&&e[r]==="\\";)n+=1,r-=1;return n%2===1},zm=e=>{const t=[];let n=0,r="";for(;n<e.length;){const s=e[n];if(s!=="`"||Tn(e,n)){r+=s,n+=1;continue}let o=n;for(;o<e.length&&e[o]==="`";)o+=1;const i=e.slice(n,o);let c=o,u=!1;for(;c<e.length&&e[c]!==`
|
|
6
6
|
`;){if(e[c]==="`"&&!Tn(e,c)&&e.startsWith(i,c)){const d=e.slice(o,c),m=t.push(d)-1;r+=Mi(m),n=c+i.length,u=!0;break}c+=1}u||(r+=i,n=o)}return{text:r,inlineCodes:t}},Oi=(e,{codeBlockPlaceholder:t=xm}={})=>{const n=e==null?void 0:e.replace(/\r\n?/g,`
|
|
7
|
-
`);if(!n)return;const r=[];let s=n;s=Gm(s,t),s=Um(s);const o=zm(s);s=o.text,r.push(...o.inlineCodes),s=Om(s),s=Nm(s),s=Dm(s),s=$m(s),s=Fm(s),s=Bm(s),s=Hm(s),s=Pm(s);for(let c=0;c<r.length;c++)s=s.replaceAll(Mi(c),r[c]);return Hr(s)||void 0},Vm=(e,t)=>{var s;const n=((s=e.name)==null?void 0:s.trim())||"",r=e.mimeType??"";return Ye(r)?t.image:zt(r)?t.video:Qo({name:n,mimeType:r})?t.pdf(n):t.document(n)},In=e=>(e==null?void 0:e.trim())||"",qm=e=>(e?Hr(e):void 0)||void 0,Ni=e=>({text:In(e),format:"plain"}),Km=e=>({text:In(e),format:"markdown"}),Qn=({markdownText:e,plainText:t,comparisonText:n})=>{const r=In(e);return r&&r!==In(n)?Km(r):Ni(t)},Dt=({sender:e,message:t,messageFormat:n="plain",time:r,codeBlockPlaceholder:s})=>{const o=[],i=n==="markdown"?Oi(t,{codeBlockPlaceholder:s}):qm(t);if(r&&o.push(r),e&&o.push(e),i&&o.push(i),o.length!==0)return o.join(", ")},Di=(e,t)=>Oi(e==null?void 0:e.trim(),t!==void 0?{codeBlockPlaceholder:t}:void 0),Ym=(...e)=>Hr(e.filter(Boolean).join(", "))||void 0,Ws=(e,t,n,r)=>{if(!t||t===n)return e;const s=Di(t,r);return s?Ym(e,s):e},Wm=(e,t)=>{var r,s,o,i;const n=(r=e.message)==null?void 0:r.trim();if(e.isFileMessage()){const c=((s=e.name)==null?void 0:s.trim())||"",u=Vm({name:c,mimeType:e.type},t);return Ws(u,n,c,t.codeBlockPlaceholder)}if(e.isMultipleFilesMessage()){const c=e.fileInfoList??[],u=c.length;if(u===0)return;const d=((i=(o=c[0])==null?void 0:o.fileName)==null?void 0:i.trim())||"",h=c.every(f=>{var g;return(g=f.mimeType)==null?void 0:g.startsWith("image")})?t.receivedFilesImageCount(u):t.multipleFilesCount(u);return Ws(h,n,d,t.codeBlockPlaceholder)}return Di(n,t.codeBlockPlaceholder)},jm=(e,t={})=>{const{throttleMs:n=1e3,isSuppressed:r,maxOrderedQueueSize:s=10}=t,o=Math.max(1,s);let i=null;const c=[];let u=null,d=null,m=null,h=!1,f=0;const g=(x,L,z)=>({text:x,ignoreSuppression:L,queueOrder:f++,dedupeKey:z}),_=()=>{const x=c[0]??null,L=i;return x&&L?L.queueOrder<x.queueOrder?(i=null,L):c.shift()??null:x?c.shift()??null:L!==null?(i=null,L):null},b=()=>{for(;;){const x=_();if(!x)return null;if(!(!x.ignoreSuppression&&(r!=null&&r())))return x}},v=x=>{u=x.text,d=x.dedupeKey??null,h=!0,e(x.text),m=setTimeout(()=>{m=null,h=!1;const L=b();L&&v(L)},n)},p=x=>{u=x.text,d=x.dedupeKey??null,e(x.text)},S=(x,L,z,D)=>L!=null&&D!=null?L===D:L==null&&D==null?x!=null&&x===z:!1,A=(x,L,z)=>{if(!x||!L&&(r!=null&&r()))return;const D=z==null?void 0:z.dedupeKey;if(!(h&&S(x,D,u,d)))if(h){if(((z==null?void 0:z.mode)??"latestOnly")==="ordered"){const K=c[c.length-1];if(K&&S(x,D,K.text,K.dedupeKey))return;c.push(g(x,L,D)),c.length>o&&c.shift();return}i=g(x,L,D)}else i=null,v(g(x,L,D))};return{announce:(x,L)=>{A(x,!1,L)},announceIgnoringSuppression:(x,L)=>{A(x,!0,L)},flush:()=>{const x=[];let L=_();for(;L!==null;)x.push(L),L=_();if(m!==null&&(clearTimeout(m),m=null),h=!1,x.length!==0)for(const z of x)p(z)},destroy:()=>{m!==null&&(clearTimeout(m),m=null),i=null,c.length=0,u=null,d=null,h=!1}}},Xm=e=>{switch(e){case"newMessage":case"conversationClosed":case"csatDisplayed":case"csatSubmitted":case"csatExpired":return"ordered";default:return"latestOnly"}},Zm=(e,t)=>e.screen==="conversationList"?typeof e.conversationCount=="number"?t.screenConversationListWithCount(e.conversationCount):t.screenConversationListNoCount:[e.agentName?t.screenConversationWithAgent(e.agentName):t.screenConversation,e.isClosed?t.conversationClosed:null,e.isClosed&&e.hasCSAT?t.csatDisplayed:null,e.isEmpty?t.emptyState:null].filter(r=>!!r).join(". "),Jm=(e,t)=>{switch(e.event){case"newMessage":return e.body!==void 0||e.time!==void 0?[t.newMessage(1),e.time,e.senderName,e.body].filter(r=>!!r).join(", "):e.senderName?t.newMessageFromSender(e.senderName,1):t.newMessage(1);case"typing":return t.typing(e.agentName??"");case"sendFailed":return t.sendFailed;case"agentConnected":return t.agentConnected(e.agentName??"");case"conversationClosed":return t.conversationClosed;case"csatDisplayed":return t.csatDisplayed;case"csatSubmitted":return e.submittedLabel;case"csatExpired":return t.csatExpired;case"emptyState":return t.emptyState;case"inputDisabled":return t.inputDisabled}},Qm=(e,t)=>{switch(e.type){case"fileSizeExceeded":return t.fileSizeExceeded(e.maxSizeMB??25);case"sendFailed":return t.sendFailed;case"csatFormError":return t.csatFormError;case"generic":return e.message}},eh=(e,t)=>!t||!Qe(e)||e.sender.userId!==t?null:e.reqId||(e.messageId>0?String(e.messageId):null),th=(e,t)=>Le.isAdmin(e)?Le.isCSAT(e):"sender"in e?e.sender.userId!==t:!1,nh=e=>"messageId"in e&&e.messageId>0?String(e.messageId):"reqId"in e&&typeof e.reqId=="string"&&e.reqId.length>0?e.reqId:null,rh=e=>e===le.CollectionEventSource.EVENT_MESSAGE_RECEIVED||e===le.CollectionEventSource.EVENT_MESSAGE_UPDATED,sh=({isOpened:e,opensConversationList:t})=>e?t?"closeConversationList":"closeConversation":t?"openConversationList":"openConversation",oh=(e,t)=>{switch(e){case"closeConversationList":return t.closeConversationList;case"closeConversation":return t.closeConversation;case"openConversationList":return t.openConversationList;case"openConversation":return t.openConversation}},ih=(e,t)=>{switch(e){case"closeConversation":return t.hintCloseConversation;case"openConversationList":return t.hintOpenConversationList;case"openConversation":return t.hintOpenConversation;default:return}},ah=({intent:e,strings:t})=>({label:oh(e,t),hint:ih(e,t)}),ch="1.34.0",Ge="sb-agent",ye={ENTRY:`${Ge}-entry`,MODAL_ROOT:`${Ge}-modal-root`,WINDOW:`${Ge}-window`,LAUNCHER:`${Ge}-launcher`,WINDOW_TITLE:`${Ge}-window-title`},$i="data-sb-initial-focus",Fi="true",lh=`[${$i}="${Fi}"]`,Pi={[$i]:Fi},Gr="data-sb-focus-trap-sentinel",uh="true",Ui="data-sb-initial-focus-header",Bi="true",dh=`[${Ui}="${Bi}"]`,Hi={[Ui]:Bi},Gi="data-sb-message-input",zi="true",mh=`textarea[${Gi}="${zi}"]:not(:disabled)`,hh={[Gi]:zi},Vi=1e3,ln=2147483647,gt={MODAL:ln-1,TOOLTIP:ln-2,WINDOW:ln-3,LAUNCHER:ln-4},qi=36,fh=100,gh=ch,zr="noopener noreferrer nofollow",hr=()=>typeof document>"u"||document.visibilityState==="visible",js=()=>typeof document<"u"&&document.visibilityState==="hidden",ph=e=>{if(hr()){e();return}if(typeof document>"u")return;const t=()=>{hr()&&(document.removeEventListener("visibilitychange",t),e())};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)};function _h(){return{isOnline:()=>navigator.onLine,subscribe:e=>{const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t),window.addEventListener("offline",n),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}const un={};function Eh(){return{get:e=>{try{return localStorage.getItem(e)}catch{return un[e]??null}},set:(e,t)=>{try{localStorage.setItem(e,t)}catch{un[e]=t}},delete:e=>{try{localStorage.removeItem(e)}catch{delete un[e]}},getKeys:e=>{try{const t=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r&&r.startsWith(e)&&t.push(r)}return t}catch{return Object.keys(un).filter(t=>t.startsWith(e))}}}}const Ch={conversation:{input_placeholder:"Ask a question",input_placeholder_disabled:"Chat is unavailable in this channel",input_placeholder_steward:"Processing your request...",input_placeholder_wait_ai_agent_response:"Waiting for the agent's reply...",input_placeholder_active_form:"Please fill out the form to move forward.",input_placeholder_reconnecting:"Trying to reconnect. Refresh if persists.",unknown_message_type:"(Unknown message type)",powered_by:"Powered by",citation_title:"Source",start_new_conversation_label:"Start a conversation",scroll_to_new_messages_label:()=>"New message",failed_message_resend:"Retry",failed_message_remove:"Remove",file_upload_no_supported_files:"No supported file types available.",file_upload_replace_alert_title:"Replace attachment?",file_upload_replace_alert_description:"Uploading a different file type will replace the current one.",a11y_message_list:"Chat messages",a11y_scroll_to_bottom:"Scroll to bottom",a11y_scroll_to_new_messages:"Scroll to new messages",a11y_open_conversation_list:"Open conversation list",a11y_open_conversation:"Open conversation with Support",a11y_open_conversations:"Open conversations",a11y_close_conversation:"Close conversation",a11y_close_conversations:"Close conversations",a11y_menu:"Menu",a11y_message_input:"Message",a11y_send_message:"Send message",a11y_attach_file:"Attach file",a11y_close_messenger:"Close messenger",a11y_expand_messenger:"Expand messenger",a11y_collapse_messenger:"Collapse messenger",a11y_connect_agent:"Talk to human agent",a11y_message_sender_you:"You",a11y_suggested_reply:"Suggested reply",a11y_typing_indicator:"Typing",a11y_code_block_placeholder:"Code block",a11y_typing_format:e=>`${e} is typing`,a11y_message_failed:"Message send failed",a11y_new_messages_received:e=>`${e} new ${e===1?"message":"messages"} received`,a11y_new_messages_received_from_sender:(e,t)=>`${e}: ${t} new ${t===1?"message":"messages"} received`,a11y_agent_connected:e=>"Connected to human agent",a11y_conversation_closed:"Conversation has ended",a11y_file_image:e=>`Image file: ${e}`,a11y_file_video:e=>`Video file: ${e}`,a11y_file_pdf:e=>`PDF file: ${e}`,a11y_file_document:e=>`Document file: ${e}`,a11y_received_file_image:"Image file",a11y_received_file_video:"Video file",a11y_received_file_pdf:e=>`PDF file: ${e}`,a11y_received_files_image_count:e=>`${e} ${e===1?"image":"images"}`,a11y_screen_conversation:"Conversation",a11y_screen_conversation_with_agent:e=>`Conversation with ${e}`,a11y_screen_conversation_list_no_count:"Conversation list",a11y_screen_conversation_list_with_count:e=>`Conversations, ${e} total`,a11y_csat_displayed:"Satisfaction survey displayed",a11y_empty_conversation:"No messages in this conversation",a11y_input_disabled:"Message input is disabled",a11y_file_size_exceeded:e=>`File exceeds size limit of ${e}MB`,a11y_csat_form_error:"Please complete the required fields",a11y_hint_send_message:"Sends the message",a11y_hint_open_conversation:"Opens the conversation",a11y_hint_open_conversations:"Opens conversations",a11y_hint_close_conversation:"Closes the conversation",a11y_hint_close_messenger:"Closes the messenger",a11y_hint_open_menu:"Opens the menu",a11y_hint_connect_to_agent:"Escalates to a human agent",a11y_hint_attach_file:"Opens file attachment options",a11y_hint_view_new_messages:"Scrolls to new messages",a11y_hint_open_file:"Opens the file",a11y_hint_open_image:"Opens the image",a11y_hint_send_reply:"Sends this reply",image_viewer_default_title:"Image",a11y_image_viewer_close:"Close image viewer",a11y_image_viewer_previous:"Previous image",a11y_image_viewer_next:"Next image",a11y_image_viewer_download:"Download image",attachment_document:"Files"},conversation_list:{header_title:"Conversations",ended:"Ended",system_message:"System message",footer_title:"Start a conversation",multiple_files_count:e=>`${e} ${e===1?"file":"files"}`,a11y_conversation_item:(e,t,n,r)=>`${e}, ${t}, ${n}${r>0?`, ${r} unread ${r===1?"message":"messages"}`:""}`},date_format:{just_now:"Just now",minutes_ago:e=>`${e} minutes ago`,hours_ago:e=>`${e} hours ago`,date_short:"MM/dd/yyyy",date_separator:"MMMM dd, yyyy",message_timestamp:"p"},csat:{title:"Your feedback matters to us",submitted_label:"Successfully submitted!",cre_question:"Was your issue resolved?",cre_positive_label:"Yes, thank you! 👍",cre_negative_label:"No, that didn't help.",reason_placeholder:"Share your feedback",question:"How would you rate your experience?",submit_label:"Submit",submission_expired:"We're sorry, the survey period has ended.",a11y_csat_rating_label:(e,t)=>`${e} out of 5 — ${t}`,a11y_hint_select_rating:"Selects this rating"},form:{optional_label:"optional",validation_required:"This question is required"},common:{placeholder_something_went_wrong:"Something went wrong",placeholder_no_messages:"No messages",placeholder_no_conversations:"No conversations yet",placeholder_something_went_wrong_retry_label:"Retry",button_ok:"OK",button_cancel:"Cancel"},feedback:{title:"Submit feedback",good:"Good",bad:"Bad",comment_label:"Comment (optional)",comment_placeholder:"Leave a comment",cancel:"Cancel",submit:"Submit",save:"Save",edit:"Edit feedback",remove:"Remove feedback"},handoff:{confirm_title:"Request handoff?",confirm_description:"You'll be transferred to a human agent. Your conversation history will be shared.",confirm_cancel:"Cancel",confirm_handoff:"Handoff"},memory:{dialog_title:"Memory",desc_on:"Memory is **turned on**. It remembers your conversation history to provide personalized responses tailored to your previous questions and preferences.",desc_off:"Memory is **turned off**. If turned on, it will remember your conversation history to provide personalized responses tailored to your previous questions and preferences.",button_use:"Use",button_dont_use:"Don't use",button_keep_using:"Keep using",button_disable:"Disable",button_disable_and_delete:"Disable & Delete memory",button_keep_off:"Keep off",button_enable:"Enable memory",button_cancel:"Cancel",error_message:"Failed to update memory state. Please try again.",a11y_indicator_manage:"Manage memory",a11y_indicator_on:"Memory is on",a11y_indicator_off:"Memory is off"},connection_delay:{title:"Something went wrong. You'll be reconnected shortly.",description:e=>`Estimated waiting time: ${e}`}},fr={language:"en",strings:Ch,dateLocale:lc.enUS},Ki=e=>({MESSAGE_INPUT__PLACE_HOLDER:e.conversation.input_placeholder,MESSAGE_INPUT__PLACE_HOLDER__DISABLED:e.conversation.input_placeholder_disabled,MESSAGE_INPUT__PLACE_HOLDER__STEWARD:e.conversation.input_placeholder_steward,MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE:e.conversation.input_placeholder_wait_ai_agent_response,MESSAGE_INPUT__PLACE_HOLDER__RECONNECTING:e.conversation.input_placeholder_reconnecting,UNKNOWN__UNKNOWN_MESSAGE_TYPE:e.conversation.unknown_message_type,POWERED_BY:e.conversation.powered_by,CSAT_TITLE_UNSUBMITTED:e.csat.title,CSAT_TITLE_SUBMITTED:e.csat.submitted_label,CSAT_CRE_TITLE:e.csat.cre_question,CSAT_CRE_SOLVED:e.csat.cre_positive_label,CSAT_CRE_NOT_SOLVED:e.csat.cre_negative_label,CSAT_REASON_PLACEHOLDER:e.csat.reason_placeholder,CSAT_RATING_TITLE:e.csat.question,CSAT_SUBMIT_LABEL:e.csat.submit_label,CSAT_SUBMISSION_EXPIRED:e.csat.submission_expired,DATE_FORMAT__JUST_NOW:e.date_format.just_now,DATE_FORMAT__MINUTES_AGO:e.date_format.minutes_ago,DATE_FORMAT__HOURS_AGO:e.date_format.hours_ago,DATE_FORMAT__DATE_SHORT:e.date_format.date_short,DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR:e.date_format.date_separator,DATE_FORMAT__MESSAGE_TIMESTAMP:e.date_format.message_timestamp,CONVERSATION_LIST__HEADER_TITLE:e.conversation_list.header_title,CONVERSATION_LIST__ENDED:e.conversation_list.ended,CONVERSATION_LIST__SYSTEM_MESSAGE:e.conversation_list.system_message,CONVERSATION_LIST__NO_CONVERSATIONS:e.common.placeholder_no_conversations,CONVERSATION_LIST__MULTIPLE_FILES_COUNT:e.conversation_list.multiple_files_count,TALK_TO_AGENT:e.conversation.start_new_conversation_label,CITATION_SOURCE_TITLE:e.conversation.citation_title,FORM_PLACEHOLDER:e.conversation.input_placeholder_active_form,FORM_VALIDATION_REQUIRED:e.form.validation_required,OPTIONAL:e.form.optional_label,PLACE_HOLDER__WRONG:e.common.placeholder_something_went_wrong,PLACE_HOLDER__NO_MESSAGES:e.common.placeholder_no_messages,RETRY:e.common.placeholder_something_went_wrong_retry_label,BUTTON__OK:e.common.button_ok,BUTTON__CANCEL:e.common.button_cancel,FAILED_MESSAGE_RESEND:e.conversation.failed_message_resend,FAILED_MESSAGE_REMOVE:e.conversation.failed_message_remove,FILE_UPLOAD_NO_SUPPORTED_FILES:e.conversation.file_upload_no_supported_files,FILE_UPLOAD_REPLACE_ALERT__TITLE:e.conversation.file_upload_replace_alert_title,FILE_UPLOAD_REPLACE_ALERT__DESCRIPTION:e.conversation.file_upload_replace_alert_description,FILE_UPLOAD_FILES:e.conversation.attachment_document,FEEDBACK_TITLE:e.feedback.title,FEEDBACK_GOOD:e.feedback.good,FEEDBACK_BAD:e.feedback.bad,FEEDBACK_COMMENT_LABEL:e.feedback.comment_label,FEEDBACK_COMMENT_PLACEHOLDER:e.feedback.comment_placeholder,FEEDBACK_CANCEL:e.feedback.cancel,FEEDBACK_SUBMIT:e.feedback.submit,FEEDBACK_SAVE:e.feedback.save,FEEDBACK_EDIT:e.feedback.edit,FEEDBACK_REMOVE:e.feedback.remove,A11Y_MESSAGE_LIST:e.conversation.a11y_message_list,A11Y_SCROLL_TO_BOTTOM:e.conversation.a11y_scroll_to_bottom,A11Y_SCROLL_TO_NEW_MESSAGES:e.conversation.a11y_scroll_to_new_messages,A11Y_OPEN_CONVERSATION_LIST:e.conversation.a11y_open_conversation_list,A11Y_OPEN_CONVERSATION:e.conversation.a11y_open_conversation,A11Y_OPEN_CONVERSATIONS:e.conversation.a11y_open_conversations,A11Y_CLOSE_CONVERSATION:e.conversation.a11y_close_conversation,A11Y_CLOSE_CONVERSATIONS:e.conversation.a11y_close_conversations,A11Y_MENU:e.conversation.a11y_menu,A11Y_MESSAGE_INPUT:e.conversation.a11y_message_input,A11Y_SEND_MESSAGE:e.conversation.a11y_send_message,A11Y_ATTACH_FILE:e.conversation.a11y_attach_file,A11Y_CONNECT_AGENT:e.conversation.a11y_connect_agent,A11Y_CLOSE_MESSENGER:e.conversation.a11y_close_messenger,A11Y_EXPAND_MESSENGER:e.conversation.a11y_expand_messenger,A11Y_COLLAPSE_MESSENGER:e.conversation.a11y_collapse_messenger,A11Y_MESSAGE_SENDER_YOU:e.conversation.a11y_message_sender_you,A11Y_SUGGESTED_REPLY:e.conversation.a11y_suggested_reply,A11Y_TYPING_INDICATOR:e.conversation.a11y_typing_indicator,A11Y_CODE_BLOCK_PLACEHOLDER:e.conversation.a11y_code_block_placeholder,A11Y_TYPING_FORMAT:e.conversation.a11y_typing_format,A11Y_MESSAGE_FAILED:e.conversation.a11y_message_failed,A11Y_NEW_MESSAGES_RECEIVED:e.conversation.a11y_new_messages_received,A11Y_NEW_MESSAGES_RECEIVED_FROM_SENDER:e.conversation.a11y_new_messages_received_from_sender,A11Y_AGENT_CONNECTED:e.conversation.a11y_agent_connected,A11Y_CONVERSATION_CLOSED:e.conversation.a11y_conversation_closed,A11Y_FILE_IMAGE:e.conversation.a11y_file_image,A11Y_FILE_VIDEO:e.conversation.a11y_file_video,A11Y_FILE_PDF:e.conversation.a11y_file_pdf,A11Y_FILE_DOCUMENT:e.conversation.a11y_file_document,A11Y_RECEIVED_FILE_IMAGE:e.conversation.a11y_received_file_image,A11Y_RECEIVED_FILE_VIDEO:e.conversation.a11y_received_file_video,A11Y_RECEIVED_FILE_PDF:e.conversation.a11y_received_file_pdf,A11Y_RECEIVED_FILES_IMAGE_COUNT:e.conversation.a11y_received_files_image_count,A11Y_SCREEN_CONVERSATION:e.conversation.a11y_screen_conversation,A11Y_SCREEN_CONVERSATION_WITH_AGENT:e.conversation.a11y_screen_conversation_with_agent,A11Y_SCREEN_CONVERSATION_LIST_NO_COUNT:e.conversation.a11y_screen_conversation_list_no_count,A11Y_SCREEN_CONVERSATION_LIST_WITH_COUNT:e.conversation.a11y_screen_conversation_list_with_count,A11Y_CSAT_DISPLAYED:e.conversation.a11y_csat_displayed,A11Y_EMPTY_CONVERSATION:e.conversation.a11y_empty_conversation,A11Y_INPUT_DISABLED:e.conversation.a11y_input_disabled,A11Y_FILE_SIZE_EXCEEDED:e.conversation.a11y_file_size_exceeded,A11Y_CSAT_FORM_ERROR:e.conversation.a11y_csat_form_error,A11Y_HINT_SEND_MESSAGE:e.conversation.a11y_hint_send_message,A11Y_HINT_OPEN_CONVERSATION:e.conversation.a11y_hint_open_conversation,A11Y_HINT_OPEN_CONVERSATIONS:e.conversation.a11y_hint_open_conversations,A11Y_HINT_CLOSE_CONVERSATION:e.conversation.a11y_hint_close_conversation,A11Y_HINT_OPEN_MENU:e.conversation.a11y_hint_open_menu,A11Y_HINT_CONNECT_TO_AGENT:e.conversation.a11y_hint_connect_to_agent,A11Y_HINT_ATTACH_FILE:e.conversation.a11y_hint_attach_file,A11Y_HINT_VIEW_NEW_MESSAGES:e.conversation.a11y_hint_view_new_messages,A11Y_HINT_OPEN_FILE:e.conversation.a11y_hint_open_file,A11Y_HINT_OPEN_IMAGE:e.conversation.a11y_hint_open_image,A11Y_HINT_SEND_REPLY:e.conversation.a11y_hint_send_reply,A11Y_CONVERSATION_ITEM:e.conversation_list.a11y_conversation_item,A11Y_CSAT_RATING_LABEL:e.csat.a11y_csat_rating_label,A11Y_HINT_SELECT_RATING:e.csat.a11y_hint_select_rating,IMAGE_VIEWER__DEFAULT_TITLE:e.conversation.image_viewer_default_title,A11Y_IMAGE_VIEWER_CLOSE:e.conversation.a11y_image_viewer_close,A11Y_IMAGE_VIEWER_PREVIOUS:e.conversation.a11y_image_viewer_previous,A11Y_IMAGE_VIEWER_NEXT:e.conversation.a11y_image_viewer_next,A11Y_IMAGE_VIEWER_DOWNLOAD:e.conversation.a11y_image_viewer_download,SCROLL_TO_NEW_MESSAGES_LABEL:e.conversation.scroll_to_new_messages_label,HANDOFF_CONFIRM__TITLE:e.handoff.confirm_title,HANDOFF_CONFIRM__DESCRIPTION:e.handoff.confirm_description,HANDOFF_CONFIRM__CANCEL:e.handoff.confirm_cancel,HANDOFF_CONFIRM__HANDOFF:e.handoff.confirm_handoff,MEMORY__DIALOG_TITLE:e.memory.dialog_title,MEMORY__DESC_ON:e.memory.desc_on,MEMORY__DESC_OFF:e.memory.desc_off,MEMORY__BUTTON_USE:e.memory.button_use,MEMORY__BUTTON_DONT_USE:e.memory.button_dont_use,MEMORY__BUTTON_KEEP_USING:e.memory.button_keep_using,MEMORY__BUTTON_DISABLE:e.memory.button_disable,MEMORY__BUTTON_DISABLE_AND_DELETE:e.memory.button_disable_and_delete,MEMORY__BUTTON_KEEP_OFF:e.memory.button_keep_off,MEMORY__BUTTON_ENABLE:e.memory.button_enable,MEMORY__BUTTON_CANCEL:e.memory.button_cancel,MEMORY__ERROR_MESSAGE:e.memory.error_message,A11Y_MEMORY_INDICATOR_MANAGE:e.memory.a11y_indicator_manage,A11Y_MEMORY_INDICATOR_ON:e.memory.a11y_indicator_on,A11Y_MEMORY_INDICATOR_OFF:e.memory.a11y_indicator_off,CONNECTION_DELAY__TITLE:e.connection_delay.title,CONNECTION_DELAY__DESCRIPTION:e.connection_delay.description}),Yi=e=>{var t;return((t=e.split("-"))==null?void 0:t[0])??Zt},Zt="en",Wi=new Set([Zt,"ko","es","pt","fr","hi","it","de","tr","ja"]),bh='@import"https://fonts.googleapis.com/css?family=Roboto:400,500,600,700&display=swap";.sb-message-template__border{position:relative}.sb-message-template__border:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;box-shadow:inset 0 0 0 var(--border-width) var(--border-color);border-radius:var(--border-radius);pointer-events:none}.sb-message-template__action{cursor:pointer}.sb-message-template__parent{font-family:Roboto,serif}.sb-message-template__text{font-family:inherit;font-size:14px;font-weight:400;font-stretch:normal;font-style:normal;letter-spacing:normal;text-align:left}.sb-message-template__text-button{font-family:inherit;background-color:#e0e0e0;text-align:center;padding:10px;border-radius:6px;font-size:14px;font-weight:600;font-stretch:normal;font-style:normal;letter-spacing:normal}.sendbird-theme--light .sb-message-template__text-button{color:#742ddd}.sendbird-theme--dark .sb-message-template__text-button{color:#c2a9fa}.sb-message-template__text-button:hover{opacity:1;box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px}.sb-message-template__text-button,.sb-message-template__image-button{cursor:pointer;border-style:none}.sb-message-template__parent{border-radius:unset;background-color:transparent;overflow:hidden}.sb-message-template__parent *{box-sizing:border-box;line-height:1.3}.sb-message-template__carousel{display:flex;width:100%;box-sizing:border-box;touch-action:pan-y}',{Provider:vh,useContext:Vr}=be("AgentUIElementResolver"),yh=({entryElement:e,modalRootElement:t,rootElement:n,children:r})=>{const s=l.useMemo(()=>{const o=n??document.body,i=e??o,c=t??o,u=d=>d===ye.MODAL_ROOT?c:i.querySelector(`#${d}`);return{resolveElement:u,resolvePortalContainer:d=>u(d)??c}},[e,t,n]);return a.createElement(vh,{value:s},r)};function ut(e,t){const n=e.getRootNode({composed:t});return n instanceof ShadowRoot||n instanceof Document?n:document}const Xs=()=>{const e=[];let t=0;const n=new Set,r=()=>n.forEach(s=>s());return{register:s=>{const o=++t;return e.push({id:o,handler:s}),r(),()=>{const i=e.findIndex(c=>c.id===o);i>=0&&(e.splice(i,1),r())}},dismissTopmost:()=>{const s=e[e.length-1];return s?(s.handler(),!0):!1},subscribe:s=>(n.add(s),()=>{n.delete(s)}),getOpenCount:()=>e.length}},{Provider:Sh,useContext:qr}=be("EscapeDismissStack"),Zs=e=>{e.stopPropagation(),e.stopImmediatePropagation()},Ah=({rootElement:e=document.body,boundaryElement:t,children:n})=>{const r=l.useRef(null),s=l.useRef(null);r.current||(r.current=Xs()),s.current||(s.current=Xs());const o=r.current,i=s.current;l.useLayoutEffect(()=>{const u=t??ut(e),d=m=>{if(m.key==="Escape"){if(o.dismissTopmost()){Zs(m);return}i.dismissTopmost()&&Zs(m)}};return u.addEventListener("keydown",d),()=>u.removeEventListener("keydown",d)},[t,e,i,o]);const c=l.useMemo(()=>({register:o.register,dismissTopmost:o.dismissTopmost,registerShellDismissHandler:i.register,subscribe:o.subscribe,getOpenCount:o.getOpenCount}),[i,o]);return a.createElement(Sh,{value:c},n)},ji=(e,t,n)=>{const r=l.useRef(t);l.useLayoutEffect(()=>{r.current=t},[t]),l.useLayoutEffect(()=>{if(e)return n(()=>r.current())},[e,n])},Th=(e,t)=>{const{register:n}=qr();ji(e,t,n)},Ih=(e,t)=>{const{registerShellDismissHandler:n}=qr();ji(e,t,n)},Xi=()=>{const{subscribe:e,getOpenCount:t}=qr();return l.useSyncExternalStore(e,()=>t()>0,()=>!1)},xh=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((s,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},Js=Ki(fr.strings),Rh={...Js,HEADER_BUTTON__AGENT_HANDOFF:"Talk to human agent",MESSAGE_INPUT__PLACE_HOLDER__SUGGESTED_REPLIES:"Select an option to continue",BUTTON__SUBMIT:"Submit",SUBMITTED:"Submitted",TRY_AGAIN:"Please try again.",FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT:"Up to %d files can be attached.",FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT:"The maximum size per file is %d MB.",FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION:"%d files were excluded due to limits. Please select files individually.",FILE_UPLOAD_PHOTOS:"Photos",FILE_VIEWER__UNSUPPORT:"Unsupported message",A11Y_FILE_SELECTED:e=>`${e}, selected`,A11Y_FILE_REMOVE_BUTTON:e=>`Remove file: ${e}`,A11Y_FILE_UPLOAD_OPTIONS:"File upload options",A11Y_FAILED_MESSAGE_OPTIONS:"Failed message options",A11Y_FEEDBACK_OPTIONS:"Feedback options",A11Y_CSAT_TEXT_INPUT_LABEL:"Enter answer",FORM_UNAVAILABLE:"Form is no longer available.",FORM_NOT_SUPPORTED:"This form is not supported in the current version.",FORM_VALIDATION_MIN_LENGTH:e=>`Minimum ${e} characters required`,FORM_VALIDATION_MAX_LENGTH:e=>`Maximum ${e} characters allowed`,FORM_VALIDATION_MIN:e=>`Minimum value is ${e}`,FORM_VALIDATION_MAX:e=>`Maximum value is ${e}`,FORM_VALIDATION_MIN_SELECT:e=>`Select at least ${e} options`,FORM_VALIDATION_MAX_SELECT:e=>`Select at most ${e} options`,FORM_VALIDATION_REGEX_FAILED:"Invalid format",DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE:Js.DATE_FORMAT__DATE_SHORT,DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION:"h:mma",CONVERSATION_LIST__TOPICS_FALLBACK:"No category",CONVERSATION_CLOSED_FOOTER_LABEL:"Your conversation has ended",START_NEW_CONVERSATION:"💬 Start a new conversation",RETURN_TO_CONVERSATION:"💬 Return to conversation",BUTTON__SAVE:"Save",NO_NAME:"(No name)",CHANNEL_FROZEN:"Channel frozen"},xn={language:fr.language,dateLocale:fr.dateLocale,stringSet:Rh},Mh=Object.freeze(Object.defineProperty({__proto__:null,default:xn},Symbol.toStringTag,{value:"Module"})),gr=new Map([[Zt,xn]]);async function wh(e){const t=gr.get(e);if(t)return t;try{if(Wi.has(e)){const{default:n}=await xh(Object.assign({"./languages/de.ts":()=>Promise.resolve().then(()=>require("./cjs/I-l-5Zo-.cjs")),"./languages/en.ts":()=>Promise.resolve().then(()=>Mh),"./languages/es.ts":()=>Promise.resolve().then(()=>require("./cjs/D_km8dcd.cjs")),"./languages/fr.ts":()=>Promise.resolve().then(()=>require("./cjs/CLIpC7kY.cjs")),"./languages/hi.ts":()=>Promise.resolve().then(()=>require("./cjs/ChrM6HN1.cjs")),"./languages/it.ts":()=>Promise.resolve().then(()=>require("./cjs/CPZf2TWM.cjs")),"./languages/ja.ts":()=>Promise.resolve().then(()=>require("./cjs/D7UQ9OK7.cjs")),"./languages/ko.ts":()=>Promise.resolve().then(()=>require("./cjs/BMDJStMQ.cjs")),"./languages/pt.ts":()=>Promise.resolve().then(()=>require("./cjs/etCQgYrr.cjs")),"./languages/tr.ts":()=>Promise.resolve().then(()=>require("./cjs/DKQwAy8C.cjs"))}),`./languages/${e}.ts`,3);return gr.set(e,n),n}return xn}catch{return xn}}const{Provider:kh,useContext:oe}=be("Localization"),Lh=({language:e=navigator.language,languageCode:t,logger:n,stringSet:r,children:s})=>{const[o,i]=l.useState(gr.get(Zt));return l.useEffect(()=>{const c=t??Yi(e);o.language!==c&&(n==null||n.debug("localization.useEffect: update language",{from:o.language,to:c}),wh(c).then(i))},[e,t,n]),a.createElement(kh,{value:{language:o.language,defaultStringSet:o.stringSet,stringSet:{...o.stringSet,...r},dateLocale:o.dateLocale,format:(c,u,d)=>at.format(c,u,{locale:o.dateLocale,...d})}},s)},Rn="data-sb-agent-theme",Qs=e=>(t,...n)=>{let r="";return t.forEach((s,o)=>{r+=s+(n[o]??"")}),`[${Rn}='${e}'] & { ${r} }`},Q={light:Qs("light"),dark:Qs("dark")},Oh=U.css(({theme:e})=>{const{palette:t}=e;return`
|
|
7
|
+
`);if(!n)return;const r=[];let s=n;s=Gm(s,t),s=Um(s);const o=zm(s);s=o.text,r.push(...o.inlineCodes),s=Om(s),s=Nm(s),s=Dm(s),s=$m(s),s=Fm(s),s=Bm(s),s=Hm(s),s=Pm(s);for(let c=0;c<r.length;c++)s=s.replaceAll(Mi(c),r[c]);return Hr(s)||void 0},Vm=(e,t)=>{var s;const n=((s=e.name)==null?void 0:s.trim())||"",r=e.mimeType??"";return Ye(r)?t.image:zt(r)?t.video:Qo({name:n,mimeType:r})?t.pdf(n):t.document(n)},In=e=>(e==null?void 0:e.trim())||"",qm=e=>(e?Hr(e):void 0)||void 0,Ni=e=>({text:In(e),format:"plain"}),Km=e=>({text:In(e),format:"markdown"}),Qn=({markdownText:e,plainText:t,comparisonText:n})=>{const r=In(e);return r&&r!==In(n)?Km(r):Ni(t)},Dt=({sender:e,message:t,messageFormat:n="plain",time:r,codeBlockPlaceholder:s})=>{const o=[],i=n==="markdown"?Oi(t,{codeBlockPlaceholder:s}):qm(t);if(r&&o.push(r),e&&o.push(e),i&&o.push(i),o.length!==0)return o.join(", ")},Di=(e,t)=>Oi(e==null?void 0:e.trim(),t!==void 0?{codeBlockPlaceholder:t}:void 0),Ym=(...e)=>Hr(e.filter(Boolean).join(", "))||void 0,Ws=(e,t,n,r)=>{if(!t||t===n)return e;const s=Di(t,r);return s?Ym(e,s):e},Wm=(e,t)=>{var r,s,o,i;const n=(r=e.message)==null?void 0:r.trim();if(e.isFileMessage()){const c=((s=e.name)==null?void 0:s.trim())||"",u=Vm({name:c,mimeType:e.type},t);return Ws(u,n,c,t.codeBlockPlaceholder)}if(e.isMultipleFilesMessage()){const c=e.fileInfoList??[],u=c.length;if(u===0)return;const d=((i=(o=c[0])==null?void 0:o.fileName)==null?void 0:i.trim())||"",h=c.every(f=>{var g;return(g=f.mimeType)==null?void 0:g.startsWith("image")})?t.receivedFilesImageCount(u):t.multipleFilesCount(u);return Ws(h,n,d,t.codeBlockPlaceholder)}return Di(n,t.codeBlockPlaceholder)},jm=(e,t={})=>{const{throttleMs:n=1e3,isSuppressed:r,maxOrderedQueueSize:s=10}=t,o=Math.max(1,s);let i=null;const c=[];let u=null,d=null,m=null,h=!1,f=0;const g=(x,L,z)=>({text:x,ignoreSuppression:L,queueOrder:f++,dedupeKey:z}),_=()=>{const x=c[0]??null,L=i;return x&&L?L.queueOrder<x.queueOrder?(i=null,L):c.shift()??null:x?c.shift()??null:L!==null?(i=null,L):null},b=()=>{for(;;){const x=_();if(!x)return null;if(!(!x.ignoreSuppression&&(r!=null&&r())))return x}},v=x=>{u=x.text,d=x.dedupeKey??null,h=!0,e(x.text),m=setTimeout(()=>{m=null,h=!1;const L=b();L&&v(L)},n)},p=x=>{u=x.text,d=x.dedupeKey??null,e(x.text)},S=(x,L,z,D)=>L!=null&&D!=null?L===D:L==null&&D==null?x!=null&&x===z:!1,A=(x,L,z)=>{if(!x||!L&&(r!=null&&r()))return;const D=z==null?void 0:z.dedupeKey;if(!(h&&S(x,D,u,d)))if(h){if(((z==null?void 0:z.mode)??"latestOnly")==="ordered"){const K=c[c.length-1];if(K&&S(x,D,K.text,K.dedupeKey))return;c.push(g(x,L,D)),c.length>o&&c.shift();return}i=g(x,L,D)}else i=null,v(g(x,L,D))};return{announce:(x,L)=>{A(x,!1,L)},announceIgnoringSuppression:(x,L)=>{A(x,!0,L)},flush:()=>{const x=[];let L=_();for(;L!==null;)x.push(L),L=_();if(m!==null&&(clearTimeout(m),m=null),h=!1,x.length!==0)for(const z of x)p(z)},destroy:()=>{m!==null&&(clearTimeout(m),m=null),i=null,c.length=0,u=null,d=null,h=!1}}},Xm=e=>{switch(e){case"newMessage":case"conversationClosed":case"csatDisplayed":case"csatSubmitted":case"csatExpired":return"ordered";default:return"latestOnly"}},Zm=(e,t)=>e.screen==="conversationList"?typeof e.conversationCount=="number"?t.screenConversationListWithCount(e.conversationCount):t.screenConversationListNoCount:[e.agentName?t.screenConversationWithAgent(e.agentName):t.screenConversation,e.isClosed?t.conversationClosed:null,e.isClosed&&e.hasCSAT?t.csatDisplayed:null,e.isEmpty?t.emptyState:null].filter(r=>!!r).join(". "),Jm=(e,t)=>{switch(e.event){case"newMessage":return e.body!==void 0||e.time!==void 0?[t.newMessage(1),e.time,e.senderName,e.body].filter(r=>!!r).join(", "):e.senderName?t.newMessageFromSender(e.senderName,1):t.newMessage(1);case"typing":return t.typing(e.agentName??"");case"sendFailed":return t.sendFailed;case"agentConnected":return t.agentConnected(e.agentName??"");case"conversationClosed":return t.conversationClosed;case"csatDisplayed":return t.csatDisplayed;case"csatSubmitted":return e.submittedLabel;case"csatExpired":return t.csatExpired;case"emptyState":return t.emptyState;case"inputDisabled":return t.inputDisabled}},Qm=(e,t)=>{switch(e.type){case"fileSizeExceeded":return t.fileSizeExceeded(e.maxSizeMB??25);case"sendFailed":return t.sendFailed;case"csatFormError":return t.csatFormError;case"generic":return e.message}},eh=(e,t)=>!t||!Qe(e)||e.sender.userId!==t?null:e.reqId||(e.messageId>0?String(e.messageId):null),th=(e,t)=>Le.isAdmin(e)?Le.isCSAT(e):"sender"in e?e.sender.userId!==t:!1,nh=e=>"messageId"in e&&e.messageId>0?String(e.messageId):"reqId"in e&&typeof e.reqId=="string"&&e.reqId.length>0?e.reqId:null,rh=e=>e===le.CollectionEventSource.EVENT_MESSAGE_RECEIVED||e===le.CollectionEventSource.EVENT_MESSAGE_UPDATED,sh=({isOpened:e,opensConversationList:t})=>e?t?"closeConversationList":"closeConversation":t?"openConversationList":"openConversation",oh=(e,t)=>{switch(e){case"closeConversationList":return t.closeConversationList;case"closeConversation":return t.closeConversation;case"openConversationList":return t.openConversationList;case"openConversation":return t.openConversation}},ih=(e,t)=>{switch(e){case"closeConversation":return t.hintCloseConversation;case"openConversationList":return t.hintOpenConversationList;case"openConversation":return t.hintOpenConversation;default:return}},ah=({intent:e,strings:t})=>({label:oh(e,t),hint:ih(e,t)}),ch="1.34.1",Ge="sb-agent",ye={ENTRY:`${Ge}-entry`,MODAL_ROOT:`${Ge}-modal-root`,WINDOW:`${Ge}-window`,LAUNCHER:`${Ge}-launcher`,WINDOW_TITLE:`${Ge}-window-title`},$i="data-sb-initial-focus",Fi="true",lh=`[${$i}="${Fi}"]`,Pi={[$i]:Fi},Gr="data-sb-focus-trap-sentinel",uh="true",Ui="data-sb-initial-focus-header",Bi="true",dh=`[${Ui}="${Bi}"]`,Hi={[Ui]:Bi},Gi="data-sb-message-input",zi="true",mh=`textarea[${Gi}="${zi}"]:not(:disabled)`,hh={[Gi]:zi},Vi=1e3,ln=2147483647,gt={MODAL:ln-1,TOOLTIP:ln-2,WINDOW:ln-3,LAUNCHER:ln-4},qi=36,fh=100,gh=ch,zr="noopener noreferrer nofollow",hr=()=>typeof document>"u"||document.visibilityState==="visible",js=()=>typeof document<"u"&&document.visibilityState==="hidden",ph=e=>{if(hr()){e();return}if(typeof document>"u")return;const t=()=>{hr()&&(document.removeEventListener("visibilitychange",t),e())};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)};function _h(){return{isOnline:()=>navigator.onLine,subscribe:e=>{const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t),window.addEventListener("offline",n),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}const un={};function Eh(){return{get:e=>{try{return localStorage.getItem(e)}catch{return un[e]??null}},set:(e,t)=>{try{localStorage.setItem(e,t)}catch{un[e]=t}},delete:e=>{try{localStorage.removeItem(e)}catch{delete un[e]}},getKeys:e=>{try{const t=[];for(let n=0;n<localStorage.length;n++){const r=localStorage.key(n);r&&r.startsWith(e)&&t.push(r)}return t}catch{return Object.keys(un).filter(t=>t.startsWith(e))}}}}const Ch={conversation:{input_placeholder:"Ask a question",input_placeholder_disabled:"Chat is unavailable in this channel",input_placeholder_steward:"Processing your request...",input_placeholder_wait_ai_agent_response:"Waiting for the agent's reply...",input_placeholder_active_form:"Please fill out the form to move forward.",input_placeholder_reconnecting:"Trying to reconnect. Refresh if persists.",unknown_message_type:"(Unknown message type)",powered_by:"Powered by",citation_title:"Source",start_new_conversation_label:"Start a conversation",scroll_to_new_messages_label:()=>"New message",failed_message_resend:"Retry",failed_message_remove:"Remove",file_upload_no_supported_files:"No supported file types available.",file_upload_replace_alert_title:"Replace attachment?",file_upload_replace_alert_description:"Uploading a different file type will replace the current one.",a11y_message_list:"Chat messages",a11y_scroll_to_bottom:"Scroll to bottom",a11y_scroll_to_new_messages:"Scroll to new messages",a11y_open_conversation_list:"Open conversation list",a11y_open_conversation:"Open conversation with Support",a11y_open_conversations:"Open conversations",a11y_close_conversation:"Close conversation",a11y_close_conversations:"Close conversations",a11y_menu:"Menu",a11y_message_input:"Message",a11y_send_message:"Send message",a11y_attach_file:"Attach file",a11y_close_messenger:"Close messenger",a11y_expand_messenger:"Expand messenger",a11y_collapse_messenger:"Collapse messenger",a11y_connect_agent:"Talk to human agent",a11y_message_sender_you:"You",a11y_suggested_reply:"Suggested reply",a11y_typing_indicator:"Typing",a11y_code_block_placeholder:"Code block",a11y_typing_format:e=>`${e} is typing`,a11y_message_failed:"Message send failed",a11y_new_messages_received:e=>`${e} new ${e===1?"message":"messages"} received`,a11y_new_messages_received_from_sender:(e,t)=>`${e}: ${t} new ${t===1?"message":"messages"} received`,a11y_agent_connected:e=>"Connected to human agent",a11y_conversation_closed:"Conversation has ended",a11y_file_image:e=>`Image file: ${e}`,a11y_file_video:e=>`Video file: ${e}`,a11y_file_pdf:e=>`PDF file: ${e}`,a11y_file_document:e=>`Document file: ${e}`,a11y_received_file_image:"Image file",a11y_received_file_video:"Video file",a11y_received_file_pdf:e=>`PDF file: ${e}`,a11y_received_files_image_count:e=>`${e} ${e===1?"image":"images"}`,a11y_screen_conversation:"Conversation",a11y_screen_conversation_with_agent:e=>`Conversation with ${e}`,a11y_screen_conversation_list_no_count:"Conversation list",a11y_screen_conversation_list_with_count:e=>`Conversations, ${e} total`,a11y_csat_displayed:"Satisfaction survey displayed",a11y_empty_conversation:"No messages in this conversation",a11y_input_disabled:"Message input is disabled",a11y_file_size_exceeded:e=>`File exceeds size limit of ${e}MB`,a11y_csat_form_error:"Please complete the required fields",a11y_hint_send_message:"Sends the message",a11y_hint_open_conversation:"Opens the conversation",a11y_hint_open_conversations:"Opens conversations",a11y_hint_close_conversation:"Closes the conversation",a11y_hint_close_messenger:"Closes the messenger",a11y_hint_open_menu:"Opens the menu",a11y_hint_connect_to_agent:"Escalates to a human agent",a11y_hint_attach_file:"Opens file attachment options",a11y_hint_view_new_messages:"Scrolls to new messages",a11y_hint_open_file:"Opens the file",a11y_hint_open_image:"Opens the image",a11y_hint_send_reply:"Sends this reply",image_viewer_default_title:"Image",a11y_image_viewer_close:"Close image viewer",a11y_image_viewer_previous:"Previous image",a11y_image_viewer_next:"Next image",a11y_image_viewer_download:"Download image",attachment_document:"Files"},conversation_list:{header_title:"Conversations",ended:"Ended",system_message:"System message",footer_title:"Start a conversation",multiple_files_count:e=>`${e} ${e===1?"file":"files"}`,a11y_conversation_item:(e,t,n,r)=>`${e}, ${t}, ${n}${r>0?`, ${r} unread ${r===1?"message":"messages"}`:""}`},date_format:{just_now:"Just now",minutes_ago:e=>`${e} minutes ago`,hours_ago:e=>`${e} hours ago`,date_short:"MM/dd/yyyy",date_separator:"MMMM dd, yyyy",message_timestamp:"p"},csat:{title:"Your feedback matters to us",submitted_label:"Successfully submitted!",cre_question:"Was your issue resolved?",cre_positive_label:"Yes, thank you! 👍",cre_negative_label:"No, that didn't help.",reason_placeholder:"Share your feedback",question:"How would you rate your experience?",submit_label:"Submit",submission_expired:"We're sorry, the survey period has ended.",a11y_csat_rating_label:(e,t)=>`${e} out of 5 — ${t}`,a11y_hint_select_rating:"Selects this rating"},form:{optional_label:"optional",validation_required:"This question is required"},common:{placeholder_something_went_wrong:"Something went wrong",placeholder_no_messages:"No messages",placeholder_no_conversations:"No conversations yet",placeholder_something_went_wrong_retry_label:"Retry",button_ok:"OK",button_cancel:"Cancel"},feedback:{title:"Submit feedback",good:"Good",bad:"Bad",comment_label:"Comment (optional)",comment_placeholder:"Leave a comment",cancel:"Cancel",submit:"Submit",save:"Save",edit:"Edit feedback",remove:"Remove feedback"},handoff:{confirm_title:"Request handoff?",confirm_description:"You'll be transferred to a human agent. Your conversation history will be shared.",confirm_cancel:"Cancel",confirm_handoff:"Handoff"},memory:{dialog_title:"Memory",desc_on:"Memory is **turned on**. It remembers your conversation history to provide personalized responses tailored to your previous questions and preferences.",desc_off:"Memory is **turned off**. If turned on, it will remember your conversation history to provide personalized responses tailored to your previous questions and preferences.",button_use:"Use",button_dont_use:"Don't use",button_keep_using:"Keep using",button_disable:"Disable",button_disable_and_delete:"Disable & Delete memory",button_keep_off:"Keep off",button_enable:"Enable memory",button_cancel:"Cancel",error_message:"Failed to update memory state. Please try again.",a11y_indicator_manage:"Manage memory",a11y_indicator_on:"Memory is on",a11y_indicator_off:"Memory is off"},connection_delay:{title:"Something went wrong. You'll be reconnected shortly.",description:e=>`Estimated waiting time: ${e}`}},fr={language:"en",strings:Ch,dateLocale:lc.enUS},Ki=e=>({MESSAGE_INPUT__PLACE_HOLDER:e.conversation.input_placeholder,MESSAGE_INPUT__PLACE_HOLDER__DISABLED:e.conversation.input_placeholder_disabled,MESSAGE_INPUT__PLACE_HOLDER__STEWARD:e.conversation.input_placeholder_steward,MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE:e.conversation.input_placeholder_wait_ai_agent_response,MESSAGE_INPUT__PLACE_HOLDER__RECONNECTING:e.conversation.input_placeholder_reconnecting,UNKNOWN__UNKNOWN_MESSAGE_TYPE:e.conversation.unknown_message_type,POWERED_BY:e.conversation.powered_by,CSAT_TITLE_UNSUBMITTED:e.csat.title,CSAT_TITLE_SUBMITTED:e.csat.submitted_label,CSAT_CRE_TITLE:e.csat.cre_question,CSAT_CRE_SOLVED:e.csat.cre_positive_label,CSAT_CRE_NOT_SOLVED:e.csat.cre_negative_label,CSAT_REASON_PLACEHOLDER:e.csat.reason_placeholder,CSAT_RATING_TITLE:e.csat.question,CSAT_SUBMIT_LABEL:e.csat.submit_label,CSAT_SUBMISSION_EXPIRED:e.csat.submission_expired,DATE_FORMAT__JUST_NOW:e.date_format.just_now,DATE_FORMAT__MINUTES_AGO:e.date_format.minutes_ago,DATE_FORMAT__HOURS_AGO:e.date_format.hours_ago,DATE_FORMAT__DATE_SHORT:e.date_format.date_short,DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR:e.date_format.date_separator,DATE_FORMAT__MESSAGE_TIMESTAMP:e.date_format.message_timestamp,CONVERSATION_LIST__HEADER_TITLE:e.conversation_list.header_title,CONVERSATION_LIST__ENDED:e.conversation_list.ended,CONVERSATION_LIST__SYSTEM_MESSAGE:e.conversation_list.system_message,CONVERSATION_LIST__NO_CONVERSATIONS:e.common.placeholder_no_conversations,CONVERSATION_LIST__MULTIPLE_FILES_COUNT:e.conversation_list.multiple_files_count,TALK_TO_AGENT:e.conversation.start_new_conversation_label,CITATION_SOURCE_TITLE:e.conversation.citation_title,FORM_PLACEHOLDER:e.conversation.input_placeholder_active_form,FORM_VALIDATION_REQUIRED:e.form.validation_required,OPTIONAL:e.form.optional_label,PLACE_HOLDER__WRONG:e.common.placeholder_something_went_wrong,PLACE_HOLDER__NO_MESSAGES:e.common.placeholder_no_messages,RETRY:e.common.placeholder_something_went_wrong_retry_label,BUTTON__OK:e.common.button_ok,BUTTON__CANCEL:e.common.button_cancel,FAILED_MESSAGE_RESEND:e.conversation.failed_message_resend,FAILED_MESSAGE_REMOVE:e.conversation.failed_message_remove,FILE_UPLOAD_NO_SUPPORTED_FILES:e.conversation.file_upload_no_supported_files,FILE_UPLOAD_REPLACE_ALERT__TITLE:e.conversation.file_upload_replace_alert_title,FILE_UPLOAD_REPLACE_ALERT__DESCRIPTION:e.conversation.file_upload_replace_alert_description,FILE_UPLOAD_FILES:e.conversation.attachment_document,FEEDBACK_TITLE:e.feedback.title,FEEDBACK_GOOD:e.feedback.good,FEEDBACK_BAD:e.feedback.bad,FEEDBACK_COMMENT_LABEL:e.feedback.comment_label,FEEDBACK_COMMENT_PLACEHOLDER:e.feedback.comment_placeholder,FEEDBACK_CANCEL:e.feedback.cancel,FEEDBACK_SUBMIT:e.feedback.submit,FEEDBACK_SAVE:e.feedback.save,FEEDBACK_EDIT:e.feedback.edit,FEEDBACK_REMOVE:e.feedback.remove,A11Y_MESSAGE_LIST:e.conversation.a11y_message_list,A11Y_SCROLL_TO_BOTTOM:e.conversation.a11y_scroll_to_bottom,A11Y_SCROLL_TO_NEW_MESSAGES:e.conversation.a11y_scroll_to_new_messages,A11Y_OPEN_CONVERSATION_LIST:e.conversation.a11y_open_conversation_list,A11Y_OPEN_CONVERSATION:e.conversation.a11y_open_conversation,A11Y_OPEN_CONVERSATIONS:e.conversation.a11y_open_conversations,A11Y_CLOSE_CONVERSATION:e.conversation.a11y_close_conversation,A11Y_CLOSE_CONVERSATIONS:e.conversation.a11y_close_conversations,A11Y_MENU:e.conversation.a11y_menu,A11Y_MESSAGE_INPUT:e.conversation.a11y_message_input,A11Y_SEND_MESSAGE:e.conversation.a11y_send_message,A11Y_ATTACH_FILE:e.conversation.a11y_attach_file,A11Y_CONNECT_AGENT:e.conversation.a11y_connect_agent,A11Y_CLOSE_MESSENGER:e.conversation.a11y_close_messenger,A11Y_EXPAND_MESSENGER:e.conversation.a11y_expand_messenger,A11Y_COLLAPSE_MESSENGER:e.conversation.a11y_collapse_messenger,A11Y_MESSAGE_SENDER_YOU:e.conversation.a11y_message_sender_you,A11Y_SUGGESTED_REPLY:e.conversation.a11y_suggested_reply,A11Y_TYPING_INDICATOR:e.conversation.a11y_typing_indicator,A11Y_CODE_BLOCK_PLACEHOLDER:e.conversation.a11y_code_block_placeholder,A11Y_TYPING_FORMAT:e.conversation.a11y_typing_format,A11Y_MESSAGE_FAILED:e.conversation.a11y_message_failed,A11Y_NEW_MESSAGES_RECEIVED:e.conversation.a11y_new_messages_received,A11Y_NEW_MESSAGES_RECEIVED_FROM_SENDER:e.conversation.a11y_new_messages_received_from_sender,A11Y_AGENT_CONNECTED:e.conversation.a11y_agent_connected,A11Y_CONVERSATION_CLOSED:e.conversation.a11y_conversation_closed,A11Y_FILE_IMAGE:e.conversation.a11y_file_image,A11Y_FILE_VIDEO:e.conversation.a11y_file_video,A11Y_FILE_PDF:e.conversation.a11y_file_pdf,A11Y_FILE_DOCUMENT:e.conversation.a11y_file_document,A11Y_RECEIVED_FILE_IMAGE:e.conversation.a11y_received_file_image,A11Y_RECEIVED_FILE_VIDEO:e.conversation.a11y_received_file_video,A11Y_RECEIVED_FILE_PDF:e.conversation.a11y_received_file_pdf,A11Y_RECEIVED_FILES_IMAGE_COUNT:e.conversation.a11y_received_files_image_count,A11Y_SCREEN_CONVERSATION:e.conversation.a11y_screen_conversation,A11Y_SCREEN_CONVERSATION_WITH_AGENT:e.conversation.a11y_screen_conversation_with_agent,A11Y_SCREEN_CONVERSATION_LIST_NO_COUNT:e.conversation.a11y_screen_conversation_list_no_count,A11Y_SCREEN_CONVERSATION_LIST_WITH_COUNT:e.conversation.a11y_screen_conversation_list_with_count,A11Y_CSAT_DISPLAYED:e.conversation.a11y_csat_displayed,A11Y_EMPTY_CONVERSATION:e.conversation.a11y_empty_conversation,A11Y_INPUT_DISABLED:e.conversation.a11y_input_disabled,A11Y_FILE_SIZE_EXCEEDED:e.conversation.a11y_file_size_exceeded,A11Y_CSAT_FORM_ERROR:e.conversation.a11y_csat_form_error,A11Y_HINT_SEND_MESSAGE:e.conversation.a11y_hint_send_message,A11Y_HINT_OPEN_CONVERSATION:e.conversation.a11y_hint_open_conversation,A11Y_HINT_OPEN_CONVERSATIONS:e.conversation.a11y_hint_open_conversations,A11Y_HINT_CLOSE_CONVERSATION:e.conversation.a11y_hint_close_conversation,A11Y_HINT_OPEN_MENU:e.conversation.a11y_hint_open_menu,A11Y_HINT_CONNECT_TO_AGENT:e.conversation.a11y_hint_connect_to_agent,A11Y_HINT_ATTACH_FILE:e.conversation.a11y_hint_attach_file,A11Y_HINT_VIEW_NEW_MESSAGES:e.conversation.a11y_hint_view_new_messages,A11Y_HINT_OPEN_FILE:e.conversation.a11y_hint_open_file,A11Y_HINT_OPEN_IMAGE:e.conversation.a11y_hint_open_image,A11Y_HINT_SEND_REPLY:e.conversation.a11y_hint_send_reply,A11Y_CONVERSATION_ITEM:e.conversation_list.a11y_conversation_item,A11Y_CSAT_RATING_LABEL:e.csat.a11y_csat_rating_label,A11Y_HINT_SELECT_RATING:e.csat.a11y_hint_select_rating,IMAGE_VIEWER__DEFAULT_TITLE:e.conversation.image_viewer_default_title,A11Y_IMAGE_VIEWER_CLOSE:e.conversation.a11y_image_viewer_close,A11Y_IMAGE_VIEWER_PREVIOUS:e.conversation.a11y_image_viewer_previous,A11Y_IMAGE_VIEWER_NEXT:e.conversation.a11y_image_viewer_next,A11Y_IMAGE_VIEWER_DOWNLOAD:e.conversation.a11y_image_viewer_download,SCROLL_TO_NEW_MESSAGES_LABEL:e.conversation.scroll_to_new_messages_label,HANDOFF_CONFIRM__TITLE:e.handoff.confirm_title,HANDOFF_CONFIRM__DESCRIPTION:e.handoff.confirm_description,HANDOFF_CONFIRM__CANCEL:e.handoff.confirm_cancel,HANDOFF_CONFIRM__HANDOFF:e.handoff.confirm_handoff,MEMORY__DIALOG_TITLE:e.memory.dialog_title,MEMORY__DESC_ON:e.memory.desc_on,MEMORY__DESC_OFF:e.memory.desc_off,MEMORY__BUTTON_USE:e.memory.button_use,MEMORY__BUTTON_DONT_USE:e.memory.button_dont_use,MEMORY__BUTTON_KEEP_USING:e.memory.button_keep_using,MEMORY__BUTTON_DISABLE:e.memory.button_disable,MEMORY__BUTTON_DISABLE_AND_DELETE:e.memory.button_disable_and_delete,MEMORY__BUTTON_KEEP_OFF:e.memory.button_keep_off,MEMORY__BUTTON_ENABLE:e.memory.button_enable,MEMORY__BUTTON_CANCEL:e.memory.button_cancel,MEMORY__ERROR_MESSAGE:e.memory.error_message,A11Y_MEMORY_INDICATOR_MANAGE:e.memory.a11y_indicator_manage,A11Y_MEMORY_INDICATOR_ON:e.memory.a11y_indicator_on,A11Y_MEMORY_INDICATOR_OFF:e.memory.a11y_indicator_off,CONNECTION_DELAY__TITLE:e.connection_delay.title,CONNECTION_DELAY__DESCRIPTION:e.connection_delay.description}),Yi=e=>{var t;return((t=e.split("-"))==null?void 0:t[0])??Zt},Zt="en",Wi=new Set([Zt,"ko","es","pt","fr","hi","it","de","tr","ja"]),bh='@import"https://fonts.googleapis.com/css?family=Roboto:400,500,600,700&display=swap";.sb-message-template__border{position:relative}.sb-message-template__border:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;box-shadow:inset 0 0 0 var(--border-width) var(--border-color);border-radius:var(--border-radius);pointer-events:none}.sb-message-template__action{cursor:pointer}.sb-message-template__parent{font-family:Roboto,serif}.sb-message-template__text{font-family:inherit;font-size:14px;font-weight:400;font-stretch:normal;font-style:normal;letter-spacing:normal;text-align:left}.sb-message-template__text-button{font-family:inherit;background-color:#e0e0e0;text-align:center;padding:10px;border-radius:6px;font-size:14px;font-weight:600;font-stretch:normal;font-style:normal;letter-spacing:normal}.sendbird-theme--light .sb-message-template__text-button{color:#742ddd}.sendbird-theme--dark .sb-message-template__text-button{color:#c2a9fa}.sb-message-template__text-button:hover{opacity:1;box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px}.sb-message-template__text-button,.sb-message-template__image-button{cursor:pointer;border-style:none}.sb-message-template__parent{border-radius:unset;background-color:transparent;overflow:hidden}.sb-message-template__parent *{box-sizing:border-box;line-height:1.3}.sb-message-template__carousel{display:flex;width:100%;box-sizing:border-box;touch-action:pan-y}',{Provider:vh,useContext:Vr}=be("AgentUIElementResolver"),yh=({entryElement:e,modalRootElement:t,rootElement:n,children:r})=>{const s=l.useMemo(()=>{const o=n??document.body,i=e??o,c=t??o,u=d=>d===ye.MODAL_ROOT?c:i.querySelector(`#${d}`);return{resolveElement:u,resolvePortalContainer:d=>u(d)??c}},[e,t,n]);return a.createElement(vh,{value:s},r)};function ut(e,t){const n=e.getRootNode({composed:t});return n instanceof ShadowRoot||n instanceof Document?n:document}const Xs=()=>{const e=[];let t=0;const n=new Set,r=()=>n.forEach(s=>s());return{register:s=>{const o=++t;return e.push({id:o,handler:s}),r(),()=>{const i=e.findIndex(c=>c.id===o);i>=0&&(e.splice(i,1),r())}},dismissTopmost:()=>{const s=e[e.length-1];return s?(s.handler(),!0):!1},subscribe:s=>(n.add(s),()=>{n.delete(s)}),getOpenCount:()=>e.length}},{Provider:Sh,useContext:qr}=be("EscapeDismissStack"),Zs=e=>{e.stopPropagation(),e.stopImmediatePropagation()},Ah=({rootElement:e=document.body,boundaryElement:t,children:n})=>{const r=l.useRef(null),s=l.useRef(null);r.current||(r.current=Xs()),s.current||(s.current=Xs());const o=r.current,i=s.current;l.useLayoutEffect(()=>{const u=t??ut(e),d=m=>{if(m.key==="Escape"){if(o.dismissTopmost()){Zs(m);return}i.dismissTopmost()&&Zs(m)}};return u.addEventListener("keydown",d),()=>u.removeEventListener("keydown",d)},[t,e,i,o]);const c=l.useMemo(()=>({register:o.register,dismissTopmost:o.dismissTopmost,registerShellDismissHandler:i.register,subscribe:o.subscribe,getOpenCount:o.getOpenCount}),[i,o]);return a.createElement(Sh,{value:c},n)},ji=(e,t,n)=>{const r=l.useRef(t);l.useLayoutEffect(()=>{r.current=t},[t]),l.useLayoutEffect(()=>{if(e)return n(()=>r.current())},[e,n])},Th=(e,t)=>{const{register:n}=qr();ji(e,t,n)},Ih=(e,t)=>{const{registerShellDismissHandler:n}=qr();ji(e,t,n)},Xi=()=>{const{subscribe:e,getOpenCount:t}=qr();return l.useSyncExternalStore(e,()=>t()>0,()=>!1)},xh=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((s,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},Js=Ki(fr.strings),Rh={...Js,HEADER_BUTTON__AGENT_HANDOFF:"Talk to human agent",MESSAGE_INPUT__PLACE_HOLDER__SUGGESTED_REPLIES:"Select an option to continue",BUTTON__SUBMIT:"Submit",SUBMITTED:"Submitted",TRY_AGAIN:"Please try again.",FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT:"Up to %d files can be attached.",FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT:"The maximum size per file is %d MB.",FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION:"%d files were excluded due to limits. Please select files individually.",FILE_UPLOAD_PHOTOS:"Photos",FILE_VIEWER__UNSUPPORT:"Unsupported message",A11Y_FILE_SELECTED:e=>`${e}, selected`,A11Y_FILE_REMOVE_BUTTON:e=>`Remove file: ${e}`,A11Y_FILE_UPLOAD_OPTIONS:"File upload options",A11Y_FAILED_MESSAGE_OPTIONS:"Failed message options",A11Y_FEEDBACK_OPTIONS:"Feedback options",A11Y_CSAT_TEXT_INPUT_LABEL:"Enter answer",FORM_UNAVAILABLE:"Form is no longer available.",FORM_NOT_SUPPORTED:"This form is not supported in the current version.",FORM_VALIDATION_MIN_LENGTH:e=>`Minimum ${e} characters required`,FORM_VALIDATION_MAX_LENGTH:e=>`Maximum ${e} characters allowed`,FORM_VALIDATION_MIN:e=>`Minimum value is ${e}`,FORM_VALIDATION_MAX:e=>`Maximum value is ${e}`,FORM_VALIDATION_MIN_SELECT:e=>`Select at least ${e} options`,FORM_VALIDATION_MAX_SELECT:e=>`Select at most ${e} options`,FORM_VALIDATION_REGEX_FAILED:"Invalid format",DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE:Js.DATE_FORMAT__DATE_SHORT,DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION:"h:mma",CONVERSATION_LIST__TOPICS_FALLBACK:"No category",CONVERSATION_CLOSED_FOOTER_LABEL:"Your conversation has ended",START_NEW_CONVERSATION:"💬 Start a new conversation",RETURN_TO_CONVERSATION:"💬 Return to conversation",BUTTON__SAVE:"Save",NO_NAME:"(No name)",CHANNEL_FROZEN:"Channel frozen"},xn={language:fr.language,dateLocale:fr.dateLocale,stringSet:Rh},Mh=Object.freeze(Object.defineProperty({__proto__:null,default:xn},Symbol.toStringTag,{value:"Module"})),gr=new Map([[Zt,xn]]);async function wh(e){const t=gr.get(e);if(t)return t;try{if(Wi.has(e)){const{default:n}=await xh(Object.assign({"./languages/de.ts":()=>Promise.resolve().then(()=>require("./cjs/I-l-5Zo-.cjs")),"./languages/en.ts":()=>Promise.resolve().then(()=>Mh),"./languages/es.ts":()=>Promise.resolve().then(()=>require("./cjs/D_km8dcd.cjs")),"./languages/fr.ts":()=>Promise.resolve().then(()=>require("./cjs/CLIpC7kY.cjs")),"./languages/hi.ts":()=>Promise.resolve().then(()=>require("./cjs/ChrM6HN1.cjs")),"./languages/it.ts":()=>Promise.resolve().then(()=>require("./cjs/CPZf2TWM.cjs")),"./languages/ja.ts":()=>Promise.resolve().then(()=>require("./cjs/D7UQ9OK7.cjs")),"./languages/ko.ts":()=>Promise.resolve().then(()=>require("./cjs/BMDJStMQ.cjs")),"./languages/pt.ts":()=>Promise.resolve().then(()=>require("./cjs/etCQgYrr.cjs")),"./languages/tr.ts":()=>Promise.resolve().then(()=>require("./cjs/DKQwAy8C.cjs"))}),`./languages/${e}.ts`,3);return gr.set(e,n),n}return xn}catch{return xn}}const{Provider:kh,useContext:oe}=be("Localization"),Lh=({language:e=navigator.language,languageCode:t,logger:n,stringSet:r,children:s})=>{const[o,i]=l.useState(gr.get(Zt));return l.useEffect(()=>{const c=t??Yi(e);o.language!==c&&(n==null||n.debug("localization.useEffect: update language",{from:o.language,to:c}),wh(c).then(i))},[e,t,n]),a.createElement(kh,{value:{language:o.language,defaultStringSet:o.stringSet,stringSet:{...o.stringSet,...r},dateLocale:o.dateLocale,format:(c,u,d)=>at.format(c,u,{locale:o.dateLocale,...d})}},s)},Rn="data-sb-agent-theme",Qs=e=>(t,...n)=>{let r="";return t.forEach((s,o)=>{r+=s+(n[o]??"")}),`[${Rn}='${e}'] & { ${r} }`},Q={light:Qs("light"),dark:Qs("dark")},Oh=U.css(({theme:e})=>{const{palette:t}=e;return`
|
|
8
8
|
:root,
|
|
9
9
|
:host {
|
|
10
10
|
--sendbird-primary-extra-dark: ${t.primary.extraDark};
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
padding: 16px 12px;
|
|
293
293
|
transition: max-width 0.3s;
|
|
294
294
|
overflow-wrap: break-word;
|
|
295
|
-
`,lE=C.default.div`display:flex;flex-direction:column;gap:12px;`,uE=C.default.div`display:flex;flex-direction:column;`,dE=C.default.div`display:flex;flex-direction:column;gap:8px;`,mE=e=>a.createElement(a.Fragment,null),vr=typeof __SBA_USE_MESSAGE_TEMPLATE__>"u"||__SBA_USE_MESSAGE_TEMPLATE__?l.lazy(()=>Promise.resolve().then(()=>require("./cjs/
|
|
295
|
+
`,lE=C.default.div`display:flex;flex-direction:column;gap:12px;`,uE=C.default.div`display:flex;flex-direction:column;`,dE=C.default.div`display:flex;flex-direction:column;gap:8px;`,mE=e=>a.createElement(a.Fragment,null),vr=typeof __SBA_USE_MESSAGE_TEMPLATE__>"u"||__SBA_USE_MESSAGE_TEMPLATE__?l.lazy(()=>Promise.resolve().then(()=>require("./cjs/ZOM6SoNd.cjs")).then(e=>({default:e.MessageTemplateWrapper}))):null,hE=({messageTemplate:e,onError:t})=>{const n=l.useRef(void 0);l.useEffect(()=>{if(vr||!e||!t)return;const r=e.key??"";n.current!==r&&(t(new Error("Message template rendering is disabled")),n.current=r)},[e,t])},fE=e=>{var n,r,s;const t=(n=e.extendedMessagePayload)==null?void 0:n.message_template;return hE({messageTemplate:t,onError:(r=e.statsCallbacks)==null?void 0:r.onMessageTemplateError}),vr?a.createElement(Ht,{errorFallback:e.messageTemplateErrorFallback,loadingFallback:e.messageTemplateLoadingFallback,onError:(s=e.statsCallbacks)==null?void 0:s.onMessageTemplateError},a.createElement(vr,{...e})):null},gE=({extendedMessagePayload:e,onClickSuggestedReply:t,suggestedRepliesDirection:n="vertical"})=>{const{conversation:r}=re(),[s,o]=l.useState(!1),{suggestedReplies:i}=r,c=(e==null?void 0:e.suggested_replies)??[];if(c.length===0||s)return null;const u=d=>{t&&(t({reply:d}),o(!0))};return a.createElement(pE,{id:`${tt}-ext-suggested-replies`,role:"presentation",$type:n},c.map((d,m)=>{const h=i.item(d,m);return a.createElement(l.Fragment,{key:m},a.createElement(_E,{$type:n,...h.props,onClick:()=>u(d)},a.createElement(EE,{variant:"body3"},d)),h.descriptionNode)}))},pE=C.default.div`margin:16px 0;padding:0 ${ee.HORIZONTAL_PADDING}px;position:relative;display:flex;align-self:stretch;gap:8px;${({$type:e})=>e==="vertical"?CE:bE};`,_E=C.default.button.attrs({type:"button"})`
|
|
296
296
|
all: unset;
|
|
297
297
|
box-sizing: border-box;
|
|
298
298
|
padding: 8px 12px;
|
package/dist/index.d.ts
CHANGED
|
@@ -2932,7 +2932,7 @@ export declare const IncomingMessageLayout: {
|
|
|
2932
2932
|
};
|
|
2933
2933
|
}) => ReactNode;
|
|
2934
2934
|
SuggestedReplies: ({ extendedMessagePayload, onClickSuggestedReply, suggestedRepliesDirection, }: IncomingMessageProps) => ReactNode;
|
|
2935
|
-
MessageTemplate: (props: Pick<IncomingMessageProps, "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
2935
|
+
MessageTemplate: (props: Pick<IncomingMessageProps, "onClickLink" | "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
2936
2936
|
statsCallbacks?: Pick<IncomingMessageStatsCallbacks, "onMessageTemplateError">;
|
|
2937
2937
|
}) => ReactNode;
|
|
2938
2938
|
CustomMessageTemplate: (_: ({
|
|
@@ -3424,7 +3424,7 @@ export declare const IncomingMessageLayout: {
|
|
|
3424
3424
|
};
|
|
3425
3425
|
}) => ReactNode;
|
|
3426
3426
|
SuggestedReplies: ({ extendedMessagePayload, onClickSuggestedReply, suggestedRepliesDirection, }: IncomingMessageProps) => ReactNode;
|
|
3427
|
-
MessageTemplate: (props: Pick<IncomingMessageProps, "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
3427
|
+
MessageTemplate: (props: Pick<IncomingMessageProps, "onClickLink" | "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
3428
3428
|
statsCallbacks?: Pick<IncomingMessageStatsCallbacks, "onMessageTemplateError">;
|
|
3429
3429
|
}) => ReactNode;
|
|
3430
3430
|
CustomMessageTemplate: (_: ({
|
|
@@ -3911,7 +3911,7 @@ export declare const IncomingMessageLayout: {
|
|
|
3911
3911
|
};
|
|
3912
3912
|
}) => ReactNode;
|
|
3913
3913
|
SuggestedReplies: ({ extendedMessagePayload, onClickSuggestedReply, suggestedRepliesDirection, }: IncomingMessageProps) => ReactNode;
|
|
3914
|
-
MessageTemplate: (props: Pick<IncomingMessageProps, "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
3914
|
+
MessageTemplate: (props: Pick<IncomingMessageProps, "onClickLink" | "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
3915
3915
|
statsCallbacks?: Pick<IncomingMessageStatsCallbacks, "onMessageTemplateError">;
|
|
3916
3916
|
}) => ReactNode;
|
|
3917
3917
|
CustomMessageTemplate: (_: ({
|
|
@@ -4384,7 +4384,7 @@ export declare const IncomingMessageLayout: {
|
|
|
4384
4384
|
}>;
|
|
4385
4385
|
} & {
|
|
4386
4386
|
MessageTemplate: (props: {
|
|
4387
|
-
component: (props: Pick<IncomingMessageProps, "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
4387
|
+
component: (props: Pick<IncomingMessageProps, "onClickLink" | "onGetCachedMessageTemplate" | "onRequestMessageTemplate" | "onHandleTemplateInternalAction" | "messageTemplateErrorFallback" | "messageTemplateLoadingFallback" | "extendedMessagePayload"> & {
|
|
4388
4388
|
statsCallbacks?: Pick<IncomingMessageStatsCallbacks, "onMessageTemplateError">;
|
|
4389
4389
|
}) => ReactNode;
|
|
4390
4390
|
}) => null;
|
package/dist/index.js
CHANGED
|
@@ -149,7 +149,7 @@ const tl = (e) => !!(e != null && e.cta_button), nl = (e) => {
|
|
|
149
149
|
type: "text",
|
|
150
150
|
value: e.slice(s).trim()
|
|
151
151
|
}), t ? r.map((o) => o.type !== "text" ? o : { ...o, value: t(o.value) }) : r;
|
|
152
|
-
}, ml = (e) => e.replace(/\[([^\]]+)\](?!\()/g, "\\[$1\\]"), hl = (e) => e.replace(/([a-zA-Z0-9])_(?=[a-zA-Z0-9])/g, "$1\\_"), gl = (e) => e.replace(/~~/g, "\\~\\~"), $
|
|
152
|
+
}, ml = (e) => e.replace(/\[([^\]]+)\](?!\()/g, "\\[$1\\]"), hl = (e) => e.replace(/([a-zA-Z0-9])_(?=[a-zA-Z0-9])/g, "$1\\_"), gl = (e) => e.replace(/~~/g, "\\~\\~"), $A = (e) => {
|
|
153
153
|
let t = e;
|
|
154
154
|
return t = ml(t), t = hl(t), t = gl(t), t;
|
|
155
155
|
}, fl = typeof navigator < "u" && navigator.product === "ReactNative", Ss = (e, t) => {
|
|
@@ -2072,12 +2072,12 @@ const wi = (e) => {
|
|
|
2072
2072
|
} catch {
|
|
2073
2073
|
return JSON.stringify(e).slice(1, -1);
|
|
2074
2074
|
}
|
|
2075
|
-
}, Nu = (e) => JSON.parse(e),
|
|
2076
|
-
function
|
|
2075
|
+
}, Nu = (e) => JSON.parse(e), FA = (e) => JSON.parse(e);
|
|
2076
|
+
function PA(e, t) {
|
|
2077
2077
|
const [n, r] = t.split(",").map((s) => s.trim());
|
|
2078
2078
|
return e === "dark" && r || n;
|
|
2079
2079
|
}
|
|
2080
|
-
function
|
|
2080
|
+
function UA(e) {
|
|
2081
2081
|
const t = {};
|
|
2082
2082
|
function n(r, s = "") {
|
|
2083
2083
|
for (const [o, i] of Object.entries(r)) {
|
|
@@ -2087,7 +2087,7 @@ function U0(e) {
|
|
|
2087
2087
|
}
|
|
2088
2088
|
return n(e), t;
|
|
2089
2089
|
}
|
|
2090
|
-
function
|
|
2090
|
+
function BA({
|
|
2091
2091
|
template: e,
|
|
2092
2092
|
variables: t,
|
|
2093
2093
|
variableKeyPattern: n,
|
|
@@ -2100,7 +2100,7 @@ function B0({
|
|
|
2100
2100
|
return s.replace(l, wi(c));
|
|
2101
2101
|
}, e);
|
|
2102
2102
|
}
|
|
2103
|
-
async function
|
|
2103
|
+
async function HA({
|
|
2104
2104
|
template: e,
|
|
2105
2105
|
variables: t,
|
|
2106
2106
|
variableKeyPattern: n,
|
|
@@ -5451,7 +5451,7 @@ function Am(e) {
|
|
|
5451
5451
|
}
|
|
5452
5452
|
const {
|
|
5453
5453
|
Provider: Tm,
|
|
5454
|
-
useContext:
|
|
5454
|
+
useContext: GA
|
|
5455
5455
|
} = Ae("MessageTemplateFetching");
|
|
5456
5456
|
function Im({ children: e, internalVariables: t }) {
|
|
5457
5457
|
const n = T({}), r = T({}), [s, o] = k({}), i = R((u, d) => {
|
|
@@ -6769,7 +6769,7 @@ const Vm = /* @__PURE__ */ new Set(["free_text", "single_choice"]), zm = ({ csat
|
|
|
6769
6769
|
}) => ({
|
|
6770
6770
|
label: Ph(e, t),
|
|
6771
6771
|
hint: Uh(e, t)
|
|
6772
|
-
}), Hh = "1.34.
|
|
6772
|
+
}), Hh = "1.34.1", Ye = "sb-agent", Ie = {
|
|
6773
6773
|
ENTRY: `${Ye}-entry`,
|
|
6774
6774
|
MODAL_ROOT: `${Ye}-modal-root`,
|
|
6775
6775
|
WINDOW: `${Ye}-window`,
|
|
@@ -8988,7 +8988,7 @@ function Of({ scrollMode: e, messageStackDirection: t, children: n }) {
|
|
|
8988
8988
|
}
|
|
8989
8989
|
const {
|
|
8990
8990
|
Provider: Nf,
|
|
8991
|
-
Context:
|
|
8991
|
+
Context: VA,
|
|
8992
8992
|
useContext: ke
|
|
8993
8993
|
} = Ae("Conversation"), Df = ({ children: e }) => {
|
|
8994
8994
|
var s;
|
|
@@ -10727,7 +10727,7 @@ const v_ = _.div`border-radius:50%;display:inline-block;overflow:hidden;position
|
|
|
10727
10727
|
padding: 16px 12px;
|
|
10728
10728
|
transition: max-width 0.3s;
|
|
10729
10729
|
overflow-wrap: break-word;
|
|
10730
|
-
`, zE = _.div`display:flex;flex-direction:column;gap:12px;`, KE = _.div`display:flex;flex-direction:column;`, YE = _.div`display:flex;flex-direction:column;gap:8px;`, WE = (e) => /* @__PURE__ */ a.createElement(a.Fragment, null), Tr = typeof __SBA_USE_MESSAGE_TEMPLATE__ > "u" || __SBA_USE_MESSAGE_TEMPLATE__ ? Q(() => import("./es/
|
|
10730
|
+
`, zE = _.div`display:flex;flex-direction:column;gap:12px;`, KE = _.div`display:flex;flex-direction:column;`, YE = _.div`display:flex;flex-direction:column;gap:8px;`, WE = (e) => /* @__PURE__ */ a.createElement(a.Fragment, null), Tr = typeof __SBA_USE_MESSAGE_TEMPLATE__ > "u" || __SBA_USE_MESSAGE_TEMPLATE__ ? Q(() => import("./es/ClcdzLx5.js").then((e) => ({ default: e.MessageTemplateWrapper }))) : null, qE = ({
|
|
10731
10731
|
messageTemplate: e,
|
|
10732
10732
|
onError: t
|
|
10733
10733
|
}) => {
|
|
@@ -13219,7 +13219,7 @@ const Gv = _(rc)`flex-shrink:0;border-radius:8px;&:disabled{cursor:not-allowed;}
|
|
|
13219
13219
|
return /* @__PURE__ */ a.createElement(Vy, { value: s }, e);
|
|
13220
13220
|
}, {
|
|
13221
13221
|
Provider: Ky,
|
|
13222
|
-
Context:
|
|
13222
|
+
Context: zA,
|
|
13223
13223
|
useContext: Xn
|
|
13224
13224
|
} = Ae("ConversationList");
|
|
13225
13225
|
function Yy({
|
|
@@ -13831,7 +13831,7 @@ wn.Screen = _c;
|
|
|
13831
13831
|
const Xe = {
|
|
13832
13832
|
conv: "conv",
|
|
13833
13833
|
convList: "conv-list"
|
|
13834
|
-
},
|
|
13834
|
+
}, eA = (e) => e === Xe.convList ? "ConversationList" : "Conversation", tA = ({ isOpened: e, activeScreenId: t }) => e && t === Xe.conv, Ec = ({
|
|
13835
13835
|
isOpened: e,
|
|
13836
13836
|
entryPoint: t,
|
|
13837
13837
|
selectedChannelUrl: n,
|
|
@@ -13853,15 +13853,15 @@ const Xe = {
|
|
|
13853
13853
|
return Xe.conv;
|
|
13854
13854
|
}
|
|
13855
13855
|
})(), h = /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
|
|
13856
|
-
|
|
13856
|
+
nA,
|
|
13857
13857
|
{
|
|
13858
13858
|
onOpenConversationView: (g, p) => {
|
|
13859
13859
|
r(p), d(void 0), g.navigate(Xe.conv);
|
|
13860
13860
|
}
|
|
13861
13861
|
}
|
|
13862
|
-
), /* @__PURE__ */ a.createElement(
|
|
13862
|
+
), /* @__PURE__ */ a.createElement(rA, { onActiveRouteChange: s }));
|
|
13863
13863
|
return /* @__PURE__ */ a.createElement(wn, { initialId: m }, /* @__PURE__ */ a.createElement(wn.Screen, { id: Xe.conv }, ({ navigation: g, activeScreenId: p }) => {
|
|
13864
|
-
const b =
|
|
13864
|
+
const b = tA({ isOpened: e, activeScreenId: p });
|
|
13865
13865
|
return /* @__PURE__ */ a.createElement(a.Fragment, null, h, /* @__PURE__ */ a.createElement(
|
|
13866
13866
|
o,
|
|
13867
13867
|
{
|
|
@@ -13892,22 +13892,22 @@ const Xe = {
|
|
|
13892
13892
|
l
|
|
13893
13893
|
));
|
|
13894
13894
|
}));
|
|
13895
|
-
},
|
|
13895
|
+
}, nA = ({
|
|
13896
13896
|
onOpenConversationView: e
|
|
13897
13897
|
}) => {
|
|
13898
13898
|
const { registerOnJoinedProactiveConversation: t } = He(), { navigation: n } = fs();
|
|
13899
13899
|
return t(({ channel: r }) => {
|
|
13900
13900
|
e(n, r.url);
|
|
13901
13901
|
}), null;
|
|
13902
|
-
},
|
|
13902
|
+
}, rA = ({ onActiveRouteChange: e }) => {
|
|
13903
13903
|
const { activeScreenId: t } = fs();
|
|
13904
13904
|
return D(() => {
|
|
13905
|
-
e == null || e(
|
|
13905
|
+
e == null || e(eA(t));
|
|
13906
13906
|
}, [t, e]), null;
|
|
13907
|
-
},
|
|
13907
|
+
}, sA = ({ isExpanded: e, isOpened: t, children: n, launcher: r }) => /* @__PURE__ */ a.createElement(Qr, null, /* @__PURE__ */ a.createElement(oA, { isExpanded: e, isOpened: t, launcher: r }, n)), oA = ({ isExpanded: e, isOpened: t, children: n, launcher: r }) => {
|
|
13908
13908
|
const { dir: s } = he(), o = T(null), { hasWindowTitleReference: i, isWindowNameReady: c } = qn();
|
|
13909
|
-
return Yn(t, o, { nameReady: c }), /* @__PURE__ */ a.createElement(
|
|
13910
|
-
|
|
13909
|
+
return Yn(t, o, { nameReady: c }), /* @__PURE__ */ a.createElement(iA, null, /* @__PURE__ */ a.createElement(
|
|
13910
|
+
aA,
|
|
13911
13911
|
{
|
|
13912
13912
|
ref: o,
|
|
13913
13913
|
dir: s,
|
|
@@ -13918,8 +13918,8 @@ const Xe = {
|
|
|
13918
13918
|
},
|
|
13919
13919
|
n
|
|
13920
13920
|
), r);
|
|
13921
|
-
},
|
|
13922
|
-
const s = cn(), [o, i] = k(t), [c, l] = k(n.entryPoint ?? "Conversation"), u = s ? mc :
|
|
13921
|
+
}, iA = _.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, aA = _.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && lA};${({ $isExpanded: e }) => e && cA};`, cA = K`width:743px;height:723px;`, lA = K`pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, KA = bt(function({ children: e, initialChannelUrl: t, ...n }, r) {
|
|
13922
|
+
const s = cn(), [o, i] = k(t), [c, l] = k(n.entryPoint ?? "Conversation"), u = s ? mc : sA;
|
|
13923
13923
|
return /* @__PURE__ */ a.createElement(uc, { enableExpandButton: !s, ref: r, ...n }, /* @__PURE__ */ a.createElement(ya, null, ({ state: d }) => /* @__PURE__ */ a.createElement(dc, null, /* @__PURE__ */ a.createElement(
|
|
13924
13924
|
u,
|
|
13925
13925
|
{
|
|
@@ -13940,7 +13940,7 @@ const Xe = {
|
|
|
13940
13940
|
)
|
|
13941
13941
|
), e)));
|
|
13942
13942
|
}), {
|
|
13943
|
-
Provider:
|
|
13943
|
+
Provider: uA,
|
|
13944
13944
|
useContext: ps
|
|
13945
13945
|
} = Ae("FixedMessengerStyle");
|
|
13946
13946
|
function bc(e, t, n, r = 0) {
|
|
@@ -13964,14 +13964,14 @@ function bc(e, t, n, r = 0) {
|
|
|
13964
13964
|
}
|
|
13965
13965
|
return K`${l};${u};`;
|
|
13966
13966
|
}
|
|
13967
|
-
function
|
|
13967
|
+
function dA(e) {
|
|
13968
13968
|
const { horizontal: t, vertical: n, margin: r, launcherSize: s } = ps();
|
|
13969
|
-
return /* @__PURE__ */ a.createElement(
|
|
13969
|
+
return /* @__PURE__ */ a.createElement(mA, { ...e, size: s, $horizontal: t, $vertical: n, $margin: r });
|
|
13970
13970
|
}
|
|
13971
|
-
const
|
|
13971
|
+
const mA = _(fc)`position:fixed;z-index:${yt.LAUNCHER};${({ $horizontal: e, $vertical: t, $margin: n }) => bc(e, t, n)};`, hA = ({ isExpanded: e, isOpened: t, children: n }) => /* @__PURE__ */ a.createElement(Qr, null, /* @__PURE__ */ a.createElement(gA, { isExpanded: e, isOpened: t }, n)), gA = ({ isExpanded: e, isOpened: t, children: n }) => {
|
|
13972
13972
|
const { dir: r } = he(), { horizontal: s, vertical: o, margin: i, launcherSize: c } = ps(), l = T(null), { hasWindowTitleReference: u, isWindowNameReady: d } = qn();
|
|
13973
13973
|
return Yn(t, l, { nameReady: d }), /* @__PURE__ */ a.createElement(
|
|
13974
|
-
|
|
13974
|
+
fA,
|
|
13975
13975
|
{
|
|
13976
13976
|
ref: l,
|
|
13977
13977
|
dir: r,
|
|
@@ -13986,21 +13986,21 @@ const m0 = _(fc)`position:fixed;z-index:${yt.LAUNCHER};${({ $horizontal: e, $ver
|
|
|
13986
13986
|
},
|
|
13987
13987
|
n
|
|
13988
13988
|
);
|
|
13989
|
-
},
|
|
13989
|
+
}, fA = _.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;position:fixed;pointer-events:none;visibility:hidden;${({ $horizontal: e, $vertical: t, $margin: n, $launcherSize: r }) => bc(e, t, n, r + 12)};height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s,visibility 0s linear 150ms;transform:scale(0.15);opacity:0;transform-origin:${({ $horizontal: e, $vertical: t }) => `${e === "start" ? "left" : "right"} ${t}`};
|
|
13990
13990
|
[dir='rtl'] &:not([dir='ltr']),
|
|
13991
13991
|
&[dir='rtl'] {
|
|
13992
13992
|
transform-origin: ${({ $horizontal: e, $vertical: t }) => `${e === "start" ? "right" : "left"} ${t}`};
|
|
13993
13993
|
}
|
|
13994
13994
|
|
|
13995
|
-
${({ $isOpened: e }) => e &&
|
|
13996
|
-
${({ $isExpanded: e }) => e &&
|
|
13997
|
-
`,
|
|
13998
|
-
const [s, o] = k(t), [i, c] = k(n.entryPoint ?? "Conversation"), [l, u] = k("end-bottom"), [d, m] = k(Cc), [h, g] = k(48), p = cn(), b = p ? mc :
|
|
13995
|
+
${({ $isOpened: e }) => e && _A};
|
|
13996
|
+
${({ $isExpanded: e }) => e && pA};
|
|
13997
|
+
`, pA = K`width:743px;height:723px;`, _A = K`z-index:${yt.WINDOW};pointer-events:all;visibility:visible;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s,visibility 0s linear 0s;`, Cc = { top: 24, bottom: 24, start: 24, end: 24 }, EA = bt(function({ children: e, initialChannelUrl: t, ...n }, r) {
|
|
13998
|
+
const [s, o] = k(t), [i, c] = k(n.entryPoint ?? "Conversation"), [l, u] = k("end-bottom"), [d, m] = k(Cc), [h, g] = k(48), p = cn(), b = p ? mc : hA, { horizontal: C, vertical: f } = de(() => {
|
|
13999
13999
|
const [y, S] = l.split("-");
|
|
14000
14000
|
return { horizontal: y === "start" ? "start" : "end", vertical: S === "top" ? "top" : "bottom" };
|
|
14001
14001
|
}, [l]);
|
|
14002
14002
|
return /* @__PURE__ */ a.createElement(uc, { enableExpandButton: !p, ref: r, ...n }, /* @__PURE__ */ a.createElement(ya, null, ({ state: y }) => /* @__PURE__ */ a.createElement(
|
|
14003
|
-
|
|
14003
|
+
uA,
|
|
14004
14004
|
{
|
|
14005
14005
|
value: { horizontal: C, vertical: f, margin: d, launcherSize: h, setPosition: u, setMargin: m, setLauncherSize: g }
|
|
14006
14006
|
},
|
|
@@ -14013,9 +14013,9 @@ const m0 = _(fc)`position:fixed;z-index:${yt.LAUNCHER};${({ $horizontal: e, $ver
|
|
|
14013
14013
|
setSelectedChannelUrl: o,
|
|
14014
14014
|
onActiveRouteChange: c
|
|
14015
14015
|
}
|
|
14016
|
-
)), /* @__PURE__ */ a.createElement(
|
|
14016
|
+
)), /* @__PURE__ */ a.createElement(dA, { entryPoint: n.entryPoint, activeRoute: i }), e)
|
|
14017
14017
|
)));
|
|
14018
|
-
}),
|
|
14018
|
+
}), bA = (e) => {
|
|
14019
14019
|
var s, o, i, c;
|
|
14020
14020
|
const { setPosition: t, setMargin: n, setLauncherSize: r } = ps();
|
|
14021
14021
|
return ie(() => {
|
|
@@ -14028,25 +14028,25 @@ const m0 = _(fc)`position:fixed;z-index:${yt.LAUNCHER};${({ $horizontal: e, $ver
|
|
|
14028
14028
|
(c = e.margin) == null ? void 0 : c.end,
|
|
14029
14029
|
e.launcherSize
|
|
14030
14030
|
]), null;
|
|
14031
|
-
},
|
|
14031
|
+
}, CA = ({ children: e }) => {
|
|
14032
14032
|
const { setConversationChildren: t } = mn();
|
|
14033
14033
|
return ie(() => (t(e), () => t(null)), [e]), null;
|
|
14034
|
-
},
|
|
14034
|
+
}, vA = ({ component: e }) => {
|
|
14035
14035
|
const { setConversationComponent: t } = mn();
|
|
14036
14036
|
return ie(() => (t(e), () => t(ic)), [e, t]), null;
|
|
14037
|
-
},
|
|
14037
|
+
}, yA = ({ children: e }) => {
|
|
14038
14038
|
const { setConversationListChildren: t } = mn();
|
|
14039
14039
|
return ie(() => (t(e), () => t(null)), [e]), null;
|
|
14040
|
-
},
|
|
14040
|
+
}, SA = ({ component: e }) => {
|
|
14041
14041
|
const { setConversationListComponent: t } = mn();
|
|
14042
14042
|
return ie(() => (t(e), () => t(lc)), [e, t]), null;
|
|
14043
|
-
},
|
|
14044
|
-
Style:
|
|
14045
|
-
Conversation:
|
|
14046
|
-
ConversationChildren:
|
|
14047
|
-
ConversationList:
|
|
14048
|
-
ConversationListChildren:
|
|
14049
|
-
}),
|
|
14043
|
+
}, YA = Object.assign(EA, {
|
|
14044
|
+
Style: bA,
|
|
14045
|
+
Conversation: vA,
|
|
14046
|
+
ConversationChildren: CA,
|
|
14047
|
+
ConversationList: SA,
|
|
14048
|
+
ConversationListChildren: yA
|
|
14049
|
+
}), WA = (e) => {
|
|
14050
14050
|
const { refreshActiveChannel: t } = He(), [n, r] = k(!1), s = T(null), o = T(null);
|
|
14051
14051
|
return D(() => {
|
|
14052
14052
|
n && t().then(() => {
|
|
@@ -14076,20 +14076,20 @@ export {
|
|
|
14076
14076
|
Et as Commands,
|
|
14077
14077
|
Zr as ConnectionDelayLayout,
|
|
14078
14078
|
ic as Conversation,
|
|
14079
|
-
|
|
14079
|
+
VA as ConversationContext,
|
|
14080
14080
|
Ff as ConversationContextProvider,
|
|
14081
14081
|
$t as ConversationHeaderLayout,
|
|
14082
14082
|
ds as ConversationLayout,
|
|
14083
14083
|
lc as ConversationList,
|
|
14084
|
-
|
|
14084
|
+
zA as ConversationListContext,
|
|
14085
14085
|
Yy as ConversationListContextProvider,
|
|
14086
14086
|
dn as ConversationListHeaderLayout,
|
|
14087
14087
|
cc as ConversationListItemLayout,
|
|
14088
14088
|
hs as ConversationListLayout,
|
|
14089
|
-
|
|
14089
|
+
KA as DefaultMessenger,
|
|
14090
14090
|
Oi as DeskTicketPriority,
|
|
14091
14091
|
Li as DeskTicketStatus,
|
|
14092
|
-
|
|
14092
|
+
YA as FixedMessenger,
|
|
14093
14093
|
ut as I,
|
|
14094
14094
|
Nt as IncomingMessageLayout,
|
|
14095
14095
|
FS as LauncherBase,
|
|
@@ -14100,24 +14100,24 @@ export {
|
|
|
14100
14100
|
un as OutgoingMessageLayout,
|
|
14101
14101
|
as as PlaceholderLayout,
|
|
14102
14102
|
ss as SystemMessageLayout,
|
|
14103
|
-
|
|
14103
|
+
BA as a,
|
|
14104
14104
|
Nu as b,
|
|
14105
14105
|
E as c,
|
|
14106
|
-
|
|
14107
|
-
$
|
|
14108
|
-
|
|
14106
|
+
FA as d,
|
|
14107
|
+
$A as e,
|
|
14108
|
+
UA as f,
|
|
14109
14109
|
Rg as g,
|
|
14110
14110
|
Qh as m,
|
|
14111
14111
|
kS as messengerDispatcher,
|
|
14112
14112
|
Ee as n,
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14113
|
+
PA as p,
|
|
14114
|
+
HA as r,
|
|
14115
|
+
GA as u,
|
|
14116
14116
|
Fe as useAIAgentContext,
|
|
14117
14117
|
ke as useConversationContext,
|
|
14118
14118
|
Xn as useConversationListContext,
|
|
14119
14119
|
ue as useLocalizationContext,
|
|
14120
14120
|
he as useMessengerContext,
|
|
14121
14121
|
He as useMessengerSessionContext,
|
|
14122
|
-
|
|
14122
|
+
WA as useRefreshActiveChannel
|
|
14123
14123
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/ai-agent-messenger-react",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.1",
|
|
4
4
|
"description": "Delight AI Agent Messenger for React",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"react-syntax-highlighter": "^15.6.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@sendbird/chat": "^4.22.
|
|
35
|
+
"@sendbird/chat": "^4.22.6",
|
|
36
36
|
"react": ">=18.0.0",
|
|
37
37
|
"react-dom": ">=18.0.0",
|
|
38
38
|
"styled-components": ">=5.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@sendbird/chat": "^4.22.
|
|
41
|
+
"@sendbird/chat": "^4.22.6",
|
|
42
42
|
"@types/react": "19.2.2",
|
|
43
43
|
"@types/react-dom": "19.2.2",
|
|
44
44
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"strip-json-comments": "^5.0.1",
|
|
49
49
|
"@playwright/test": "^1.52.0",
|
|
50
50
|
"styled-components": "^6.1.15",
|
|
51
|
+
"@sendbird/ai-agent-core": "1.34.1",
|
|
51
52
|
"@sendbird/config-editor": "0.1.0",
|
|
52
|
-
"@sendbird/ai-agent-core": "1.34.0",
|
|
53
53
|
"@sendbird/dev-tools": "0.0.1",
|
|
54
54
|
"@sendbird/vite-tools": "0.0.1"
|
|
55
55
|
},
|
package/dist/cjs/BjKg30ip.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),E=require("styled-components"),d=require("@sendbird/react-uikit-message-template-view"),h=require("@sendbird/uikit-message-template"),n=require("../index.cjs"),M=e=>e&&e.__esModule?e:{default:e};function I(e){if(e&&e.__esModule)return e;const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(s,a,t.get?t:{enumerable:!0,get:()=>e[a]})}}return s.default=e,Object.freeze(s)}const V=I(S),O=M(E),f={VARIABLE:e=>new RegExp(`\\{${e}\\}`,"g"),VIEW_VARIABLE:e=>new RegExp(`"{@${e}}"`,"g")};function b({uiTemplateString:e,variables:s={}}){const a=n.flattenObject(s);return n.replaceVariablesSync({template:e,variables:a,variableKeyPattern:t=>f.VARIABLE(t)})}function T({theme:e,uiTemplateString:s,colorVariables:a={}}){return n.replaceVariablesSync({template:s,variables:a,variableKeyPattern:t=>f.VARIABLE(t),variableValueTransformer:t=>n.pickColorByTheme(e,t)})}function A({theme:e,uiTemplateString:s,viewVariables:a={},aiAgentColorVariables:t,internalVariables:l,onRequestTemplate:i}){const u=Object.values(a).flat().map(o=>o.key);return[...new Set(u)].some(o=>!i(o))?null:n.replaceVariablesSync({template:s,variables:a,variableKeyPattern:o=>f.VIEW_VARIABLE(o),variableValueTransformer:o=>{const g=o.map(({key:y,variables:v})=>{const w=i(y),{ui_template:c,color_variables:_}=n.parseToMessageTemplate(w);let p=JSON.stringify(c);return p=b({uiTemplateString:p,variables:l}),p=T({theme:e,uiTemplateString:p,colorVariables:_}),p=T({theme:e,uiTemplateString:p,colorVariables:t}),p=b({uiTemplateString:p,variables:v}),n.parseToUITemplate(p)});return JSON.stringify(g)}})}async function R({theme:e,uiTemplateString:s,viewVariables:a={},aiAgentColorVariables:t,internalVariables:l,onRequestTemplate:i}){return n.replaceVariablesAsync({template:s,variables:a,variableKeyPattern:r=>f.VIEW_VARIABLE(r),variableValueTransformer:async r=>{const u=r.map(async({key:o,variables:g})=>{const y=await i(o),{ui_template:v,color_variables:w}=n.parseToMessageTemplate(y);let c=JSON.stringify(v);return c=b({uiTemplateString:c,variables:l}),c=T({theme:e,uiTemplateString:c,colorVariables:w}),c=T({theme:e,uiTemplateString:c,colorVariables:t}),c=b({uiTemplateString:c,variables:g}),n.parseToUITemplate(c)}),m=await Promise.all(u);return JSON.stringify(m)}})}const C=({rawTemplate:e,aiAgentColorVariables:s,internalVariables:a,...t})=>{const{ui_template:l,color_variables:i}=n.parseToMessageTemplate(e);let r=JSON.stringify(l);if(Object.keys(t.viewVariables??{}).length>0){const m=A({...t,uiTemplateString:r,aiAgentColorVariables:s,internalVariables:a});if(m===null)return null;r=m}return r=b({...t,uiTemplateString:r,variables:a}),r=T({...t,uiTemplateString:r,colorVariables:i}),r=T({...t,uiTemplateString:r,colorVariables:s}),r=b({...t,uiTemplateString:r}),n.parseToUITemplate(r)},j=async({rawTemplate:e,aiAgentColorVariables:s,internalVariables:a,...t})=>{const{ui_template:l,color_variables:i}=n.parseToMessageTemplate(e);let r=JSON.stringify(l);return Object.keys(t.viewVariables??{}).length>0&&(r=await R({...t,uiTemplateString:r,aiAgentColorVariables:s,internalVariables:a})),r=b({...t,uiTemplateString:r,variables:a}),r=T({...t,uiTemplateString:r,colorVariables:i}),r=T({...t,uiTemplateString:r,colorVariables:s}),r=b({...t,uiTemplateString:r}),n.parseToUITemplate(r)},k=e=>{const{aiAgentColorVariables:s={}}=e,{internalVariables:a}=n.useMessageTemplateFetchingContext();return S.useState(()=>{const t=e.onGetCachedTemplate(e.templateKey);return t?C({...e,rawTemplate:t,aiAgentColorVariables:s,internalVariables:a,onRequestTemplate:e.onGetCachedTemplate}):null})},q=e=>{const[s]=k(e);if(s)return s;const{aiAgentColorVariables:a={}}=e,{internalVariables:t,fetchTemplate:l,suspend:i}=n.useMessageTemplateFetchingContext();return i(e.templateKey,async()=>{const u=await l({...e,suspense:!0});return await j({...e,rawTemplate:u,aiAgentColorVariables:a,internalVariables:t})}).value},N=new Set(["default"]),{MessageTemplate:U}=h.createMessageTemplate({parser:d.parser,renderer:d.renderer,Container:e=>V.createElement("div",{...e})}),K=({extendedMessagePayload:e,onGetCachedMessageTemplate:s=()=>null,onRequestMessageTemplate:a,onHandleTemplateInternalAction:t=n.noop})=>{const l=e==null?void 0:e.message_template;if(!N.has((l==null?void 0:l.type)??"default"))throw new Error("Unsupported template type");if(!a)throw new Error("onRequestMessageTemplate is required");const r=l==null?void 0:l.key;if(!r)throw new Error("Template key is missing");const{theme:u}=n.useMessengerThemeContext(),m=q({onRequestTemplate:a,onGetCachedTemplate:s,theme:u.selectedTheme,templateKey:r,variables:l==null?void 0:l.variables,viewVariables:l==null?void 0:l.view_variables,aiAgentColorVariables:u.aiAgentColorVariables});return V.createElement(P,{id:`${n.ID_INCOMING}-ext-message-template`},V.createElement(d.MessageProvider,{handleInternalAction:(o,g)=>{o.stopPropagation(),t==null||t(g)}},V.createElement(U,{templateItems:m.body.items,templateVersion:m.version})))},P=O.default.div`box-sizing:border-box;overflow:hidden;width:100%;`;exports.MessageTemplateWrapper=K;
|