@useago/sdk 1.7.2 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +175 -0
- package/README.md +96 -1
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +402 -5
- package/dist/angular.d.ts +402 -5
- package/dist/angular.js +11 -7
- package/dist/{createConversationSession-DP90nY71.js → createConversationSession-B1Qn-y0I.js} +3 -3
- package/dist/createConversationSession-B3v_xOU7.cjs +1 -0
- package/dist/createFormCollector-FvwDOqnV.cjs +1 -0
- package/dist/{createFormCollector-BivHRIAe.js → createFormCollector-m79zk_NA.js} +1 -1
- package/dist/createMockClient-BEOXI8yW.cjs +1 -0
- package/dist/{createMockClient-BDLW6tVc.js → createMockClient-Beao82tu.js} +31 -18
- package/dist/devtools.cjs +61 -12
- package/dist/devtools.d.cts +403 -5
- package/dist/devtools.d.ts +403 -5
- package/dist/devtools.js +225 -73
- package/dist/errors-BLfjXnLB.js +32 -0
- package/dist/errors-o1IB5fEu.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +489 -7
- package/dist/index.d.ts +489 -7
- package/dist/index.js +124 -118
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +510 -3
- package/dist/react.d.ts +510 -3
- package/dist/react.js +1036 -752
- package/dist/sheetController-BThJRtOu.cjs +1 -0
- package/dist/sheetController-aEKXIvjk.js +343 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +393 -3
- package/dist/testing.d.ts +393 -3
- package/dist/testing.js +1 -1
- package/dist/types-Ct1hlKwg.js +2408 -0
- package/dist/types-mcW8vB1U.cjs +10 -0
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +615 -3
- package/dist/vue.d.ts +615 -3
- package/dist/vue.js +202 -154
- package/dist/widget.cjs +6 -4
- package/dist/widget.d.cts +733 -5
- package/dist/widget.d.ts +733 -5
- package/dist/widget.js +3996 -786
- package/llms-full.txt +264 -31
- package/package.json +1 -1
- package/dist/AgoClient-7yXQ6R3O.cjs +0 -9
- package/dist/AgoClient-DTkBRGFE.js +0 -1965
- package/dist/createConversationSession-Bv6a15E0.cjs +0 -1
- package/dist/createFormCollector-CwfiYn0V.cjs +0 -1
- package/dist/createMockClient-BSNuN3ys.cjs +0 -1
- package/dist/sheetController-CBUVOroo.js +0 -205
- package/dist/sheetController-DY-sC13T.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=new WeakMap,M=["position","top","left","right","width"];function B(e,t){return t.map(r=>({style:e,prop:r,value:e.getPropertyValue(r),priority:e.getPropertyPriority(r)}))}function U(e){for(const{style:t,prop:r,value:n,priority:o}of e)n?t.setProperty(r,n,o):t.removeProperty(r)}function j(e,t=document){const r=p.get(t);if(r){r.owners.add(e);return}const n=t.body,o=t.documentElement,u=t.defaultView?.scrollY??0;p.set(t,{owners:new Set([e]),saved:[...B(n.style,M),...B(o.style,["overflow"])],scrollY:u}),n.style.position="fixed",n.style.top=`-${u}px`,n.style.left="0",n.style.right="0",n.style.width="100%",o.style.overflow="hidden"}function k(e,t=document){const r=p.get(t);!r||!r.owners.delete(e)||r.owners.size>0||(p.delete(t),U(r.saved),t.defaultView?.scrollTo(0,r.scrollY))}function L(e,t){const r=e.replace("#",""),n=Number.parseInt(r.substring(0,2),16),o=Number.parseInt(r.substring(2,4),16),u=Number.parseInt(r.substring(4,6),16),a=s=>Math.min(255,Math.round(s+(255-s)*(t/100))),c=s=>s.toString(16).padStart(2,"0");return`#${c(a(n))}${c(a(o))}${c(a(u))}`}function G(e){return/^#?[0-9A-F]{6}$/i.test(e)}function H(e,t,r){const n=(1-Math.abs(2*r-1))*t,o=(e%360+360)%360/60,u=o|0,a=n*(1-Math.abs(o%2-1)),[c,s,f]=[[n,a,0],[a,n,0],[0,n,a],[0,a,n],[a,0,n],[n,0,a]][u],b=r-n/2;return[Math.round((c+b)*255),Math.round((s+b)*255),Math.round((f+b)*255)]}function F(e){const t=e.trim(),r=/^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(t);if(r){const[a,c,s]=r.slice(1,4).map(Number);return[a,c,s].some(Number.isNaN)?null:H(a,Math.min(c,100)/100,Math.min(s,100)/100)}const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);if(n){const a=n.slice(1,4).map(Number);return a.some(c=>Number.isNaN(c)||c<0||c>255)?null:a}const o=t.replace("#",""),u=o.length===3?o.split("").map(a=>a+a).join(""):o;return/^[0-9a-f]{6}$/i.test(u)?[Number.parseInt(u.substring(0,2),16),Number.parseInt(u.substring(2,4),16),Number.parseInt(u.substring(4,6),16)]:null}function A(e){const t=F(e);if(!t)return null;const[r,n,o]=t.map(u=>{const a=u/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*r+.7152*n+.0722*o}function I(e,t){const r=A(e),n=A(t);return r===null||n===null?null:(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}var w=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;function K(e){return!!e&&w.test(e)}function X(e){return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi)??[]}function $(e){const t=e.trim().toLowerCase();if(t==="transparent")return!0;const r=/\/\s*([\d.]+)%?\s*\)$/.exec(t);if(r)return Number.parseFloat(r[1])===0;const n=/^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(t);if(n)return Number.parseFloat(n[1])===0;if(!t.startsWith("#"))return!1;const o=t.slice(1);return/^[0-9a-f]+$/.test(o)?o.length===8?o.slice(6)==="00":o.length===4?o[3]==="0":!1:!1}var d="#FFFFFF",W="#000000",Y="#FFFFFF";function D(e){if(!e)return d;const t=K(e)?X(e):[e],r=(t.some($)?[...t,Y]:t).map(n=>I(n,d)).filter(n=>n!==null);return r.length&&Math.min(...r)<3?W:d}var V='"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z=`var(--ago-font, ${V})`,x={font:"--ago-font",radius:"--ago-radius",messageRadius:"--ago-message-radius",brand:"--ago-brand-color",brandText:"--ago-brand-text-color",headerBg:"--ago-header-background",headerText:"--ago-header-text-color",panelBg:"--ago-panel-background",messagesBg:"--ago-messages-background",text:"--ago-text-color",mutedText:"--ago-muted-text-color",border:"--ago-border-color",accent:"--ago-accent-color",agentBubbleBg:"--ago-agent-bubble-background",agentBubbleText:"--ago-agent-bubble-text-color",userBubbleBg:"--ago-user-bubble-background",userBubbleText:"--ago-user-bubble-text-color",launcherBg:"--ago-launcher-background",launcherText:"--ago-launcher-text-color",sendBg:"--ago-send-button-background",panelWidth:"--ago-panel-width"},Q="var(--ago-brand-color, #03182f)",q="var(--ago-brand-text-color, #fff)",Z="var(--ago-header-background, var(--ago-brand-color, #03182f))",J="var(--ago-header-text-color, #e8f0fe)",ee="var(--ago-panel-background, #fff)",te="var(--ago-messages-background, #fbfbfb)",re="var(--ago-text-color, #30373e)",ne="var(--ago-muted-text-color, #6b6d6f)",ae="var(--ago-border-color, #dee3e8)",oe="var(--ago-accent-color, #1b5fc4)",ue="var(--ago-agent-bubble-background, #f1f3f5)",h="var(--ago-radius, 16px)",ie="var(--ago-message-radius, 16px)",ce="var(--ago-message-radius, 20px)",se="var(--ago-launcher-background, #007bff)",le="var(--ago-launcher-text-color, #fff)",fe="var(--ago-send-button-background, var(--ago-brand-color, #03182f))",be="var(--ago-user-bubble-background, #fff)",ge="var(--ago-user-bubble-text-color, #0a0a0a)",de="var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))",pe="var(--ago-panel-background, #f8faff)",me="var(--ago-accent-color, #003edf)",Ee="#e3edff",Oe="#e5e5e5",he="var(--ago-border-color, #e4e4e7)",ye="var(--ago-muted-text-color, #71717a)",Re="var(--ago-panel-width, 550px)",_e="0 1px 2px 0 rgba(0,0,0,0.05)",ve="0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",Be="0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",Ae="rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";function xe(e,t){if(t)for(const r of Object.keys(x)){const n=t[r];n!=null&&e.style.setProperty(x[r],n)}}function Te(e){if(!e)return{};const t={};return e.button&&(t.launcherBg=e.button,t.sendBg=e.button),e.header&&(t.headerBg=e.header,t.headerText=D(e.header)),e.agentMessage&&(t.agentBubbleBg=e.agentMessage),e.agentMessageFont&&(t.agentBubbleText=e.agentMessageFont),e.background&&(t.panelBg=e.background,t.messagesBg=e.background),e.font&&(t.text=e.font),e.userMessage&&(t.userBubbleBg=e.userMessage),e.userMessageFont&&(t.userBubbleText=e.userMessageFont),t}function S(e,t){Object.assign(e.style,t)}function De(e={}){const t=document.createElement("div");return S(t,e),t}var T="ago-chat-widget-keyframes";function Se(){if(typeof document>"u"||document.getElementById(T))return;const e=document.createElement("style");e.id=T,e.textContent="@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }",document.head.appendChild(e)}var Ne="2147483000";function Pe(e,t="0px"){return e===void 0?t:typeof e=="number"?`${e}px`:e}function N(e){return`(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`}function Ce(e={}){const t=e.breakpoint??768,r=e.peekHeight??152,n=Pe(e.bottomOffset),o=e.initialState??"peek",u=new Set;let a=o,c=!1;const s=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(N(t)):void 0;let f=m();const b=y(!1,o);function P(i,l){if(!i)return{style:{},attrs:{role:null,"aria-modal":null,"aria-label":null}};const v={position:"fixed",left:"0",right:"0",bottom:n,zIndex:Ne,display:"flex",flexDirection:"column",borderRadius:l==="full"?"0":`${h} ${h} 0 0`,paddingBottom:"env(safe-area-inset-bottom)"};return l==="full"?{style:{...v,top:"0",height:"auto",paddingTop:"env(safe-area-inset-top)"},attrs:{role:"dialog","aria-modal":"true",tabindex:"-1"}}:{style:{...v,top:"auto",minHeight:`calc(${r}px + env(safe-area-inset-bottom))`,height:"auto"},attrs:{role:null,"aria-modal":null,tabindex:"-1"}}}function y(i,l){return{compact:i,state:l,isModal:i&&l==="full",surface:P(i,l)}}function m(){return y(!!s?.matches,a)}function E(){f=m();for(const i of u)i()}function O(i,l){c||a===i||(a=i,E(),e.onStateChange?.(i,l))}function R(){if(!c){if(!s?.matches&&a!==o){a=o,E(),e.onStateChange?.(o,"breakpoint");return}E()}}let g=!1;function C(){g||!s||(s.addEventListener("change",R),g=!0,f=m())}function _(){!g||!s||(s.removeEventListener("change",R),g=!1)}return{subscribe(i){return u.add(i),u.size===1&&C(),()=>{u.delete(i),u.size===0&&_()}},getSnapshot:()=>f,getServerSnapshot:()=>b,expand:(i="api")=>O("full",i),collapse:(i="api")=>O("peek",i),toggle:(i="api")=>O(a==="full"?"peek":"full",i),destroy(){c||(c=!0,_(),u.clear())}}}Object.defineProperty(exports,"ACCENT_COLOR",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"AGENT_BUBBLE_BACKGROUND",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"AGENT_BUBBLE_TEXT",{enumerable:!0,get:function(){return de}});Object.defineProperty(exports,"BORDER_COLOR",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"BRAND_COLOR",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"BRAND_TEXT_COLOR",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"EMBED_BACKGROUND",{enumerable:!0,get:function(){return pe}});Object.defineProperty(exports,"EMBED_BORDER",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"EMBED_MUTED_TEXT",{enumerable:!0,get:function(){return ye}});Object.defineProperty(exports,"FONT_VAR",{enumerable:!0,get:function(){return z}});Object.defineProperty(exports,"HEADER_BACKGROUND",{enumerable:!0,get:function(){return Z}});Object.defineProperty(exports,"HEADER_TEXT_COLOR",{enumerable:!0,get:function(){return J}});Object.defineProperty(exports,"LAUNCHER_BACKGROUND",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"LAUNCHER_TEXT_COLOR",{enumerable:!0,get:function(){return le}});Object.defineProperty(exports,"MESSAGES_BACKGROUND",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"MESSAGE_RADIUS",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"MESSAGE_RADIUS_IMESSAGE",{enumerable:!0,get:function(){return ce}});Object.defineProperty(exports,"MUTED_TEXT_COLOR",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"NEUTRAL_BORDER",{enumerable:!0,get:function(){return Oe}});Object.defineProperty(exports,"PANEL_BACKGROUND",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"PANEL_SHADOW",{enumerable:!0,get:function(){return Ae}});Object.defineProperty(exports,"PANEL_WIDTH",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"PRIMARY_ACCENT",{enumerable:!0,get:function(){return me}});Object.defineProperty(exports,"PRIMARY_FOREGROUND",{enumerable:!0,get:function(){return Ee}});Object.defineProperty(exports,"RADIUS",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"SEND_BACKGROUND",{enumerable:!0,get:function(){return fe}});Object.defineProperty(exports,"SHADOW",{enumerable:!0,get:function(){return ve}});Object.defineProperty(exports,"SHADOW_MD",{enumerable:!0,get:function(){return Be}});Object.defineProperty(exports,"SHADOW_SM",{enumerable:!0,get:function(){return _e}});Object.defineProperty(exports,"TEXT_COLOR",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"USER_BUBBLE_BACKGROUND_EMBED",{enumerable:!0,get:function(){return be}});Object.defineProperty(exports,"USER_BUBBLE_TEXT_EMBED",{enumerable:!0,get:function(){return ge}});Object.defineProperty(exports,"applyTheme",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"colorsToTheme",{enumerable:!0,get:function(){return Te}});Object.defineProperty(exports,"compactMediaQuery",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"createSheetController",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"css",{enumerable:!0,get:function(){return S}});Object.defineProperty(exports,"div",{enumerable:!0,get:function(){return De}});Object.defineProperty(exports,"ensureKeyframes",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"isValidHexColor",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"lightenColor",{enumerable:!0,get:function(){return L}});Object.defineProperty(exports,"lockBackgroundScroll",{enumerable:!0,get:function(){return j}});Object.defineProperty(exports,"readableTextColor",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"unlockBackgroundScroll",{enumerable:!0,get:function(){return k}});
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
var p = /* @__PURE__ */ new WeakMap(), N = [
|
|
2
|
+
"position",
|
|
3
|
+
"top",
|
|
4
|
+
"left",
|
|
5
|
+
"right",
|
|
6
|
+
"width"
|
|
7
|
+
];
|
|
8
|
+
function T(e, a) {
|
|
9
|
+
return a.map((t) => ({
|
|
10
|
+
style: e,
|
|
11
|
+
prop: t,
|
|
12
|
+
value: e.getPropertyValue(t),
|
|
13
|
+
priority: e.getPropertyPriority(t)
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
function k(e) {
|
|
17
|
+
for (const { style: a, prop: t, value: r, priority: o } of e) r ? a.setProperty(t, r, o) : a.removeProperty(t);
|
|
18
|
+
}
|
|
19
|
+
function V(e, a = document) {
|
|
20
|
+
const t = p.get(a);
|
|
21
|
+
if (t) {
|
|
22
|
+
t.owners.add(e);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const r = a.body, o = a.documentElement, s = a.defaultView?.scrollY ?? 0;
|
|
26
|
+
p.set(a, {
|
|
27
|
+
owners: /* @__PURE__ */ new Set([e]),
|
|
28
|
+
saved: [...T(r.style, N), ...T(o.style, ["overflow"])],
|
|
29
|
+
scrollY: s
|
|
30
|
+
}), r.style.position = "fixed", r.style.top = `-${s}px`, r.style.left = "0", r.style.right = "0", r.style.width = "100%", o.style.overflow = "hidden";
|
|
31
|
+
}
|
|
32
|
+
function z(e, a = document) {
|
|
33
|
+
const t = p.get(a);
|
|
34
|
+
!t || !t.owners.delete(e) || t.owners.size > 0 || (p.delete(a), k(t.saved), a.defaultView?.scrollTo(0, t.scrollY));
|
|
35
|
+
}
|
|
36
|
+
function j(e, a) {
|
|
37
|
+
const t = e.replace("#", ""), r = Number.parseInt(t.substring(0, 2), 16), o = Number.parseInt(t.substring(2, 4), 16), s = Number.parseInt(t.substring(4, 6), 16), n = (u) => Math.min(255, Math.round(u + (255 - u) * (a / 100))), l = (u) => u.toString(16).padStart(2, "0");
|
|
38
|
+
return `#${l(n(r))}${l(n(o))}${l(n(s))}`;
|
|
39
|
+
}
|
|
40
|
+
function q(e) {
|
|
41
|
+
return /^#?[0-9A-F]{6}$/i.test(e);
|
|
42
|
+
}
|
|
43
|
+
function O(e, a, t) {
|
|
44
|
+
const r = (1 - Math.abs(2 * t - 1)) * a, o = (e % 360 + 360) % 360 / 60, s = o | 0, n = r * (1 - Math.abs(o % 2 - 1)), [l, u, g] = [
|
|
45
|
+
[
|
|
46
|
+
r,
|
|
47
|
+
n,
|
|
48
|
+
0
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
n,
|
|
52
|
+
r,
|
|
53
|
+
0
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
0,
|
|
57
|
+
r,
|
|
58
|
+
n
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
0,
|
|
62
|
+
n,
|
|
63
|
+
r
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
n,
|
|
67
|
+
0,
|
|
68
|
+
r
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
r,
|
|
72
|
+
0,
|
|
73
|
+
n
|
|
74
|
+
]
|
|
75
|
+
][s], f = t - r / 2;
|
|
76
|
+
return [
|
|
77
|
+
Math.round((l + f) * 255),
|
|
78
|
+
Math.round((u + f) * 255),
|
|
79
|
+
Math.round((g + f) * 255)
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
function C(e) {
|
|
83
|
+
const a = e.trim(), t = /^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(a);
|
|
84
|
+
if (t) {
|
|
85
|
+
const [n, l, u] = t.slice(1, 4).map(Number);
|
|
86
|
+
return [
|
|
87
|
+
n,
|
|
88
|
+
l,
|
|
89
|
+
u
|
|
90
|
+
].some(Number.isNaN) ? null : O(n, Math.min(l, 100) / 100, Math.min(u, 100) / 100);
|
|
91
|
+
}
|
|
92
|
+
const r = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(a);
|
|
93
|
+
if (r) {
|
|
94
|
+
const n = r.slice(1, 4).map(Number);
|
|
95
|
+
return n.some((l) => Number.isNaN(l) || l < 0 || l > 255) ? null : n;
|
|
96
|
+
}
|
|
97
|
+
const o = a.replace("#", ""), s = o.length === 3 ? o.split("").map((n) => n + n).join("") : o;
|
|
98
|
+
return /^[0-9a-f]{6}$/i.test(s) ? [
|
|
99
|
+
Number.parseInt(s.substring(0, 2), 16),
|
|
100
|
+
Number.parseInt(s.substring(2, 4), 16),
|
|
101
|
+
Number.parseInt(s.substring(4, 6), 16)
|
|
102
|
+
] : null;
|
|
103
|
+
}
|
|
104
|
+
function _(e) {
|
|
105
|
+
const a = C(e);
|
|
106
|
+
if (!a) return null;
|
|
107
|
+
const [t, r, o] = a.map((s) => {
|
|
108
|
+
const n = s / 255;
|
|
109
|
+
return n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
|
|
110
|
+
});
|
|
111
|
+
return 0.2126 * t + 0.7152 * r + 0.0722 * o;
|
|
112
|
+
}
|
|
113
|
+
function F(e, a) {
|
|
114
|
+
const t = _(e), r = _(a);
|
|
115
|
+
return t === null || r === null ? null : (Math.max(t, r) + 0.05) / (Math.min(t, r) + 0.05);
|
|
116
|
+
}
|
|
117
|
+
var L = /(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;
|
|
118
|
+
function U(e) {
|
|
119
|
+
return !!e && L.test(e);
|
|
120
|
+
}
|
|
121
|
+
function w(e) {
|
|
122
|
+
return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi) ?? [];
|
|
123
|
+
}
|
|
124
|
+
function I(e) {
|
|
125
|
+
const a = e.trim().toLowerCase();
|
|
126
|
+
if (a === "transparent") return !0;
|
|
127
|
+
const t = /\/\s*([\d.]+)%?\s*\)$/.exec(a);
|
|
128
|
+
if (t) return Number.parseFloat(t[1]) === 0;
|
|
129
|
+
const r = /^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(a);
|
|
130
|
+
if (r) return Number.parseFloat(r[1]) === 0;
|
|
131
|
+
if (!a.startsWith("#")) return !1;
|
|
132
|
+
const o = a.slice(1);
|
|
133
|
+
return /^[0-9a-f]+$/.test(o) ? o.length === 8 ? o.slice(6) === "00" : o.length === 4 ? o[3] === "0" : !1 : !1;
|
|
134
|
+
}
|
|
135
|
+
var b = "#FFFFFF", H = "#000000", G = "#FFFFFF";
|
|
136
|
+
function P(e) {
|
|
137
|
+
if (!e) return b;
|
|
138
|
+
const a = U(e) ? w(e) : [e], t = (a.some(I) ? [...a, G] : a).map((r) => F(r, b)).filter((r) => r !== null);
|
|
139
|
+
return t.length && Math.min(...t) < 3 ? H : b;
|
|
140
|
+
}
|
|
141
|
+
var $ = '"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', Q = `var(--ago-font, ${$})`, y = {
|
|
142
|
+
font: "--ago-font",
|
|
143
|
+
radius: "--ago-radius",
|
|
144
|
+
messageRadius: "--ago-message-radius",
|
|
145
|
+
brand: "--ago-brand-color",
|
|
146
|
+
brandText: "--ago-brand-text-color",
|
|
147
|
+
headerBg: "--ago-header-background",
|
|
148
|
+
headerText: "--ago-header-text-color",
|
|
149
|
+
panelBg: "--ago-panel-background",
|
|
150
|
+
messagesBg: "--ago-messages-background",
|
|
151
|
+
text: "--ago-text-color",
|
|
152
|
+
mutedText: "--ago-muted-text-color",
|
|
153
|
+
border: "--ago-border-color",
|
|
154
|
+
accent: "--ago-accent-color",
|
|
155
|
+
agentBubbleBg: "--ago-agent-bubble-background",
|
|
156
|
+
agentBubbleText: "--ago-agent-bubble-text-color",
|
|
157
|
+
userBubbleBg: "--ago-user-bubble-background",
|
|
158
|
+
userBubbleText: "--ago-user-bubble-text-color",
|
|
159
|
+
launcherBg: "--ago-launcher-background",
|
|
160
|
+
launcherText: "--ago-launcher-text-color",
|
|
161
|
+
sendBg: "--ago-send-button-background",
|
|
162
|
+
panelWidth: "--ago-panel-width"
|
|
163
|
+
}, Z = "var(--ago-brand-color, #03182f)", J = "var(--ago-brand-text-color, #fff)", ee = "var(--ago-header-background, var(--ago-brand-color, #03182f))", ae = "var(--ago-header-text-color, #e8f0fe)", te = "var(--ago-panel-background, #fff)", re = "var(--ago-messages-background, #fbfbfb)", ne = "var(--ago-text-color, #30373e)", oe = "var(--ago-muted-text-color, #6b6d6f)", se = "var(--ago-border-color, #dee3e8)", ie = "var(--ago-accent-color, #1b5fc4)", le = "var(--ago-agent-bubble-background, #f1f3f5)", A = "var(--ago-radius, 16px)", ue = "var(--ago-message-radius, 16px)", ce = "var(--ago-message-radius, 20px)", ge = "var(--ago-launcher-background, #007bff)", fe = "var(--ago-launcher-text-color, #fff)", de = "var(--ago-send-button-background, var(--ago-brand-color, #03182f))", be = "var(--ago-user-bubble-background, #fff)", pe = "var(--ago-user-bubble-text-color, #0a0a0a)", he = "var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))", me = "var(--ago-panel-background, #f8faff)", ve = "var(--ago-accent-color, #003edf)", xe = "#e3edff", Ee = "#e5e5e5", Be = "var(--ago-border-color, #e4e4e7)", Re = "var(--ago-muted-text-color, #71717a)", Te = "var(--ago-panel-width, 550px)", _e = "0 1px 2px 0 rgba(0,0,0,0.05)", ye = "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)", Ae = "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)", Me = "rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";
|
|
164
|
+
function De(e, a) {
|
|
165
|
+
if (a)
|
|
166
|
+
for (const t of Object.keys(y)) {
|
|
167
|
+
const r = a[t];
|
|
168
|
+
r != null && e.style.setProperty(y[t], r);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function Se(e) {
|
|
172
|
+
if (!e) return {};
|
|
173
|
+
const a = {};
|
|
174
|
+
return e.button && (a.launcherBg = e.button, a.sendBg = e.button), e.header && (a.headerBg = e.header, a.headerText = P(e.header)), e.agentMessage && (a.agentBubbleBg = e.agentMessage), e.agentMessageFont && (a.agentBubbleText = e.agentMessageFont), e.background && (a.panelBg = e.background, a.messagesBg = e.background), e.font && (a.text = e.font), e.userMessage && (a.userBubbleBg = e.userMessage), e.userMessageFont && (a.userBubbleText = e.userMessageFont), a;
|
|
175
|
+
}
|
|
176
|
+
function K(e, a) {
|
|
177
|
+
Object.assign(e.style, a);
|
|
178
|
+
}
|
|
179
|
+
function Ne(e = {}) {
|
|
180
|
+
const a = document.createElement("div");
|
|
181
|
+
return K(a, e), a;
|
|
182
|
+
}
|
|
183
|
+
var M = "ago-chat-widget-keyframes";
|
|
184
|
+
function ke() {
|
|
185
|
+
if (typeof document > "u" || document.getElementById(M)) return;
|
|
186
|
+
const e = document.createElement("style");
|
|
187
|
+
e.id = M, e.textContent = "@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }", document.head.appendChild(e);
|
|
188
|
+
}
|
|
189
|
+
var X = "2147483000";
|
|
190
|
+
function W(e, a = "0px") {
|
|
191
|
+
return e === void 0 ? a : typeof e == "number" ? `${e}px` : e;
|
|
192
|
+
}
|
|
193
|
+
function Y(e) {
|
|
194
|
+
return `(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`;
|
|
195
|
+
}
|
|
196
|
+
function Oe(e = {}) {
|
|
197
|
+
const a = e.breakpoint ?? 768, t = e.peekHeight ?? 152, r = W(e.bottomOffset), o = e.initialState ?? "peek", s = /* @__PURE__ */ new Set();
|
|
198
|
+
let n = o, l = !1;
|
|
199
|
+
const u = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(Y(a)) : void 0;
|
|
200
|
+
let g = h();
|
|
201
|
+
const f = x(!1, o);
|
|
202
|
+
function D(i, c) {
|
|
203
|
+
if (!i) return {
|
|
204
|
+
style: {},
|
|
205
|
+
attrs: {
|
|
206
|
+
role: null,
|
|
207
|
+
"aria-modal": null,
|
|
208
|
+
"aria-label": null
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const R = {
|
|
212
|
+
position: "fixed",
|
|
213
|
+
left: "0",
|
|
214
|
+
right: "0",
|
|
215
|
+
bottom: r,
|
|
216
|
+
zIndex: X,
|
|
217
|
+
display: "flex",
|
|
218
|
+
flexDirection: "column",
|
|
219
|
+
borderRadius: c === "full" ? "0" : `${A} ${A} 0 0`,
|
|
220
|
+
paddingBottom: "env(safe-area-inset-bottom)"
|
|
221
|
+
};
|
|
222
|
+
return c === "full" ? {
|
|
223
|
+
style: {
|
|
224
|
+
...R,
|
|
225
|
+
top: "0",
|
|
226
|
+
height: "auto",
|
|
227
|
+
paddingTop: "env(safe-area-inset-top)"
|
|
228
|
+
},
|
|
229
|
+
attrs: {
|
|
230
|
+
role: "dialog",
|
|
231
|
+
"aria-modal": "true",
|
|
232
|
+
tabindex: "-1"
|
|
233
|
+
}
|
|
234
|
+
} : {
|
|
235
|
+
style: {
|
|
236
|
+
...R,
|
|
237
|
+
top: "auto",
|
|
238
|
+
minHeight: `calc(${t}px + env(safe-area-inset-bottom))`,
|
|
239
|
+
height: "auto"
|
|
240
|
+
},
|
|
241
|
+
attrs: {
|
|
242
|
+
role: null,
|
|
243
|
+
"aria-modal": null,
|
|
244
|
+
tabindex: "-1"
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function x(i, c) {
|
|
249
|
+
return {
|
|
250
|
+
compact: i,
|
|
251
|
+
state: c,
|
|
252
|
+
isModal: i && c === "full",
|
|
253
|
+
surface: D(i, c)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function h() {
|
|
257
|
+
return x(!!u?.matches, n);
|
|
258
|
+
}
|
|
259
|
+
function m() {
|
|
260
|
+
g = h();
|
|
261
|
+
for (const i of s) i();
|
|
262
|
+
}
|
|
263
|
+
function v(i, c) {
|
|
264
|
+
l || n === i || (n = i, m(), e.onStateChange?.(i, c));
|
|
265
|
+
}
|
|
266
|
+
function E() {
|
|
267
|
+
if (!l) {
|
|
268
|
+
if (!u?.matches && n !== o) {
|
|
269
|
+
n = o, m(), e.onStateChange?.(o, "breakpoint");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
m();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
let d = !1;
|
|
276
|
+
function S() {
|
|
277
|
+
d || !u || (u.addEventListener("change", E), d = !0, g = h());
|
|
278
|
+
}
|
|
279
|
+
function B() {
|
|
280
|
+
!d || !u || (u.removeEventListener("change", E), d = !1);
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
subscribe(i) {
|
|
284
|
+
return s.add(i), s.size === 1 && S(), () => {
|
|
285
|
+
s.delete(i), s.size === 0 && B();
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
getSnapshot: () => g,
|
|
289
|
+
getServerSnapshot: () => f,
|
|
290
|
+
expand: (i = "api") => v("full", i),
|
|
291
|
+
collapse: (i = "api") => v("peek", i),
|
|
292
|
+
toggle: (i = "api") => v(n === "full" ? "peek" : "full", i),
|
|
293
|
+
destroy() {
|
|
294
|
+
l || (l = !0, B(), s.clear());
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
export {
|
|
299
|
+
Ae as A,
|
|
300
|
+
q as B,
|
|
301
|
+
Me as C,
|
|
302
|
+
A as D,
|
|
303
|
+
xe as E,
|
|
304
|
+
De as F,
|
|
305
|
+
P as H,
|
|
306
|
+
Se as I,
|
|
307
|
+
K as L,
|
|
308
|
+
ne as M,
|
|
309
|
+
be as N,
|
|
310
|
+
de as O,
|
|
311
|
+
pe as P,
|
|
312
|
+
Ne as R,
|
|
313
|
+
te as S,
|
|
314
|
+
ve as T,
|
|
315
|
+
V as U,
|
|
316
|
+
j as V,
|
|
317
|
+
z as W,
|
|
318
|
+
re as _,
|
|
319
|
+
he as a,
|
|
320
|
+
oe as b,
|
|
321
|
+
J as c,
|
|
322
|
+
Re as d,
|
|
323
|
+
Q as f,
|
|
324
|
+
fe as g,
|
|
325
|
+
ge as h,
|
|
326
|
+
le as i,
|
|
327
|
+
_e as j,
|
|
328
|
+
ye as k,
|
|
329
|
+
me as l,
|
|
330
|
+
ae as m,
|
|
331
|
+
Oe as n,
|
|
332
|
+
se as o,
|
|
333
|
+
ee as p,
|
|
334
|
+
ie as r,
|
|
335
|
+
Z as s,
|
|
336
|
+
Y as t,
|
|
337
|
+
Be as u,
|
|
338
|
+
ue as v,
|
|
339
|
+
Te as w,
|
|
340
|
+
Ee as x,
|
|
341
|
+
ce as y,
|
|
342
|
+
ke as z
|
|
343
|
+
};
|
package/dist/testing.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createMockClient-BEOXI8yW.cjs");exports.createMockClient=e.createMockClient;
|