@pagelines/sdk 1.0.681 → 1.0.683

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.
Files changed (100) hide show
  1. package/dist/AgentProvider.js +701 -0
  2. package/dist/AgentProvider.js.map +1 -0
  3. package/dist/AgentWidgetInline.js +44 -32
  4. package/dist/AgentWidgetInline.js.map +1 -1
  5. package/dist/AgentWidgetModal.js +75 -64
  6. package/dist/AgentWidgetModal.js.map +1 -1
  7. package/dist/AgentWrap.js +5180 -0
  8. package/dist/AgentWrap.js.map +1 -0
  9. package/dist/FModal.js +165 -0
  10. package/dist/FModal.js.map +1 -0
  11. package/dist/agent/ui/AgentChat.vue.d.ts +3 -4
  12. package/dist/agent/ui/AgentInputEmail.vue.d.ts +3 -2
  13. package/dist/agent/ui/AgentInputOneTimeCode.vue.d.ts +3 -4
  14. package/dist/agent/ui/AgentModal.vue.d.ts +2 -1
  15. package/dist/agent/ui/AgentProvider.vue.d.ts +2 -1
  16. package/dist/agent/ui/AgentSidebarClose.vue.d.ts +3 -2
  17. package/dist/agent/ui/AgentToolActivityGroup.vue.d.ts +2 -1
  18. package/dist/agent/ui/AgentWidget.vue.d.ts +3 -2
  19. package/dist/agent/ui/AgentWrap.vue.d.ts +14 -29
  20. package/dist/agent/ui/ChatRichText.vue.d.ts +2 -1
  21. package/dist/agent/ui/ChatScroller.vue.d.ts +8 -18
  22. package/dist/agent/ui/ChatVisualBlock.vue.d.ts +2 -3
  23. package/dist/agent/ui/ElAgentAbout.vue.d.ts +2 -1
  24. package/dist/agent/ui/ElAgentButton.vue.d.ts +7 -11
  25. package/dist/agent/ui/ElAgentChat.vue.d.ts +2 -53
  26. package/dist/agent/ui/ElAgentChatPreview.vue.d.ts +2 -1
  27. package/dist/agent/ui/ElAgentHeader.vue.d.ts +2 -1
  28. package/dist/agent/ui/ElAgentModeSidebar.vue.d.ts +2 -1
  29. package/dist/agent/ui/ElAgentSidebar.vue.d.ts +2 -1
  30. package/dist/agent/ui/ElAuthGate.vue.d.ts +2 -1
  31. package/dist/agent/ui/ElAuthPanel.vue.d.ts +2 -1
  32. package/dist/agent/ui/ElCreateAgent.vue.d.ts +3 -2
  33. package/dist/agent/ui/ElModeHeader.vue.d.ts +2 -1
  34. package/dist/agent/ui/ElProvisioningStatus.vue.d.ts +3 -2
  35. package/dist/agent/ui/ElSidebar.vue.d.ts +9 -12
  36. package/dist/agent/ui/ElTrialGate.vue.d.ts +2 -1
  37. package/dist/agent.js +157 -186
  38. package/dist/agent.js.map +1 -1
  39. package/dist/constants.js +80 -0
  40. package/dist/constants.js.map +1 -0
  41. package/dist/contract.js +6284 -0
  42. package/dist/contract.js.map +1 -0
  43. package/dist/demo.js +242 -259
  44. package/dist/demo.js.map +1 -1
  45. package/dist/rolldown-runtime.js +14 -0
  46. package/dist/sdk.css +2 -1
  47. package/dist/sdk.js +4 -14
  48. package/dist/sdkClient.js +775 -867
  49. package/dist/sdkClient.js.map +1 -1
  50. package/dist/ui/EffectTransitionList.vue.d.ts +7 -11
  51. package/dist/ui/FClose.vue.d.ts +3 -2
  52. package/dist/ui/FModal.vue.d.ts +7 -5
  53. package/dist/ui/FSpinner.vue.d.ts +3 -2
  54. package/dist/useWidgetState.js +21 -0
  55. package/dist/useWidgetState.js.map +1 -0
  56. package/dist/widget/ui/AgentWidgetInline.vue.d.ts +2 -1
  57. package/dist/widget/ui/AgentWidgetModal.vue.d.ts +2 -1
  58. package/dist/widget/ui/AgentWidgetOnboard.vue.d.ts +2 -1
  59. package/dist/widget/ui/AgentWidgetPopup.vue.d.ts +3 -2
  60. package/dist/widget.js +717 -7
  61. package/dist/widget.js.map +1 -1
  62. package/package.json +25 -25
  63. package/dist/AgentProvider.vue_vue_type_script_setup_true_lang.js +0 -842
  64. package/dist/AgentProvider.vue_vue_type_script_setup_true_lang.js.map +0 -1
  65. package/dist/AgentWidgetOnboard.js +0 -5
  66. package/dist/AgentWidgetOnboard.js.map +0 -1
  67. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js +0 -4952
  68. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +0 -1
  69. package/dist/FModal.vue_vue_type_script_setup_true_lang.js +0 -181
  70. package/dist/FModal.vue_vue_type_script_setup_true_lang.js.map +0 -1
  71. package/dist/agent/test/AgentController.test.d.ts +0 -1
  72. package/dist/agent/test/AgentToolActivityGroup.client.test.d.ts +0 -1
  73. package/dist/agent/test/ChatRichText.client.test.d.ts +0 -1
  74. package/dist/agent/test/ChatVisualBlock.client.test.d.ts +0 -1
  75. package/dist/agent/test/ElAgentChat.client.test.d.ts +0 -1
  76. package/dist/agent/test/ElAgentChatPreview.client.test.d.ts +0 -1
  77. package/dist/agent/test/VoiceRecorderController.unit.test.d.ts +0 -1
  78. package/dist/agent/test/auth-inputs.test.d.ts +0 -1
  79. package/dist/agent/test/chat-visual-format.unit.test.d.ts +0 -1
  80. package/dist/agent/test/utils.test.d.ts +0 -1
  81. package/dist/agent/test/webhook.test.d.ts +0 -1
  82. package/dist/contract/regenerate.d.ts +0 -2
  83. package/dist/contract/test/build.unit.test.d.ts +0 -1
  84. package/dist/contract/test/conversation-wire-shapes.unit.test.d.ts +0 -14
  85. package/dist/contract/test/snapshot.unit.test.d.ts +0 -1
  86. package/dist/index.js +0 -871
  87. package/dist/index.js.map +0 -1
  88. package/dist/sdk.js.map +0 -1
  89. package/dist/socialPlatforms.js +0 -82
  90. package/dist/socialPlatforms.js.map +0 -1
  91. package/dist/test/agent-client.test.d.ts +0 -4
  92. package/dist/test/api.test.d.ts +0 -1
  93. package/dist/test/billing-client.test.d.ts +0 -4
  94. package/dist/test/build.test.d.ts +0 -1
  95. package/dist/test/chat-authenticated.test.d.ts +0 -1
  96. package/dist/test/chat-issue-presentation.test.d.ts +0 -1
  97. package/dist/test/derive-mode.test.d.ts +0 -1
  98. package/dist/test/sdk-token-capture.test.d.ts +0 -13
  99. package/dist/vite.config.sdk.d.ts +0 -2
  100. package/dist/vitest.config.d.ts +0 -2
@@ -0,0 +1,701 @@
1
+ import "./rolldown-runtime.js";
2
+ import { SOCIAL_PLATFORMS as e } from "./constants.js";
3
+ import { a as t, c as n, d as r, f as i, i as a, l as o, m as s, n as c, o as l, s as u, t as d, u as ee } from "./AgentWrap.js";
4
+ import { getColorSchemeOklch as te } from "@pagelines/core";
5
+ import { Fragment as f, Transition as p, TransitionGroup as m, computed as h, createBlock as g, createCommentVNode as _, createElementBlock as v, createElementVNode as y, createTextVNode as b, createVNode as x, defineComponent as S, mergeProps as C, normalizeClass as w, normalizeStyle as T, onMounted as E, onUnmounted as D, openBlock as O, ref as k, renderList as A, renderSlot as j, shallowRef as ne, toDisplayString as M, unref as N, watch as P, withCtx as F, withKeys as I, withModifiers as L } from "vue";
6
+ //#endregion
7
+ //#region ui/EffectTransitionList.vue
8
+ var R = /* @__PURE__ */ S({
9
+ __name: "EffectTransitionList",
10
+ props: {
11
+ disabled: {
12
+ type: Boolean,
13
+ default: !1
14
+ },
15
+ mode: { default: "block" }
16
+ },
17
+ setup(e) {
18
+ return (t, n) => (O(), g(m, { name: e.disabled ? "" : "nlist" }, {
19
+ default: F(() => [j(t.$slots, "default")]),
20
+ _: 3
21
+ }, 8, ["name"]));
22
+ }
23
+ }), z = ["data-test-mode"], B = { class: "w-full max-w-xs space-y-12" }, V = {
24
+ key: 0,
25
+ class: "text-xs text-theme-400 text-center"
26
+ }, H = { class: "text-base font-light text-white text-center" }, U = { class: "space-y-6 relative" }, W = {
27
+ key: "email-field",
28
+ class: "w-full"
29
+ }, re = {
30
+ key: "code-field",
31
+ class: "w-full"
32
+ }, G = /* @__PURE__ */ S({
33
+ __name: "ElAuthGate",
34
+ props: { sdk: {} },
35
+ setup(e) {
36
+ let n = k({
37
+ email: "",
38
+ code: ""
39
+ }), r = k("email"), i = k(!1), a = {
40
+ email: {
41
+ title: "Enter Your Email",
42
+ button: {
43
+ label: "Continue",
44
+ disabled: () => !n.value.email || i.value
45
+ },
46
+ action: async () => {
47
+ if (!i.value) {
48
+ i.value = !0;
49
+ try {
50
+ await e.sdk.auth.requestAuthCode({ email: n.value.email }) && (r.value = "code");
51
+ } finally {
52
+ i.value = !1;
53
+ }
54
+ }
55
+ }
56
+ },
57
+ code: {
58
+ title: "Enter Verification Code",
59
+ button: {
60
+ label: "Verify",
61
+ disabled: () => n.value.code.length !== 6 || i.value
62
+ },
63
+ action: async () => {
64
+ if (!i.value) {
65
+ i.value = !0;
66
+ try {
67
+ await e.sdk.auth.loginWithCode({
68
+ email: n.value.email,
69
+ code: n.value.code
70
+ });
71
+ } finally {
72
+ i.value = !1;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }, o = h(() => a[r.value]);
78
+ return P(() => e.sdk.activeUser.value, (e) => {
79
+ e && r.value === "code" && console.log("[ElAuthGate] Authentication successful", { email: e.email });
80
+ }), (i, a) => (O(), v("div", {
81
+ "data-test": "auth-form",
82
+ "data-test-mode": r.value,
83
+ class: "flex flex-col items-center justify-center h-full p-6"
84
+ }, [y("div", B, [
85
+ e.sdk.error.value ? (O(), v("p", V, M(e.sdk.error.value), 1)) : _("", !0),
86
+ y("h3", H, M(o.value.title), 1),
87
+ y("div", U, [x(R, null, {
88
+ default: F(() => [r.value === "email" ? (O(), v("div", W, [x(l, {
89
+ modelValue: n.value.email,
90
+ "onUpdate:modelValue": a[0] || (a[0] = (e) => n.value.email = e),
91
+ "data-test": "auth-email-input",
92
+ onKeyup: I(o.value.action, ["enter"])
93
+ }, null, 8, ["modelValue", "onKeyup"])])) : (O(), v("div", re, [x(t, {
94
+ modelValue: n.value.code,
95
+ "onUpdate:modelValue": a[1] || (a[1] = (e) => n.value.code = e),
96
+ length: 6,
97
+ "focus-first": !0,
98
+ "data-test": "auth-code-input",
99
+ onAutoSubmit: o.value.action
100
+ }, null, 8, ["modelValue", "onAutoSubmit"])])), (O(), v("div", {
101
+ key: o.value.button.label,
102
+ class: "space-y-4 w-full"
103
+ }, [x(u, {
104
+ theme: "primary",
105
+ size: "md",
106
+ class: "w-full",
107
+ "data-test": "auth-submit",
108
+ loading: e.sdk.loading.value,
109
+ disabled: o.value.button.disabled() || e.sdk.loading.value,
110
+ onClick: o.value.action
111
+ }, {
112
+ default: F(() => [b(M(o.value.button.label), 1)]),
113
+ _: 1
114
+ }, 8, [
115
+ "loading",
116
+ "disabled",
117
+ "onClick"
118
+ ]), r.value === "code" ? (O(), v("button", {
119
+ key: 0,
120
+ class: "w-full text-xs text-white/50 hover:text-white/70 transition-colors py-2",
121
+ onClick: a[2] || (a[2] = (e) => r.value = "email")
122
+ }, " Change Email ")) : _("", !0)]))]),
123
+ _: 1
124
+ })])
125
+ ])], 8, z));
126
+ }
127
+ }), K = { class: "flex-1 flex flex-col min-h-0 py-6 space-y-6 h-full overflow-scroll [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden relative" }, q = { class: "flex-1 space-y-6 pb-12" }, J = {
128
+ key: 0,
129
+ class: "text-sm bg-white/10 backdrop-blur-sm rounded-2xl p-4 border border-white/20 space-y-3"
130
+ }, Y = ["innerHTML"], X = {
131
+ key: 1,
132
+ class: "bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"
133
+ }, ie = { class: "text-sm text-white/70 leading-relaxed" }, ae = {
134
+ key: 2,
135
+ class: "space-y-3"
136
+ }, oe = ["href"], se = {
137
+ key: 3,
138
+ class: "space-y-3"
139
+ }, ce = { class: "grid grid-cols-2 gap-3" }, le = ["href"], ue = /* @__PURE__ */ S({
140
+ __name: "ElAgentAbout",
141
+ props: {
142
+ agent: {},
143
+ isOnline: {
144
+ type: Boolean,
145
+ default: !1
146
+ }
147
+ },
148
+ setup(t) {
149
+ return (n, r) => (O(), v("div", K, [x(a, {
150
+ agent: t.agent,
151
+ "is-online": t.isOnline
152
+ }, null, 8, ["agent", "is-online"]), y("div", q, [
153
+ t.agent.summary.value ? (O(), v("div", J, [r[0] || (r[0] = y("h3", { class: "font-medium text-white/50" }, " About ", -1)), y("div", {
154
+ class: "text-white/70 leading-relaxed",
155
+ innerHTML: t.agent.summary.value
156
+ }, null, 8, Y)])) : _("", !0),
157
+ t.agent.entityType.value === "company" ? (O(), v("div", X, [r[1] || (r[1] = y("h3", { class: "text-sm font-medium text-white/90 mb-2" }, " Company Info ", -1)), y("p", ie, " This is a company agent representing " + M(t.agent.name.value) + ". ", 1)])) : _("", !0),
158
+ t.agent.email.value ? (O(), v("div", ae, [r[3] || (r[3] = y("h3", { class: "text-sm font-medium text-white/90" }, " Contact ", -1)), y("a", {
159
+ href: `mailto:${t.agent.email.value}`,
160
+ target: "_blank",
161
+ rel: "noopener noreferrer",
162
+ class: "relative inline-flex items-center justify-center gap-2 rounded-full px-4 py-2 font-medium transition-colors duration-200 focus:outline-none active:opacity-80 cursor-pointer bg-white/5 hover:bg-white/10 border border-white/10 text-white/80 text-sm justify-start h-10 w-full"
163
+ }, [...r[2] || (r[2] = [y("span", { class: "i-heroicons-envelope flex items-center size-[1.1em] mt-[-.07em]" }, null, -1), b(" Email ", -1)])], 8, oe)])) : _("", !0),
164
+ t.agent.accounts.value && t.agent.accounts.value.length > 0 ? (O(), v("div", se, [r[4] || (r[4] = y("h3", { class: "text-sm font-medium text-white/90" }, " Links ", -1)), y("div", ce, [(O(!0), v(f, null, A(t.agent.accounts.value, (t) => (O(), v("a", {
165
+ key: `${t.platform}-${t.handle}`,
166
+ href: N(e)[t.platform].getUrl(t.handle),
167
+ target: "_blank",
168
+ rel: "noopener noreferrer",
169
+ class: "relative inline-flex items-center justify-center gap-2 rounded-full px-4 py-2 font-medium transition-colors duration-200 focus:outline-none active:opacity-80 cursor-pointer bg-white/10 hover:bg-white/20 border border-white/20 text-white/80 text-sm"
170
+ }, [y("span", { class: w(["flex items-center size-[1.1em] mt-[-.07em]", N(e)[t.platform].icon]) }, null, 2), b(" " + M(N(e)[t.platform].label), 1)], 8, le))), 128))])])) : _("", !0)
171
+ ])]));
172
+ }
173
+ }), de = { class: "flex flex-col items-center text-center gap-4" }, fe = { class: "relative flex-shrink-0" }, pe = { class: "w-20 h-20 sm:w-24 sm:h-24 rounded-full overflow-hidden border-4 border-white" }, me = ["src", "alt"], he = { class: "absolute top-1.5 right-1.5" }, ge = {
174
+ key: 1,
175
+ class: "size-4 bg-theme-400 rounded-full ring-2 ring-white"
176
+ }, _e = { class: "min-w-0" }, ve = { class: "text-3xl font-light text-white mb-2 truncate" }, ye = { class: "text-base font-light text-white/60 line-clamp-1" }, be = /* @__PURE__ */ S({
177
+ __name: "ElAgentHeader",
178
+ props: {
179
+ agent: {},
180
+ isOnline: {
181
+ type: Boolean,
182
+ default: !1
183
+ }
184
+ },
185
+ setup(e) {
186
+ return (t, n) => (O(), v("div", de, [y("div", fe, [y("div", pe, [y("img", {
187
+ src: e.agent.avatarUrl.value,
188
+ alt: e.agent.displayName.value,
189
+ class: "w-full h-full object-cover",
190
+ onError: n[0] || (n[0] = (...e) => N(o) && N(o)(...e))
191
+ }, null, 40, me)]), y("div", he, [e.isOnline ? (O(), v(f, { key: 0 }, [n[1] || (n[1] = y("div", {
192
+ class: "size-4 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
193
+ style: { "animation-duration": "3s" }
194
+ }, null, -1)), n[2] || (n[2] = y("div", { class: "size-4 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))], 64)) : (O(), v("div", ge))])]), y("div", _e, [y("h1", ve, M(e.agent.displayName.value), 1), y("p", ye, M(e.agent.title.value), 1)])]));
195
+ }
196
+ }), xe = { class: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[28px] h-[28px] overflow-hidden" }, Se = /* @__PURE__ */ S({
197
+ name: "SelfSidebarClose",
198
+ __name: "AgentSidebarClose",
199
+ emits: ["click"],
200
+ setup(e) {
201
+ let t = k(!1);
202
+ return E(() => {
203
+ setTimeout(() => {
204
+ t.value = !0;
205
+ }, 100);
206
+ }), (e, n) => (O(), v("a", {
207
+ class: "close block cursor-pointer w-[60px] h-[60px] rounded-full transition-all duration-1000 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-110 active:scale-90 hover:rotate-90",
208
+ onClick: n[0] || (n[0] = (t) => e.$emit("click", t))
209
+ }, [n[1] || (n[1] = y("span", { class: "absolute inset-0 rounded-full transition-all" }, null, -1)), y("span", xe, [y("span", {
210
+ class: w(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]", t.value ? "translate-y-0 translate-x-0 rotate-45" : "translate-y-[30px] -translate-x-[30px] rotate-0"]),
211
+ style: {
212
+ "background-color": "currentColor",
213
+ "transition-delay": "0.15s"
214
+ }
215
+ }, null, 2), y("span", {
216
+ class: w(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]", t.value ? "translate-y-0 translate-x-0 -rotate-45" : "-translate-y-[30px] -translate-x-[30px] rotate-0"]),
217
+ style: {
218
+ "background-color": "currentColor",
219
+ "transition-delay": "0.45s"
220
+ }
221
+ }, null, 2)])]));
222
+ }
223
+ }), Ce = {
224
+ key: 0,
225
+ class: "px-9 pt-12 pb-4"
226
+ }, we = { class: "text-base font-medium text-theme-400" }, Te = {
227
+ key: 1,
228
+ class: "px-4 pb-8 border-b border-white/10"
229
+ }, Ee = ["disabled", "onClick"], De = { class: "flex items-center gap-3" }, Oe = { class: "flex-1" }, ke = {
230
+ key: 0,
231
+ class: "text-xs text-white/50 mt-0.5"
232
+ }, Ae = { class: "p-6" }, Z = /* @__PURE__ */ S({
233
+ name: "ElSidebar",
234
+ inheritAttrs: !1,
235
+ __name: "ElSidebar",
236
+ props: {
237
+ modelValue: { type: Boolean },
238
+ items: {},
239
+ position: {},
240
+ title: {},
241
+ widthClasses: {}
242
+ },
243
+ emits: ["update:modelValue"],
244
+ setup(e, { emit: t }) {
245
+ let n = e, r = t, i = n.position || "left", a = n.widthClasses || "w-[80%] max-w-[300px]", o = h({
246
+ get: () => n.modelValue,
247
+ set: (e) => r("update:modelValue", e)
248
+ }), s = h(() => n.items.filter((e) => !e.isHidden));
249
+ function handleItemClick(e) {
250
+ e.isDisabled || (e.onClick ? e.onClick({
251
+ item: e,
252
+ event: new MouseEvent("click")
253
+ }) : e.href && (e.href.includes("http") ? window.open(e.href, e.target || "_self")?.focus() : window.location.href = e.href), o.value = !1);
254
+ }
255
+ let c = h(() => i === "left" ? {
256
+ enter: "-translate-x-full",
257
+ leave: "-translate-x-full",
258
+ position: "justify-start",
259
+ closeButton: "-right-16"
260
+ } : {
261
+ enter: "translate-x-full",
262
+ leave: "translate-x-full",
263
+ position: "justify-end",
264
+ closeButton: "-left-16"
265
+ });
266
+ return (t, n) => (O(), v(f, null, [x(p, {
267
+ "enter-active-class": "transition-opacity duration-300 ease-out",
268
+ "leave-active-class": "transition-opacity duration-200 ease-in",
269
+ "enter-from-class": "opacity-0",
270
+ "enter-to-class": "opacity-100",
271
+ "leave-from-class": "opacity-100",
272
+ "leave-to-class": "opacity-0"
273
+ }, {
274
+ default: F(() => [o.value ? (O(), v("div", {
275
+ key: 0,
276
+ class: "absolute inset-0 z-40 bg-black/50 backdrop-blur-sm",
277
+ onClick: n[0] || (n[0] = (e) => o.value = !1)
278
+ })) : _("", !0)]),
279
+ _: 1
280
+ }), x(p, {
281
+ "enter-active-class": "transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)]",
282
+ "leave-active-class": "transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]",
283
+ "enter-from-class": c.value.enter,
284
+ "enter-to-class": "translate-x-0",
285
+ "leave-from-class": "translate-x-0",
286
+ "leave-to-class": c.value.leave
287
+ }, {
288
+ default: F(() => [o.value ? (O(), v("div", {
289
+ key: 0,
290
+ class: w(["absolute inset-0 z-50 flex", c.value.position]),
291
+ onClick: n[3] || (n[3] = (e) => o.value = !1)
292
+ }, [y("div", {
293
+ class: w(["relative h-full shadow-2xl bg-black/30 backdrop-blur-xl flex flex-col justify-center", N(a)]),
294
+ onClick: n[2] || (n[2] = L(() => {}, ["stop"]))
295
+ }, [
296
+ x(Se, {
297
+ class: w(["absolute top-4 z-10 text-white", c.value.closeButton]),
298
+ onClick: n[1] || (n[1] = (e) => o.value = !1)
299
+ }, null, 8, ["class"]),
300
+ e.title ? (O(), v("div", Ce, [y("h3", we, M(e.title), 1)])) : _("", !0),
301
+ t.$slots.header ? (O(), v("div", Te, [j(t.$slots, "header")])) : _("", !0),
302
+ y("div", { class: w(["flex-1 p-6 space-y-2 overflow-y-auto", {
303
+ "pt-6": !e.title && !t.$slots.header,
304
+ "pt-4": e.title || t.$slots.header
305
+ }]) }, [x(m, {
306
+ "enter-active-class": "transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]",
307
+ "leave-active-class": "transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)]",
308
+ "enter-from-class": N(i) === "left" ? "-translate-x-4 opacity-0" : "translate-x-4 opacity-0",
309
+ "enter-to-class": "translate-x-0 opacity-100",
310
+ "leave-from-class": "translate-x-0 opacity-100",
311
+ "leave-to-class": N(i) === "left" ? "-translate-x-4 opacity-0" : "translate-x-4 opacity-0"
312
+ }, {
313
+ default: F(() => [(O(!0), v(f, null, A(s.value, (e, t) => (O(), v("button", {
314
+ key: e.key || e.label || t,
315
+ style: T({ transitionDelay: `${t * 40}ms` }),
316
+ class: w(["cursor-pointer w-full text-left p-3 rounded-xl transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group", [e.isActive ? "bg-primary-500/20 border border-primary-500/40" : "hover:bg-white/10", e.isDisabled && "opacity-50 cursor-not-allowed"]]),
317
+ disabled: e.isDisabled,
318
+ onClick: (t) => handleItemClick(e)
319
+ }, [y("div", De, [e.icon?.src ? (O(), v("i", {
320
+ key: 0,
321
+ class: w(["size-5 flex-shrink-0 transition-transform duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group-hover:scale-110", [e.icon.src, e.isActive ? "text-primary-400" : "text-white/70 group-hover:text-white"]])
322
+ }, null, 2)) : _("", !0), y("div", Oe, [y("div", { class: w(["font-medium text-sm", e.isActive ? "text-primary-300" : "text-white"]) }, M(e.label), 3), e.subLabel ? (O(), v("div", ke, M(e.subLabel), 1)) : _("", !0)])])], 14, Ee))), 128))]),
323
+ _: 1
324
+ }, 8, ["enter-from-class", "leave-to-class"])], 2),
325
+ y("div", Ae, [j(t.$slots, "footer")])
326
+ ], 2)], 2)) : _("", !0)]),
327
+ _: 3
328
+ }, 8, ["enter-from-class", "leave-to-class"])], 64));
329
+ }
330
+ }), je = /* @__PURE__ */ S({
331
+ name: "AgentModeSidebar",
332
+ __name: "ElAgentModeSidebar",
333
+ props: {
334
+ modelValue: { type: Boolean },
335
+ chatController: {}
336
+ },
337
+ emits: ["update:modelValue"],
338
+ setup(e, { emit: t }) {
339
+ let n = e, r = t, a = h({
340
+ get: () => n.modelValue,
341
+ set: (e) => r("update:modelValue", e)
342
+ }), o = h(() => n.chatController?.agentMode?.value ?? "self"), s = h(() => i.map((e) => ({
343
+ key: e.mode,
344
+ icon: { src: e.icon },
345
+ label: e.label,
346
+ isActive: o.value === e.mode,
347
+ onClick: () => {
348
+ n.chatController?.setMode(e.mode);
349
+ }
350
+ })));
351
+ return (e, t) => (O(), g(Z, {
352
+ modelValue: a.value,
353
+ "onUpdate:modelValue": t[0] || (t[0] = (e) => a.value = e),
354
+ items: s.value,
355
+ position: "right",
356
+ title: "Mode",
357
+ "width-classes": "w-[80%] max-w-[255px]"
358
+ }, null, 8, ["modelValue", "items"]));
359
+ }
360
+ }), Me = /* @__PURE__ */ S({
361
+ name: "AgentSidebar",
362
+ __name: "ElAgentSidebar",
363
+ props: {
364
+ modelValue: { type: Boolean },
365
+ agent: {},
366
+ sdk: {},
367
+ title: {}
368
+ },
369
+ emits: ["update:modelValue"],
370
+ setup(e, { emit: t }) {
371
+ let n = e, r = t, i = h({
372
+ get: () => n.modelValue,
373
+ set: (e) => r("update:modelValue", e)
374
+ }), a = h(() => {
375
+ let e = [
376
+ {
377
+ key: "share",
378
+ icon: { src: "i-tabler-share" },
379
+ label: "Share this assistant",
380
+ onClick: () => {
381
+ let e = `${window.location.origin}/@${n.agent.handle.value || n.agent.agentId.value}`;
382
+ navigator.clipboard.writeText(e).catch((e) => {
383
+ console.error("ElAgentSidebar: clipboard.writeText rejected", e);
384
+ });
385
+ }
386
+ },
387
+ {
388
+ key: "profile",
389
+ icon: { src: "i-tabler-user" },
390
+ label: "View full profile",
391
+ onClick: () => {
392
+ window.open(`/@${n.agent.handle.value || n.agent.agentId.value}`, "_blank");
393
+ }
394
+ },
395
+ {
396
+ key: "create",
397
+ icon: { src: "i-tabler-sparkles" },
398
+ label: "Create your own",
399
+ onClick: () => {
400
+ window.open("/auth", "_blank");
401
+ }
402
+ }
403
+ ];
404
+ return n.sdk.activeUser.value && e.push({
405
+ key: "logout",
406
+ icon: { src: "i-tabler-logout" },
407
+ label: "Logout",
408
+ onClick: async () => {
409
+ await n.sdk.auth.logout();
410
+ }
411
+ }), e;
412
+ });
413
+ return (t, n) => (O(), g(Z, {
414
+ modelValue: i.value,
415
+ "onUpdate:modelValue": n[0] || (n[0] = (e) => i.value = e),
416
+ items: a.value,
417
+ position: "left",
418
+ title: e.title || "Menu"
419
+ }, null, 8, [
420
+ "modelValue",
421
+ "items",
422
+ "title"
423
+ ]));
424
+ }
425
+ }), Ne = {
426
+ key: 0,
427
+ class: "absolute inset-0 flex items-center justify-center bg-gradient-to-br from-theme-800 to-theme-950 rounded-3xl z-10"
428
+ }, Pe = ["data-quality"], Fe = {
429
+ key: 0,
430
+ class: "flex items-center"
431
+ }, Ie = { class: "flex-1 flex items-center gap-3 pl-2" }, Le = ["src", "alt"], Re = { class: "text-white/90 text-sm font-medium" }, ze = {
432
+ key: 0,
433
+ class: "flex justify-end"
434
+ }, Be = { class: "text-sm" }, Ve = {
435
+ key: 0,
436
+ class: "flex-1 basis-0 flex justify-end"
437
+ }, He = {
438
+ key: 0,
439
+ class: "flex-1 flex flex-col relative z-20 min-h-0 w-full px-4"
440
+ }, Q = { class: "flex-1 min-h-0 max-w-md mx-auto w-full" }, Ue = {
441
+ key: 0,
442
+ class: "h-full pb-12 flex-1 flex flex-col relative z-20 min-h-0 px-4 @[480px]/agent:px-6 max-w-md mx-auto w-full"
443
+ }, We = { class: "flex-1 basis-0 flex flex-col justify-start pt-8 gap-7" }, Ge = {
444
+ key: 0,
445
+ class: "flex items-center justify-center gap-3"
446
+ }, Ke = ["href"], qe = {
447
+ key: 1,
448
+ class: "flex-1 flex flex-col relative z-20 min-h-0 w-full gap-4 px-4"
449
+ }, Je = { class: "max-w-md mx-auto" }, Ye = {
450
+ key: 2,
451
+ class: "flex-1 flex flex-col relative z-20 min-h-0 w-full px-4 @[480px]/agent:px-6"
452
+ }, Xe = { class: "flex-1 min-h-0 max-w-md mx-auto w-full" }, Ze = {
453
+ key: 2,
454
+ class: "bg-gradient-to-br from-theme-800 to-theme-950 text-white flex items-center justify-center h-full p-8"
455
+ }, Qe = { class: "text-center max-w-md space-y-4" }, $e = { class: "text-sm text-white/70 leading-relaxed" }, et = {
456
+ key: 3,
457
+ class: "bg-white/10 backdrop-blur-sm text-white/70 flex items-center justify-center h-full"
458
+ }, $ = /* @__PURE__ */ S({
459
+ __name: "AgentChat",
460
+ props: {
461
+ sdk: {},
462
+ agent: {},
463
+ context: {},
464
+ firstMessage: {},
465
+ buttonText: {},
466
+ buttonIcon: {},
467
+ hasClose: {
468
+ type: Boolean,
469
+ default: !1
470
+ },
471
+ isActive: {
472
+ type: Boolean,
473
+ default: !0
474
+ },
475
+ loading: {
476
+ type: Boolean,
477
+ default: !1
478
+ },
479
+ theme: { default: "green" },
480
+ requireAuth: {
481
+ type: Boolean,
482
+ default: !1
483
+ },
484
+ chatOnly: {
485
+ type: Boolean,
486
+ default: !1
487
+ }
488
+ },
489
+ emits: ["close", "error"],
490
+ setup(t, { emit: o }) {
491
+ let l = o, d = ne(), p = k(!1), m = k(!1), S = k(), C = k(), j = h(() => d.value?.agentMode?.value ?? "self"), I = h(() => d.value?.textState.value.isConnected ?? !1), R = h(() => t.sdk.activeUser.value !== void 0), z = h(() => i.find((e) => e.mode === j.value));
492
+ function createChatController() {
493
+ d.value && d.value.destroy();
494
+ try {
495
+ d.value = new r({
496
+ sdk: t.sdk,
497
+ agent: t.agent,
498
+ context: t.context,
499
+ firstMessage: t.firstMessage
500
+ });
501
+ } catch (e) {
502
+ throw console.error("AgentChatController creation failed:", e), e;
503
+ }
504
+ }
505
+ function applyTheme(e) {
506
+ if (!C.value) return;
507
+ let t = te(e);
508
+ Object.entries(t).forEach(([e, t]) => {
509
+ C.value.style.setProperty(`--primary-${e}`, t);
510
+ });
511
+ }
512
+ E(() => {
513
+ try {
514
+ createChatController(), applyTheme(t.theme), t.chatOnly && d.value && d.value.setMode("chat");
515
+ } catch (e) {
516
+ let t = e instanceof Error ? e.message : "Couldn't initialize your assistant";
517
+ S.value = t, l("error", t);
518
+ }
519
+ }), D(() => {
520
+ d.value && d.value.destroy();
521
+ }), P(() => t.theme, (e) => {
522
+ applyTheme(e);
523
+ }), P(() => t.sdk.activeUser.value, (e, t) => {
524
+ t && !e && d.value && d.value.setMode("self");
525
+ });
526
+ let B = h(() => !!(t.agent.cover.value?.src && t.agent.cover.value?.quality === "low") || !!(t.agent.avatar.value?.src && t.agent.avatar.value?.quality === "low")), V = h(() => {
527
+ let e = [B.value ? "backdrop-blur-sm" : ""];
528
+ return B.value && j.value === "self" ? e.push("from-black/80 via-black/60 to-black/80") : j.value === "self" ? e.push("from-black/70 via-black/50 to-black/80") : e.push("from-black/90 via-black/90 to-black/100"), e.join(" ");
529
+ }), H = {
530
+ phone: "i-heroicons-phone",
531
+ calendar: "i-heroicons-calendar",
532
+ question: "i-heroicons-question-mark-circle",
533
+ message: "i-heroicons-chat-bubble-left-right",
534
+ sparkles: "i-heroicons-sparkles"
535
+ }, U = h(() => ee({
536
+ template: t.buttonText || "Talk to {name}",
537
+ agent: t.agent.toConfig()
538
+ })), W = h(() => H[t.buttonIcon || "phone"] || H.phone);
539
+ return (r, i) => (O(), v("div", {
540
+ ref_key: "rootElement",
541
+ ref: C,
542
+ key: N(n)(t.agent.toConfig()),
543
+ class: "pagelines-sdk @container/agent pagelines-agent w-full h-full overflow-hidden relative",
544
+ "data-test": "agent-chat"
545
+ }, [
546
+ t.loading ? (O(), v("div", Ne, [x(s, { class: "text-white size-8" })])) : t.agent && !S.value ? (O(), v("div", {
547
+ key: 1,
548
+ class: "absolute inset-0 bg-cover bg-center bg-no-repeat",
549
+ style: T({ backgroundImage: `url(${N(n)(t.agent.toConfig())})` }),
550
+ "data-quality": t.agent.avatar.value?.quality || "none"
551
+ }, [y("div", { class: w(["absolute inset-0 bg-gradient-to-br z-0", V.value]) }, null, 2), y("div", { class: w(["relative z-10 flex flex-col h-full transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] will-change-transform", t.isActive ? "opacity-100 translate-y-0" : "opacity-0 translate-y-2"]) }, [y("div", { class: w(["relative z-30 p-2", j.value === "self" ? "" : "backdrop-blur-lg"]) }, [t.chatOnly ? (O(), v("div", Fe, [y("div", Ie, [y("img", {
552
+ src: N(n)(t.agent.toConfig()),
553
+ alt: t.agent.displayName.value,
554
+ class: "size-8 rounded-full object-cover"
555
+ }, null, 8, Le), y("span", Re, M(t.agent.displayName.value), 1)]), t.hasClose ? (O(), v("div", ze, [y("button", {
556
+ class: "cursor-pointer flex items-center p-3 rounded-2xl text-white/70 hover:bg-white/10 transition-colors",
557
+ onClick: i[0] || (i[0] = L((e) => l("close", "button"), ["stop"]))
558
+ }, [...i[7] || (i[7] = [y("i", { class: "size-6 i-tabler-x" }, null, -1)])])])) : _("", !0)])) : (O(), v("div", {
559
+ key: 1,
560
+ class: w(["flex items-center", t.hasClose ? "" : "justify-between"])
561
+ }, [
562
+ y("div", { class: w(t.hasClose ? "flex-1 basis-0" : "") }, [y("button", {
563
+ class: "cursor-pointer p-2 flex items-center gap-2 rounded-2xl text-white/70 hover:bg-white/10 transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-105 active:scale-95",
564
+ onClick: i[1] || (i[1] = (e) => p.value = !0)
565
+ }, [...i[8] || (i[8] = [y("i", { class: "i-tabler-menu size-7" }, null, -1)])])], 2),
566
+ y("button", {
567
+ class: w(["flex items-center gap-2 px-3.5 py-3 rounded-2xl text-white/90 hover:bg-white/10 transition-all cursor-pointer flex-grow-0", { "bg-white/10": m.value }]),
568
+ onClick: i[2] || (i[2] = (e) => m.value = !0)
569
+ }, [
570
+ y("i", { class: w([z.value?.icon, "size-4 opacity-60"]) }, null, 2),
571
+ y("span", Be, M(z.value?.label), 1),
572
+ i[9] || (i[9] = y("i", { class: "i-tabler-chevron-down size-4" }, null, -1))
573
+ ], 2),
574
+ t.hasClose ? (O(), v("div", Ve, [y("button", {
575
+ class: "cursor-pointer flex items-center p-3 rounded-2xl text-white/70 hover:bg-white/10 transition-colors",
576
+ onClick: i[3] || (i[3] = L((e) => l("close", "button"), ["stop"]))
577
+ }, [...i[10] || (i[10] = [y("i", { class: "size-6 i-tabler-x" }, null, -1)])])])) : _("", !0)
578
+ ], 2))], 2), t.chatOnly ? (O(), v("div", He, [y("div", Q, [x(c, {
579
+ "chat-controller": d.value,
580
+ agent: t.agent,
581
+ "show-header": ""
582
+ }, null, 8, ["chat-controller", "agent"])])])) : (O(), v(f, { key: 1 }, [j.value === "self" ? (O(), v("div", Ue, [
583
+ i[11] || (i[11] = y("div", { class: "flex-1 basis-0 mb-12" }, null, -1)),
584
+ x(be, {
585
+ agent: t.agent,
586
+ "is-online": I.value
587
+ }, null, 8, ["agent", "is-online"]),
588
+ y("div", We, [x(u, {
589
+ theme: "primary",
590
+ size: "lg",
591
+ class: "w-full",
592
+ icon: W.value,
593
+ "data-test": "voice-button",
594
+ onClick: i[4] || (i[4] = (e) => d.value?.setMode("talk"))
595
+ }, {
596
+ default: F(() => [b(M(U.value), 1)]),
597
+ _: 1
598
+ }, 8, ["icon"]), t.agent.accounts.value && t.agent.accounts.value.length > 0 ? (O(), v("div", Ge, [(O(!0), v(f, null, A((t.agent.accounts.value || []).filter((t) => N(e)[t.platform]), (t) => (O(), v("a", {
599
+ key: `${t.platform}-${t.handle}`,
600
+ href: N(e)[t.platform].getUrl(t.handle),
601
+ target: "_blank",
602
+ class: "size-12 rounded-full text-white/60 hover:text-white hover:bg-white/5 border border-white/0 hover:border-white/10 flex items-center justify-center transition-all duration-200 hover:scale-105"
603
+ }, [y("i", { class: w([N(e)[t.platform].icon, "size-5"]) }, null, 2)], 8, Ke))), 128))])) : _("", !0)])
604
+ ])) : j.value === "talk" ? (O(), v("div", qe, [t.requireAuth && !R.value ? (O(), g(G, {
605
+ key: 0,
606
+ sdk: t.sdk
607
+ }, null, 8, ["sdk"])) : (O(), v(f, { key: 1 }, [y("div", null, [y("div", Je, [x(a, {
608
+ agent: t.agent,
609
+ "is-online": I.value
610
+ }, null, 8, ["agent", "is-online"])])]), x(c, {
611
+ "chat-controller": d.value,
612
+ agent: t.agent
613
+ }, null, 8, ["chat-controller", "agent"])], 64))])) : (O(), v("div", Ye, [y("div", Xe, [j.value === "chat" ? (O(), v(f, { key: 0 }, [t.requireAuth && !R.value ? (O(), g(G, {
614
+ key: 0,
615
+ sdk: t.sdk
616
+ }, null, 8, ["sdk"])) : (O(), g(c, {
617
+ key: 1,
618
+ "chat-controller": d.value,
619
+ agent: t.agent,
620
+ "show-header": ""
621
+ }, null, 8, ["chat-controller", "agent"]))], 64)) : j.value === "info" ? (O(), g(ue, {
622
+ key: 1,
623
+ agent: t.agent,
624
+ "is-online": I.value
625
+ }, null, 8, ["agent", "is-online"])) : _("", !0)])]))], 64))], 2)], 12, Pe)) : S.value ? (O(), v("div", Ze, [y("div", Qe, [
626
+ i[12] || (i[12] = y("div", { class: "flex justify-center" }, [y("div", { class: "rounded-full bg-red-500/20 flex items-center justify-center size-10" }, [y("i", { class: "i-tabler-alert-circle size-6 text-red-400" })])], -1)),
627
+ i[13] || (i[13] = y("h3", { class: "text-lg font-medium" }, " Agent Error ", -1)),
628
+ y("p", $e, M(S.value), 1)
629
+ ])])) : (O(), v("div", et, " Couldn't load your assistant. Please try again later. ")),
630
+ t.chatOnly ? _("", !0) : (O(), g(Me, {
631
+ key: 4,
632
+ modelValue: p.value,
633
+ "onUpdate:modelValue": i[5] || (i[5] = (e) => p.value = e),
634
+ agent: t.agent,
635
+ sdk: t.sdk,
636
+ title: t.agent.displayName.value,
637
+ "data-test": "agent-sidebar"
638
+ }, null, 8, [
639
+ "modelValue",
640
+ "agent",
641
+ "sdk",
642
+ "title"
643
+ ])),
644
+ t.chatOnly ? _("", !0) : (O(), g(je, {
645
+ key: 5,
646
+ modelValue: m.value,
647
+ "onUpdate:modelValue": i[6] || (i[6] = (e) => m.value = e),
648
+ "chat-controller": d.value,
649
+ "data-test": "agent-mode-sidebar"
650
+ }, null, 8, ["modelValue", "chat-controller"]))
651
+ ]));
652
+ }
653
+ }), tt = /* @__PURE__ */ S({
654
+ __name: "AgentProvider",
655
+ props: {
656
+ sdk: {},
657
+ agent: {},
658
+ handle: {},
659
+ context: {},
660
+ firstMessage: {},
661
+ buttonText: {},
662
+ buttonIcon: {},
663
+ hasClose: { type: Boolean },
664
+ chatOnly: { type: Boolean },
665
+ apiBase: {}
666
+ },
667
+ emits: ["close", "error"],
668
+ setup(e, { emit: t }) {
669
+ let n = e, r = t;
670
+ return (e, t) => (O(), g(d, C(n, { class: "agent-provider size-full relative" }), {
671
+ default: F((e) => [x($, {
672
+ sdk: e.sdk,
673
+ agent: e.agent,
674
+ context: e.context,
675
+ "first-message": e.firstMessage,
676
+ "button-text": n.buttonText,
677
+ "button-icon": n.buttonIcon,
678
+ "has-close": n.hasClose,
679
+ "chat-only": n.chatOnly,
680
+ "is-active": !0,
681
+ class: "size-full",
682
+ onClose: t[0] || (t[0] = (e) => r("close", e)),
683
+ onError: t[1] || (t[1] = (e) => r("error", e))
684
+ }, null, 8, [
685
+ "sdk",
686
+ "agent",
687
+ "context",
688
+ "first-message",
689
+ "button-text",
690
+ "button-icon",
691
+ "has-close",
692
+ "chat-only"
693
+ ])]),
694
+ _: 1
695
+ }, 16));
696
+ }
697
+ });
698
+ //#endregion
699
+ export { $ as n, tt as t };
700
+
701
+ //# sourceMappingURL=AgentProvider.js.map