@enegelai/bot-widget 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,8 +1,8 @@
1
- var st = Object.defineProperty;
2
- var nt = (t, e, o) => e in t ? st(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var $ = (t, e, o) => (nt(t, typeof e != "symbol" ? e + "" : e, o), o);
4
- import { css as v, LitElement as le, html as l, svg as Le } from "lit";
5
- import { property as i, customElement as x, queryAll as it, eventOptions as Ve, query as _e } from "lit/decorators.js";
1
+ var dt = Object.defineProperty;
2
+ var pt = (t, e, o) => e in t ? dt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var $ = (t, e, o) => (pt(t, typeof e != "symbol" ? e + "" : e, o), o);
4
+ import { css as x, LitElement as le, html as c, svg as Le } from "lit";
5
+ import { property as l, customElement as k, queryAll as ht, eventOptions as qe, query as Ce } from "lit/decorators.js";
6
6
  import { unsafeHTML as Z } from "lit-html/directives/unsafe-html.js";
7
7
  import "@shoelace-style/shoelace/dist/themes/light.css";
8
8
  import "@shoelace-style/shoelace/dist/themes/dark.css";
@@ -23,12 +23,11 @@ import "@shoelace-style/shoelace/dist/components/spinner/spinner.js";
23
23
  import "@shoelace-style/shoelace/dist/components/alert/alert.js";
24
24
  import { repeat as me } from "lit/directives/repeat.js";
25
25
  import { when as B } from "lit/directives/when.js";
26
- import { until as Oe } from "lit-html/directives/until.js";
27
- import lt from "markdown-it";
28
- import * as ct from "markdown-it-emoji";
29
- import dt from "markdown-it-link-attributes";
26
+ import { until as Ie } from "lit-html/directives/until.js";
27
+ import ut from "markdown-it";
28
+ import gt from "markdown-it-link-attributes";
30
29
  import "@shoelace-style/shoelace/dist/components/popup/popup.js";
31
- function qe(t) {
30
+ function De(t) {
32
31
  return typeof t == "function" ? t() : t;
33
32
  }
34
33
  const ie = class ie extends Event {
@@ -36,28 +35,28 @@ const ie = class ie extends Event {
36
35
  * @param {string} key of the state that has changed
37
36
  * @param {unknown} value for the changed key
38
37
  */
39
- constructor(o, r, a) {
38
+ constructor(o, a, r) {
40
39
  super(ie.eventName, {
41
40
  cancelable: !1
42
41
  });
43
42
  $(this, "key");
44
43
  $(this, "state");
45
44
  $(this, "value");
46
- this.key = o, this.value = r, this.state = a;
45
+ this.key = o, this.value = a, this.state = r;
47
46
  }
48
47
  };
49
48
  $(ie, "eventName", "lit-state-changed");
50
49
  let T = ie;
51
- const pt = (t, e) => e !== t && (e === e || t === t);
50
+ const bt = (t, e) => e !== t && (e === e || t === t);
52
51
  class X extends EventTarget {
53
52
  constructor() {
54
53
  super();
55
54
  // hold a reference to hooks
56
55
  $(this, "hookMap", /* @__PURE__ */ new Map());
57
- this.constructor.finalize(), this.propertyMap && [...this.propertyMap].forEach(([o, r]) => {
58
- if (r.initialValue !== void 0) {
59
- const a = qe(r.initialValue);
60
- this[o] = a, r.value = a;
56
+ this.constructor.finalize(), this.propertyMap && [...this.propertyMap].forEach(([o, a]) => {
57
+ if (a.initialValue !== void 0) {
58
+ const r = De(a.initialValue);
59
+ this[o] = r, a.value = r;
61
60
  }
62
61
  });
63
62
  }
@@ -72,24 +71,24 @@ class X extends EventTarget {
72
71
  return !1;
73
72
  this.finalized = !0;
74
73
  const o = Object.keys(this.properties || {});
75
- for (const r of o)
76
- this.createProperty(r, this.properties[r]);
74
+ for (const a of o)
75
+ this.createProperty(a, this.properties[a]);
77
76
  return !0;
78
77
  }
79
- static createProperty(o, r) {
78
+ static createProperty(o, a) {
80
79
  this.finalize();
81
- const a = typeof o == "symbol" ? Symbol() : `__${o}`, s = this.getPropertyDescriptor(o, a, r);
80
+ const r = typeof o == "symbol" ? Symbol() : `__${o}`, s = this.getPropertyDescriptor(o, r, a);
82
81
  Object.defineProperty(this.prototype, o, s);
83
82
  }
84
- static getPropertyDescriptor(o, r, a) {
85
- const s = (a == null ? void 0 : a.hasChanged) || pt;
83
+ static getPropertyDescriptor(o, a, r) {
84
+ const s = (r == null ? void 0 : r.hasChanged) || bt;
86
85
  return {
87
86
  get() {
88
- return this[r];
87
+ return this[a];
89
88
  },
90
89
  set(n) {
91
- const c = this[o];
92
- this[r] = n, s(n, c) === !0 && this.dispatchStateEvent(o, n, this);
90
+ const i = this[o];
91
+ this[a] = n, s(n, i) === !0 && this.dispatchStateEvent(o, n, this);
93
92
  },
94
93
  configurable: !0,
95
94
  enumerable: !0
@@ -100,8 +99,8 @@ class X extends EventTarget {
100
99
  * properties marked as skipReset
101
100
  */
102
101
  reset() {
103
- this.hookMap.forEach((o) => o.reset()), [...this.propertyMap].filter(([o, r]) => !(r.skipReset === !0 || r.resetValue === void 0)).forEach(([o, r]) => {
104
- this[o] = r.resetValue;
102
+ this.hookMap.forEach((o) => o.reset()), [...this.propertyMap].filter(([o, a]) => !(a.skipReset === !0 || a.resetValue === void 0)).forEach(([o, a]) => {
103
+ this[o] = a.resetValue;
105
104
  });
106
105
  }
107
106
  /**
@@ -112,25 +111,25 @@ class X extends EventTarget {
112
111
  * @param nameOrNames
113
112
  * @returns a unsubscribe function.
114
113
  */
115
- subscribe(o, r, a) {
116
- r && !Array.isArray(r) && (r = [r]);
114
+ subscribe(o, a, r) {
115
+ a && !Array.isArray(a) && (a = [a]);
117
116
  const s = (n) => {
118
- (!r || r.includes(n.key)) && o(n.key, n.value, this);
117
+ (!a || a.includes(n.key)) && o(n.key, n.value, this);
119
118
  };
120
- return this.addEventListener(T.eventName, s, a), () => this.removeEventListener(T.eventName, s);
119
+ return this.addEventListener(T.eventName, s, r), () => this.removeEventListener(T.eventName, s);
121
120
  }
122
- dispatchStateEvent(o, r, a) {
123
- this.dispatchEvent(new T(o, r, a));
121
+ dispatchStateEvent(o, a, r) {
122
+ this.dispatchEvent(new T(o, a, r));
124
123
  }
125
124
  }
126
125
  // a map holding decorators definition.
127
126
  $(X, "propertyMap"), $(X, "properties"), $(X, "finalized", !1);
128
- class ht {
129
- constructor(e, o, r) {
127
+ class mt {
128
+ constructor(e, o, a) {
130
129
  $(this, "host");
131
130
  $(this, "state");
132
131
  $(this, "callback");
133
- this.host = e, this.state = o, this.host.addController(this), this.callback = r || (() => this.host.requestUpdate());
132
+ this.host = e, this.state = o, this.host.addController(this), this.callback = a || (() => this.host.requestUpdate());
134
133
  }
135
134
  hostConnected() {
136
135
  this.state.addEventListener(T.eventName, this.callback), this.callback();
@@ -144,21 +143,21 @@ class ht {
144
143
  * Copyright 2017 Google LLC
145
144
  * SPDX-License-Identifier: BSD-3-Clause
146
145
  */
147
- const De = ({ finisher: t, descriptor: e }) => (o, r) => {
148
- var a;
149
- if (r === void 0) {
150
- const s = (a = o.originalKey) !== null && a !== void 0 ? a : o.key, n = e != null ? { kind: "method", placement: "prototype", key: s, descriptor: e(o.key) } : { ...o, key: s };
151
- return t != null && (n.finisher = function(c) {
152
- t(c, s);
146
+ const Fe = ({ finisher: t, descriptor: e }) => (o, a) => {
147
+ var r;
148
+ if (a === void 0) {
149
+ const s = (r = o.originalKey) !== null && r !== void 0 ? r : o.key, n = e != null ? { kind: "method", placement: "prototype", key: s, descriptor: e(o.key) } : { ...o, key: s };
150
+ return t != null && (n.finisher = function(i) {
151
+ t(i, s);
153
152
  }), n;
154
153
  }
155
154
  {
156
155
  const s = o.constructor;
157
- e !== void 0 && Object.defineProperty(o, r, e(r)), t == null || t(s, r);
156
+ e !== void 0 && Object.defineProperty(o, a, e(a)), t == null || t(s, a);
158
157
  }
159
158
  };
160
- function I(t) {
161
- return De({
159
+ function L(t) {
160
+ return Fe({
162
161
  // @ts-ignore ctor is typof State and not typeof ReactiveElement
163
162
  finisher: (e, o) => {
164
163
  if (Object.getOwnPropertyDescriptor(e.prototype, o))
@@ -167,7 +166,7 @@ function I(t) {
167
166
  }
168
167
  });
169
168
  }
170
- function ut(t, e) {
169
+ function yt(t, e) {
171
170
  if (t !== null && (e === Boolean || e === Number || e === Array || e === Object))
172
171
  try {
173
172
  t = JSON.parse(t);
@@ -177,179 +176,179 @@ function ut(t, e) {
177
176
  return t;
178
177
  }
179
178
  new URL(window.location.href);
180
- const gt = {
179
+ const ft = {
181
180
  prefix: "_ls"
182
181
  };
183
182
  function D(t) {
184
- return t = { ...gt, ...t }, De({
183
+ return t = { ...ft, ...t }, Fe({
185
184
  // @ts-ignore ctor is typof State and not typeof ReactiveElement
186
185
  finisher: (e, o) => {
187
- const r = Object.getOwnPropertyDescriptor(e.prototype, o);
188
- if (!r)
186
+ const a = Object.getOwnPropertyDescriptor(e.prototype, o);
187
+ if (!a)
189
188
  throw new Error("@local-storage decorator need to be called after @property");
190
- const a = `${(t == null ? void 0 : t.prefix) || ""}_${(t == null ? void 0 : t.key) || String(o)}`, s = e.propertyMap.get(o), n = s == null ? void 0 : s.type;
189
+ const r = `${(t == null ? void 0 : t.prefix) || ""}_${(t == null ? void 0 : t.key) || String(o)}`, s = e.propertyMap.get(o), n = s == null ? void 0 : s.type;
191
190
  if (s) {
192
- const _ = s.initialValue;
193
- s.initialValue = () => ut(localStorage.getItem(a), n) ?? qe(_), e.propertyMap.set(o, { ...s, ...t });
191
+ const y = s.initialValue;
192
+ s.initialValue = () => yt(localStorage.getItem(r), n) ?? De(y), e.propertyMap.set(o, { ...s, ...t });
194
193
  }
195
- const c = r == null ? void 0 : r.set, w = {
196
- ...r,
197
- set: function(_) {
198
- _ !== void 0 && localStorage.setItem(a, n === Object || n === Array ? JSON.stringify(_) : _), c && c.call(this, _);
194
+ const i = a == null ? void 0 : a.set, m = {
195
+ ...a,
196
+ set: function(y) {
197
+ y !== void 0 && localStorage.setItem(r, n === Object || n === Array ? JSON.stringify(y) : y), i && i.call(this, y);
199
198
  }
200
199
  };
201
- Object.defineProperty(e.prototype, o, w);
200
+ Object.defineProperty(e.prototype, o, m);
202
201
  }
203
202
  });
204
203
  }
205
- var bt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
206
- function mt(t) {
204
+ var vt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
205
+ function wt(t) {
207
206
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
208
207
  }
209
- var Fe = { exports: {} };
208
+ var Ue = { exports: {} };
210
209
  (function(t) {
211
210
  (function(e, o) {
212
211
  t.exports ? t.exports = o() : e.log = o();
213
- })(bt, function() {
212
+ })(vt, function() {
214
213
  var e = function() {
215
- }, o = "undefined", r = typeof window !== o && typeof window.navigator !== o && /Trident\/|MSIE /.test(window.navigator.userAgent), a = [
214
+ }, o = "undefined", a = typeof window !== o && typeof window.navigator !== o && /Trident\/|MSIE /.test(window.navigator.userAgent), r = [
216
215
  "trace",
217
216
  "debug",
218
217
  "info",
219
218
  "warn",
220
219
  "error"
221
220
  ];
222
- function s(h, b) {
223
- var f = h[b];
224
- if (typeof f.bind == "function")
225
- return f.bind(h);
221
+ function s(u, f) {
222
+ var w = u[f];
223
+ if (typeof w.bind == "function")
224
+ return w.bind(u);
226
225
  try {
227
- return Function.prototype.bind.call(f, h);
226
+ return Function.prototype.bind.call(w, u);
228
227
  } catch {
229
228
  return function() {
230
- return Function.prototype.apply.apply(f, [h, arguments]);
229
+ return Function.prototype.apply.apply(w, [u, arguments]);
231
230
  };
232
231
  }
233
232
  }
234
233
  function n() {
235
234
  console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
236
235
  }
237
- function c(h) {
238
- return h === "debug" && (h = "log"), typeof console === o ? !1 : h === "trace" && r ? n : console[h] !== void 0 ? s(console, h) : console.log !== void 0 ? s(console, "log") : e;
236
+ function i(u) {
237
+ return u === "debug" && (u = "log"), typeof console === o ? !1 : u === "trace" && a ? n : console[u] !== void 0 ? s(console, u) : console.log !== void 0 ? s(console, "log") : e;
239
238
  }
240
- function g(h, b) {
241
- for (var f = 0; f < a.length; f++) {
242
- var p = a[f];
243
- this[p] = f < h ? e : this.methodFactory(p, h, b);
239
+ function g(u, f) {
240
+ for (var w = 0; w < r.length; w++) {
241
+ var h = r[w];
242
+ this[h] = w < u ? e : this.methodFactory(h, u, f);
244
243
  }
245
244
  this.log = this.debug;
246
245
  }
247
- function w(h, b, f) {
246
+ function m(u, f, w) {
248
247
  return function() {
249
- typeof console !== o && (g.call(this, b, f), this[h].apply(this, arguments));
248
+ typeof console !== o && (g.call(this, f, w), this[u].apply(this, arguments));
250
249
  };
251
250
  }
252
- function _(h, b, f) {
253
- return c(h) || w.apply(this, arguments);
254
- }
255
- function he(h, b, f) {
256
- var p = this, Ae;
257
- b = b ?? "WARN";
258
- var M = "loglevel";
259
- typeof h == "string" ? M += ":" + h : typeof h == "symbol" && (M = void 0);
260
- function ot(d) {
261
- var E = (a[d] || "silent").toUpperCase();
262
- if (!(typeof window === o || !M)) {
251
+ function y(u, f, w) {
252
+ return i(u) || m.apply(this, arguments);
253
+ }
254
+ function he(u, f, w) {
255
+ var h = this, Oe;
256
+ f = f ?? "WARN";
257
+ var S = "loglevel";
258
+ typeof u == "string" ? S += ":" + u : typeof u == "symbol" && (S = void 0);
259
+ function it(d) {
260
+ var E = (r[d] || "silent").toUpperCase();
261
+ if (!(typeof window === o || !S)) {
263
262
  try {
264
- window.localStorage[M] = E;
263
+ window.localStorage[S] = E;
265
264
  return;
266
265
  } catch {
267
266
  }
268
267
  try {
269
- window.document.cookie = encodeURIComponent(M) + "=" + E + ";";
268
+ window.document.cookie = encodeURIComponent(S) + "=" + E + ";";
270
269
  } catch {
271
270
  }
272
271
  }
273
272
  }
274
273
  function He() {
275
274
  var d;
276
- if (!(typeof window === o || !M)) {
275
+ if (!(typeof window === o || !S)) {
277
276
  try {
278
- d = window.localStorage[M];
277
+ d = window.localStorage[S];
279
278
  } catch {
280
279
  }
281
280
  if (typeof d === o)
282
281
  try {
283
282
  var E = window.document.cookie, Y = E.indexOf(
284
- encodeURIComponent(M) + "="
283
+ encodeURIComponent(S) + "="
285
284
  );
286
285
  Y !== -1 && (d = /^([^;]+)/.exec(E.slice(Y))[1]);
287
286
  } catch {
288
287
  }
289
- return p.levels[d] === void 0 && (d = void 0), d;
288
+ return h.levels[d] === void 0 && (d = void 0), d;
290
289
  }
291
290
  }
292
- function rt() {
293
- if (!(typeof window === o || !M)) {
291
+ function lt() {
292
+ if (!(typeof window === o || !S)) {
294
293
  try {
295
- window.localStorage.removeItem(M);
294
+ window.localStorage.removeItem(S);
296
295
  return;
297
296
  } catch {
298
297
  }
299
298
  try {
300
- window.document.cookie = encodeURIComponent(M) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
299
+ window.document.cookie = encodeURIComponent(S) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
301
300
  } catch {
302
301
  }
303
302
  }
304
303
  }
305
- p.name = h, p.levels = {
304
+ h.name = u, h.levels = {
306
305
  TRACE: 0,
307
306
  DEBUG: 1,
308
307
  INFO: 2,
309
308
  WARN: 3,
310
309
  ERROR: 4,
311
310
  SILENT: 5
312
- }, p.methodFactory = f || _, p.getLevel = function() {
313
- return Ae;
314
- }, p.setLevel = function(d, E) {
315
- if (typeof d == "string" && p.levels[d.toUpperCase()] !== void 0 && (d = p.levels[d.toUpperCase()]), typeof d == "number" && d >= 0 && d <= p.levels.SILENT) {
316
- if (Ae = d, E !== !1 && ot(d), g.call(p, d, h), typeof console === o && d < p.levels.SILENT)
311
+ }, h.methodFactory = w || y, h.getLevel = function() {
312
+ return Oe;
313
+ }, h.setLevel = function(d, E) {
314
+ if (typeof d == "string" && h.levels[d.toUpperCase()] !== void 0 && (d = h.levels[d.toUpperCase()]), typeof d == "number" && d >= 0 && d <= h.levels.SILENT) {
315
+ if (Oe = d, E !== !1 && it(d), g.call(h, d, u), typeof console === o && d < h.levels.SILENT)
317
316
  return "No console available for logging";
318
317
  } else
319
318
  throw "log.setLevel() called with invalid level: " + d;
320
- }, p.setDefaultLevel = function(d) {
321
- b = d, He() || p.setLevel(d, !1);
322
- }, p.resetLevel = function() {
323
- p.setLevel(b, !1), rt();
324
- }, p.enableAll = function(d) {
325
- p.setLevel(p.levels.TRACE, d);
326
- }, p.disableAll = function(d) {
327
- p.setLevel(p.levels.SILENT, d);
319
+ }, h.setDefaultLevel = function(d) {
320
+ f = d, He() || h.setLevel(d, !1);
321
+ }, h.resetLevel = function() {
322
+ h.setLevel(f, !1), lt();
323
+ }, h.enableAll = function(d) {
324
+ h.setLevel(h.levels.TRACE, d);
325
+ }, h.disableAll = function(d) {
326
+ h.setLevel(h.levels.SILENT, d);
328
327
  };
329
328
  var ge = He();
330
- ge == null && (ge = b), p.setLevel(ge, !1);
329
+ ge == null && (ge = f), h.setLevel(ge, !1);
331
330
  }
332
- var j = new he(), ue = {};
333
- j.getLogger = function(b) {
334
- if (typeof b != "symbol" && typeof b != "string" || b === "")
331
+ var M = new he(), ue = {};
332
+ M.getLogger = function(f) {
333
+ if (typeof f != "symbol" && typeof f != "string" || f === "")
335
334
  throw new TypeError("You must supply a name when creating a logger.");
336
- var f = ue[b];
337
- return f || (f = ue[b] = new he(
338
- b,
339
- j.getLevel(),
340
- j.methodFactory
341
- )), f;
335
+ var w = ue[f];
336
+ return w || (w = ue[f] = new he(
337
+ f,
338
+ M.getLevel(),
339
+ M.methodFactory
340
+ )), w;
342
341
  };
343
- var tt = typeof window !== o ? window.log : void 0;
344
- return j.noConflict = function() {
345
- return typeof window !== o && window.log === j && (window.log = tt), j;
346
- }, j.getLoggers = function() {
342
+ var nt = typeof window !== o ? window.log : void 0;
343
+ return M.noConflict = function() {
344
+ return typeof window !== o && window.log === M && (window.log = nt), M;
345
+ }, M.getLoggers = function() {
347
346
  return ue;
348
- }, j.default = j, j;
347
+ }, M.default = M, M;
349
348
  });
350
- })(Fe);
351
- var yt = Fe.exports;
352
- const ce = /* @__PURE__ */ mt(yt), ft = v`
349
+ })(Ue);
350
+ var xt = Ue.exports;
351
+ const ce = /* @__PURE__ */ wt(xt), kt = x`
353
352
  :host {
354
353
  }
355
354
  .cb-wrapper {
@@ -416,7 +415,7 @@ const ce = /* @__PURE__ */ mt(yt), ft = v`
416
415
  border-radius: 0;
417
416
  }
418
417
  }
419
- `, H = v`
418
+ `, O = x`
420
419
  :host {
421
420
  --primary-color: var(--sl-color-primary-600);
422
421
  }
@@ -476,8 +475,8 @@ const ce = /* @__PURE__ */ mt(yt), ft = v`
476
475
  .text-button:hover {
477
476
  text-decoration: underline;
478
477
  }
479
- `, Ue = v`
480
- ${H}
478
+ `, Ze = x`
479
+ ${O}
481
480
 
482
481
  :host {
483
482
  display: inline-flex;
@@ -499,99 +498,99 @@ const ce = /* @__PURE__ */ mt(yt), ft = v`
499
498
  color: white;
500
499
  }
501
500
  `;
502
- var vt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Ce = (t, e, o, r) => {
503
- for (var a = r > 1 ? void 0 : r ? wt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
504
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
505
- return r && a && vt(e, o, a), a;
501
+ var _t = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, $e = (t, e, o, a) => {
502
+ for (var r = a > 1 ? void 0 : a ? Ct(e, o) : e, s = t.length - 1, n; s >= 0; s--)
503
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
504
+ return a && r && _t(e, o, r), r;
506
505
  };
507
506
  let N = class extends le {
508
507
  constructor() {
509
508
  super(...arguments), this.color = "primary", this.svg = "";
510
509
  }
511
510
  render() {
512
- return l`<span class="cb-icon color-${this.color}" part="base"
511
+ return c`<span class="cb-icon color-${this.color}" part="base"
513
512
  >${Z(this.svg)}</span
514
513
  >`;
515
514
  }
516
515
  };
517
- N.styles = Ue;
518
- Ce([
519
- i({ type: String })
516
+ N.styles = Ze;
517
+ $e([
518
+ l({ type: String })
520
519
  ], N.prototype, "color", 2);
521
- Ce([
522
- i({ type: String })
520
+ $e([
521
+ l({ type: String })
523
522
  ], N.prototype, "svg", 2);
524
- N = Ce([
525
- x("cb-icon")
523
+ N = $e([
524
+ k("cb-icon")
526
525
  ], N);
527
- let xt = (t) => crypto.getRandomValues(new Uint8Array(t)), kt = (t, e, o) => {
528
- let r = (2 << Math.log(t.length - 1) / Math.LN2) - 1, a = -~(1.6 * r * e / t.length);
526
+ let $t = (t) => crypto.getRandomValues(new Uint8Array(t)), jt = (t, e, o) => {
527
+ let a = (2 << Math.log(t.length - 1) / Math.LN2) - 1, r = -~(1.6 * a * e / t.length);
529
528
  return (s = e) => {
530
529
  let n = "";
531
530
  for (; ; ) {
532
- let c = o(a), g = a;
531
+ let i = o(r), g = r;
533
532
  for (; g--; )
534
- if (n += t[c[g] & r] || "", n.length === s)
533
+ if (n += t[i[g] & a] || "", n.length === s)
535
534
  return n;
536
535
  }
537
536
  };
538
- }, _t = (t, e = 21) => kt(t, e, xt);
539
- const Ct = _t("1234567890abcdefghijklmnopqrstuvwxyz", 10);
537
+ }, Mt = (t, e = 21) => jt(t, e, $t);
538
+ const St = Mt("1234567890abcdefghijklmnopqrstuvwxyz", 10);
540
539
  function ye(t = 10) {
541
- return Ct(t);
540
+ return St(t);
542
541
  }
543
- function $t(t) {
542
+ function At(t) {
544
543
  return new Promise((e, o) => {
545
544
  try {
546
545
  navigator.clipboard.writeText(t).then(() => {
547
546
  e(t);
548
547
  });
549
- } catch (r) {
550
- o(r);
548
+ } catch (a) {
549
+ o(a);
551
550
  }
552
551
  });
553
552
  }
554
- function jt(t = !0) {
553
+ function Ot(t = !0) {
555
554
  return new Promise((e) => {
556
555
  const o = document.createElement("input");
557
556
  o.type = "file", t && (o.multiple = !0), o.style.display = "none", o.addEventListener("change", () => {
558
- const r = Array.prototype.slice.call(o.files);
559
- e(r);
557
+ const a = Array.prototype.slice.call(o.files);
558
+ e(a);
560
559
  }), o.click();
561
560
  });
562
561
  }
563
- const k = ce.noConflict();
564
- k.setLevel("info");
565
- class Mt {
562
+ const _ = ce.noConflict();
563
+ _.setLevel("info");
564
+ class Ht {
566
565
  constructor(e = {}) {
567
- this.id = 0, this.url = (e == null ? void 0 : e.url) || null, this.orgId = (e == null ? void 0 : e.orgId) || null, this.botId = (e == null ? void 0 : e.botId) || null, this.convId = (e == null ? void 0 : e.convId) || null, this._options = e || {}, this._ws = null, this.started = !1, this.connected = !1, this.onMessage = (e == null ? void 0 : e.onMessage) || null, this.queue = [], this.pause = (o) => new Promise((r) => setTimeout(r, o)), k.info(`WSC: Created, url: ${this.url}`);
566
+ this.id = 0, this.url = (e == null ? void 0 : e.url) || null, this.orgId = (e == null ? void 0 : e.orgId) || null, this.botId = (e == null ? void 0 : e.botId) || null, this.convId = (e == null ? void 0 : e.convId) || null, this._options = e || {}, this._ws = null, this.started = !1, this.connected = !1, this.onMessage = (e == null ? void 0 : e.onMessage) || null, this.queue = [], this.pause = (o) => new Promise((a) => setTimeout(a, o)), _.info(`WSC: Created, url: ${this.url}`);
568
567
  }
569
568
  connect(e = {}) {
570
569
  if (this.url = (e == null ? void 0 : e.url) || this.url, this.connected = !1, !this.url)
571
- return k.error("WSC: URL must be provided to connect"), null;
570
+ return _.error("WSC: URL must be provided to connect"), null;
572
571
  const o = this.url;
573
- k.info(`WSC: Connecting to ${o} ...`), this._ws = new WebSocket(o);
574
- let r = setTimeout(() => {
575
- k.error("WSC: connected message not received in time - terminating"), this._ws.close(), this._ws = null, this.connected = !1;
572
+ _.info(`WSC: Connecting to ${o} ...`), this._ws = new WebSocket(o);
573
+ let a = setTimeout(() => {
574
+ _.error("WSC: connected message not received in time - terminating"), this._ws.close(), this._ws = null, this.connected = !1;
576
575
  }, 15e3);
577
576
  this._ws.onopen = () => {
578
- k.info(`WSC: Connection to ${o} opened`);
579
- }, this._ws.onmessage = (a) => {
580
- let s = (a == null ? void 0 : a.data) || null;
577
+ _.info(`WSC: Connection to ${o} opened`);
578
+ }, this._ws.onmessage = (r) => {
579
+ let s = (r == null ? void 0 : r.data) || null;
581
580
  if (!s)
582
581
  return;
583
582
  let n = null;
584
583
  try {
585
584
  n = JSON.parse(s);
586
585
  } catch {
587
- k.error(`Failed to parse message: ${s}`);
586
+ _.error(`Failed to parse message: ${s}`);
588
587
  return;
589
588
  }
590
- (n == null ? void 0 : n.type) === "connected" && (k.info(`WS[${this.id}] Connected`), clearTimeout(r), this.connected = !0, this.sendQueuedMessages()), this.handleWscMessage(n);
591
- }, this._ws.onerror = (a) => {
592
- k.error("WSC: Socket error"), clearTimeout(r), this.connected = !1, this._ws = null;
593
- }, this._ws.onclose = (a) => {
594
- k.info(`WSC: Closed - code:${a.code}, reason:"${a.reason}"`), this.connected = !1, this._ws = null, this.reconnect();
589
+ (n == null ? void 0 : n.type) === "connected" && (_.info(`WS[${this.id}] Connected`), clearTimeout(a), this.connected = !0, this.sendQueuedMessages()), this.handleWscMessage(n);
590
+ }, this._ws.onerror = (r) => {
591
+ _.error("WSC: Socket error"), clearTimeout(a), this.connected = !1, this._ws = null;
592
+ }, this._ws.onclose = (r) => {
593
+ _.info(`WSC: Closed - code:${r.code}, reason:"${r.reason}"`), this.connected = !1, this._ws = null, this.reconnect();
595
594
  };
596
595
  }
597
596
  reconnect() {
@@ -601,10 +600,10 @@ class Mt {
601
600
  }
602
601
  disconnect() {
603
602
  if (!this._ws) {
604
- k.info("WSC: already disconnected");
603
+ _.info("WSC: already disconnected");
605
604
  return;
606
605
  }
607
- k.info("WSC: disconnect"), this._ws.close();
606
+ _.info("WSC: disconnect"), this._ws.close();
608
607
  }
609
608
  async start() {
610
609
  this.started = !0, this.connect();
@@ -616,11 +615,11 @@ class Mt {
616
615
  async startOld() {
617
616
  let e = 1, o = !0;
618
617
  for (; o; ) {
619
- if (k.info(`WSC: start: connecting, attempt ${e}`), await this.connect(), this.connected)
620
- return k.info("WSC: connected"), !0;
618
+ if (_.info(`WSC: start: connecting, attempt ${e}`), await this.connect(), this.connected)
619
+ return _.info("WSC: connected"), !0;
621
620
  e++, o = e <= 4, o && await this.pause(1e3);
622
621
  }
623
- return k.error(`WSC: start: failed to connect after ${e} attempts, exiting`), !1;
622
+ return _.error(`WSC: start: failed to connect after ${e} attempts, exiting`), !1;
624
623
  }
625
624
  handleWscMessage(e) {
626
625
  this.onMessage && typeof this.onMessage == "function" && this.onMessage(e);
@@ -635,7 +634,7 @@ class Mt {
635
634
  sendQueuedMessages() {
636
635
  if (Array.isArray(this.queue) && this.queue.length > 0)
637
636
  for (let e = 0; e < this.queue.length; e++)
638
- k.info("Sending queued message", this.queue[e]), this._ws.send(this.queue[e]);
637
+ _.info("Sending queued message", this.queue[e]), this._ws.send(this.queue[e]);
639
638
  this.queue = [];
640
639
  }
641
640
  // Request assumes that response will be received.
@@ -670,22 +669,22 @@ class Mt {
670
669
  });
671
670
  }*/
672
671
  }
673
- var St = Object.defineProperty, At = Object.getOwnPropertyDescriptor, z = (t, e, o, r) => {
674
- for (var a = r > 1 ? void 0 : r ? At(e, o) : e, s = t.length - 1, n; s >= 0; s--)
675
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
676
- return r && a && St(e, o, a), a;
672
+ var Lt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, I = (t, e, o, a) => {
673
+ for (var r = a > 1 ? void 0 : a ? It(e, o) : e, s = t.length - 1, n; s >= 0; s--)
674
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
675
+ return a && r && Lt(e, o, r), r;
677
676
  };
678
- const S = ce.noConflict();
679
- S.setLevel("info");
677
+ const j = ce.noConflict();
678
+ j.setLevel("info");
680
679
  const F = "cb_";
681
- class L extends X {
680
+ class H extends X {
682
681
  constructor() {
683
682
  super(...arguments), this.actionIdCounter = 0, this.wsClient = null, this.replyMessage = null;
684
683
  }
685
684
  // this is called at startup
686
685
  setSetting(e) {
687
- S.info("appState: Startup: setSetting", e), this.setting = e, this.initBot().catch((o) => {
688
- S.info(`Exception during bot initialization: ${o.message}`);
686
+ j.info("appState: Startup: setSetting"), this.setting = e, this.initBot().catch((o) => {
687
+ j.info(`Exception during bot initialization: ${o.message}`);
689
688
  });
690
689
  }
691
690
  clearConversation() {
@@ -707,30 +706,34 @@ class L extends X {
707
706
  this.theme = e;
708
707
  }
709
708
  async initBot() {
710
- const o = `${this.setting.url.startsWith("localhost") ? "http" : "https"}://${this.setting.url}/api/bot/settings/${this.setting.orgId}/${this.setting.botId}`;
711
- let r = null, a = null;
712
- try {
713
- r = await fetch(o, {
714
- headers: {
715
- "Access-Control-Allow-Origin": "null",
716
- "X-Enegel-Signature": this.setting.botId
717
- }
718
- }), !r.ok || r.status !== 200 ? S.error(`Failed to get bot ${this.setting.botId} settings: ${r.status} ${r.statusText}`) : a = await r.json();
719
- } catch (s) {
720
- S.error(`Failed to get bot ${this.setting.botId} settings: ${s.message}`), a = null;
721
- }
722
- if (!a) {
723
- S.error("No bot settings available - bot disabled"), this.disabled = !0;
724
- return;
709
+ if (!this.botSettingsInitialized) {
710
+ const o = `${this.setting.url.startsWith("localhost") ? "http" : "https"}://${this.setting.url}/api/bot/settings/${this.setting.orgId}/${this.setting.botId}`;
711
+ j.info(`Getting bot settings at ${o} ...`);
712
+ let a = null, r = null;
713
+ try {
714
+ a = await fetch(o, {
715
+ headers: {
716
+ "Access-Control-Allow-Origin": "null",
717
+ "X-Enegel-Signature": this.setting.botId
718
+ }
719
+ }), !a.ok || a.status !== 200 ? j.error(`Failed to get bot ${this.setting.botId} settings: ${a.status} ${a.statusText}`) : r = await a.json();
720
+ } catch (s) {
721
+ j.error(`Failed to get bot ${this.setting.botId} settings: ${s.message}`), r = null;
722
+ }
723
+ if (this.botSettingsInitialized = !0, !r) {
724
+ j.error("No bot settings available - bot disabled"), this.disabled = !0;
725
+ return;
726
+ }
727
+ this.setting.welcomeMessage = (r == null ? void 0 : r.welcomeMessage) || "How can I help ?";
725
728
  }
726
- this.setting.welcomeMessage = (a == null ? void 0 : a.welcomeMessage) || "How can I help ?", Array.isArray(this.messages) && this.messages.length <= 0 && this.addMessage({
729
+ Array.isArray(this.messages) && this.messages.length <= 0 && this.addMessage({
727
730
  author: "assistant",
728
731
  type: "text",
729
732
  data: {
730
733
  text: this.setting.welcomeMessage
731
734
  }
732
- }), this.connectWs === "true" && (S.info("appState: connectWs is true"), this.getWsClient().catch((s) => {
733
- S.error(`Exception during ws client startup: ${s.message}`);
735
+ }), this.connectWs === "true" && (j.info("appState: connectWs is true"), this.getWsClient().catch((e) => {
736
+ j.error(`Exception during ws client startup: ${e.message}`);
734
737
  }));
735
738
  }
736
739
  // Lazy initialization: avoid connecting until we actually need to send something
@@ -740,13 +743,13 @@ class L extends X {
740
743
  if (this.wsClient)
741
744
  return this.wsClient;
742
745
  const o = `${this.setting.url.startsWith("localhost") ? "ws" : "wss"}://${this.setting.url}/api/bot/connect/${this.setting.orgId}/${this.setting.botId}/${this.conversationId}`;
743
- return S.info(`Initiating ws connection to ${o} ...`), this.wsClient = new Mt({
746
+ return j.info(`Initiating ws connection to ${o} ...`), this.wsClient = new Ht({
744
747
  url: o,
745
748
  orgId: this.setting.orgId,
746
749
  botId: this.setting.botId,
747
750
  convId: this.conversationId
748
- }), await this.wsClient.start(), this.wsClient.onMessage = (r) => {
749
- this.handleWscMessage(r);
751
+ }), await this.wsClient.start(), this.wsClient.onMessage = (a) => {
752
+ this.handleWscMessage(a);
750
753
  }, this.wsClient;
751
754
  }
752
755
  handleWscMessage(e) {
@@ -763,8 +766,8 @@ class L extends X {
763
766
  }
764
767
  };
765
768
  "userName" in e && (o.data.userName = e.userName, this.connectWs = "true"), "userAvatar" in e && (o.data.userAvatar = e.userAvatar, this.connectWs = "true");
766
- const r = this.formatMessage(o);
767
- this.messages = this.messages.concat([r]);
769
+ const a = this.formatMessage(o);
770
+ this.messages = this.messages.concat([a]);
768
771
  }
769
772
  break;
770
773
  }
@@ -791,23 +794,23 @@ class L extends X {
791
794
  }
792
795
  addActions(e) {
793
796
  if (Array.isArray(e) && e.length > 0) {
794
- const o = e.map((r) => Object.assign(r, { internalId: this.actionIdCounter++ }));
797
+ const o = e.map((a) => Object.assign(a, { internalId: this.actionIdCounter++ }));
795
798
  this.actions = this.actions.concat(o);
796
799
  }
797
800
  }
798
801
  removeAction(e) {
799
- const o = this.actions.findIndex((r) => r.internalId === e);
802
+ const o = this.actions.findIndex((a) => a.internalId === e);
800
803
  if (o !== -1) {
801
804
  this.actions.splice(o, 1);
802
- const r = [];
803
- this.actions = r.concat(this.actions);
805
+ const a = [];
806
+ this.actions = a.concat(this.actions);
804
807
  }
805
808
  }
806
809
  async sendMessage(e) {
807
- e = this.formatMessage(e), S.info("Send Message:", e), this.messages = this.messages.concat([e]);
810
+ e = this.formatMessage(e), j.info("Send Message:", e), this.messages = this.messages.concat([e]);
808
811
  const o = await this.getWsClient();
809
812
  if (!o) {
810
- S.error("Error - failed to obtain ws client"), this.replyMessage = null;
813
+ j.error("Error - failed to obtain ws client"), this.replyMessage = null;
811
814
  return;
812
815
  }
813
816
  o.sendMessage({
@@ -836,8 +839,8 @@ class L extends X {
836
839
  }
837
840
  // update message
838
841
  updateMessage(e, o) {
839
- const r = this.formatMessage(e);
840
- return r.isThinking = !1, o && (r.data.text += o), this.messages = this.messages.map((a) => a.id === r.id ? r : a), r;
842
+ const a = this.formatMessage(e);
843
+ return a.isThinking = !1, o && (a.data.text += o), this.messages = this.messages.map((r) => r.id === a.id ? a : r), a;
841
844
  }
842
845
  // remove message
843
846
  removeMessage(e) {
@@ -848,28 +851,28 @@ class L extends X {
848
851
  this.messages = [];
849
852
  }
850
853
  }
851
- z([
854
+ I([
852
855
  D({ prefix: F }),
853
- I({ value: "en" })
854
- ], L.prototype, "language", 2);
855
- z([
856
+ L({ value: "en" })
857
+ ], H.prototype, "language", 2);
858
+ I([
856
859
  D({ prefix: F }),
857
- I({ value: "light" })
858
- ], L.prototype, "theme", 2);
859
- z([
860
+ L({ value: "light" })
861
+ ], H.prototype, "theme", 2);
862
+ I([
860
863
  D({ prefix: F }),
861
- I({ value: "false" })
862
- ], L.prototype, "connectWs", 2);
863
- z([
864
+ L({ value: "false" })
865
+ ], H.prototype, "connectWs", 2);
866
+ I([
864
867
  D({ prefix: F }),
865
- I({ value: ye() })
866
- ], L.prototype, "conversationId", 2);
867
- z([
868
+ L({ value: ye() })
869
+ ], H.prototype, "conversationId", 2);
870
+ I([
868
871
  D({ prefix: F }),
869
- I({ type: Array, value: [] })
870
- ], L.prototype, "messages", 2);
871
- z([
872
- I({
872
+ L({ type: Array, value: [] })
873
+ ], H.prototype, "messages", 2);
874
+ I([
875
+ L({
873
876
  type: Array,
874
877
  value: []
875
878
  /*value: [
@@ -889,13 +892,16 @@ z([
889
892
  },
890
893
  ],*/
891
894
  })
892
- ], L.prototype, "actions", 2);
893
- z([
894
- I({ type: Boolean, value: !1 })
895
- ], L.prototype, "disabled", 2);
896
- z([
895
+ ], H.prototype, "actions", 2);
896
+ I([
897
+ L({ type: Boolean, value: !1 })
898
+ ], H.prototype, "botSettingsInitialized", 2);
899
+ I([
900
+ L({ type: Boolean, value: !1 })
901
+ ], H.prototype, "disabled", 2);
902
+ I([
897
903
  D({ prefix: F }),
898
- I({
904
+ L({
899
905
  type: Object,
900
906
  value: {
901
907
  orgId: null,
@@ -904,9 +910,9 @@ z([
904
910
  welcomeMessage: null
905
911
  }
906
912
  })
907
- ], L.prototype, "setting", 2);
908
- const m = new L(), Ht = v`
909
- ${H}
913
+ ], H.prototype, "setting", 2);
914
+ const p = new H(), Pt = x`
915
+ ${O}
910
916
  :host {
911
917
  position: relative;
912
918
  font-weight: bold;
@@ -947,50 +953,50 @@ const m = new L(), Ht = v`
947
953
  color: white;
948
954
  }
949
955
  `;
950
- var Lt = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Pt = (t, e, o, r) => {
951
- for (var a = r > 1 ? void 0 : r ? Ot(e, o) : e, s = t.length - 1, n; s >= 0; s--)
952
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
953
- return r && a && Lt(e, o, a), a;
956
+ var zt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, Tt = (t, e, o, a) => {
957
+ for (var r = a > 1 ? void 0 : a ? Et(e, o) : e, s = t.length - 1, n; s >= 0; s--)
958
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
959
+ return a && r && zt(e, o, r), r;
954
960
  };
955
961
  class C extends le {
956
962
  constructor() {
957
963
  super(...arguments), this.lang = "en";
958
964
  }
959
965
  emit(e, o) {
960
- const r = new CustomEvent(e, {
966
+ const a = new CustomEvent(e, {
961
967
  bubbles: !0,
962
968
  cancelable: !1,
963
969
  composed: !0,
964
970
  detail: {},
965
971
  ...o
966
972
  });
967
- return this.dispatchEvent(r), r;
973
+ return this.dispatchEvent(a), a;
968
974
  }
969
975
  }
970
- Pt([
971
- i({ type: String })
976
+ Tt([
977
+ l({ type: String })
972
978
  ], C.prototype, "lang", 2);
973
- const $e = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8L2.146 2.854Z"/></svg>';
974
- var It = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, Ze = (t, e, o, r) => {
975
- for (var a = r > 1 ? void 0 : r ? zt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
976
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
977
- return r && a && It(e, o, a), a;
979
+ const je = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8L2.146 2.854Z"/></svg>';
980
+ var Rt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Ne = (t, e, o, a) => {
981
+ for (var r = a > 1 ? void 0 : a ? Bt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
982
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
983
+ return a && r && Rt(e, o, r), r;
978
984
  };
979
985
  let te = class extends C {
980
986
  constructor() {
981
987
  super(...arguments), this.title = "ChatBot";
982
988
  }
983
989
  render() {
984
- return l` <header class="cb-header" part="header">
990
+ return c` <header class="cb-header" part="header">
985
991
  <span class="left">
986
992
  <sl-button @click=${this._clickHandler} class="cb-setting-button" variant="text" circle>
987
- <cb-icon color="white" svg="${m.setting.logoSvg}"></cb-icon>
993
+ <cb-icon color="white" svg="${p.setting.logoSvg}"></cb-icon>
988
994
  </sl-button>
989
995
  </span>
990
996
  <span class="center title">${this.title}</span>
991
997
  <span class="right">
992
998
  <sl-button @click=${this._clickCloseHandler} class="cb-setting-button" variant="text" circle>
993
- <cb-icon color="white" svg="${$e}"></cb-icon>
999
+ <cb-icon color="white" svg="${je}"></cb-icon>
994
1000
  </sl-button>
995
1001
  </span>
996
1002
  </header>`;
@@ -1006,15 +1012,15 @@ let te = class extends C {
1006
1012
  });
1007
1013
  }
1008
1014
  };
1009
- te.styles = Ht;
1010
- Ze([
1011
- i({ type: String, attribute: "title" })
1015
+ te.styles = Pt;
1016
+ Ne([
1017
+ l({ type: String, attribute: "title" })
1012
1018
  ], te.prototype, "title", 2);
1013
- te = Ze([
1014
- x("cb-header")
1019
+ te = Ne([
1020
+ k("cb-header")
1015
1021
  ], te);
1016
- const Et = v`
1017
- ${H}
1022
+ const Vt = x`
1023
+ ${O}
1018
1024
  .cb-footer {
1019
1025
  line-height: 60px;
1020
1026
  font-size: 16px;
@@ -1028,17 +1034,17 @@ const Et = v`
1028
1034
  color: var(--primary-color);
1029
1035
  }
1030
1036
  `;
1031
- var Tt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Bt = (t, e, o, r) => {
1032
- for (var a = r > 1 ? void 0 : r ? Rt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1033
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
1034
- return r && a && Tt(e, o, a), a;
1037
+ var qt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, Ft = (t, e, o, a) => {
1038
+ for (var r = a > 1 ? void 0 : a ? Dt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1039
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1040
+ return a && r && qt(e, o, r), r;
1035
1041
  };
1036
1042
  let fe = class extends C {
1037
1043
  constructor() {
1038
1044
  super(...arguments), this.year = (/* @__PURE__ */ new Date()).getFullYear();
1039
1045
  }
1040
1046
  render() {
1041
- return l`
1047
+ return c`
1042
1048
  <div class="cb-footer" part="footer">
1043
1049
  yugasun@${this.year}
1044
1050
  <a
@@ -1068,12 +1074,12 @@ let fe = class extends C {
1068
1074
  `;
1069
1075
  }
1070
1076
  };
1071
- fe.styles = Et;
1072
- fe = Bt([
1073
- x("cb-footer")
1077
+ fe.styles = Vt;
1078
+ fe = Ft([
1079
+ k("cb-footer")
1074
1080
  ], fe);
1075
- const Vt = v`
1076
- ${H}
1081
+ const Ut = x`
1082
+ ${O}
1077
1083
 
1078
1084
  :host {
1079
1085
  width: 100%;
@@ -1168,17 +1174,17 @@ const Vt = v`
1168
1174
  transition: background 0s;
1169
1175
  }
1170
1176
  `;
1171
- var qt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, Ft = (t, e, o, r) => {
1172
- for (var a = r > 1 ? void 0 : r ? Dt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1173
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
1174
- return r && a && qt(e, o, a), a;
1177
+ var Zt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, Wt = (t, e, o, a) => {
1178
+ for (var r = a > 1 ? void 0 : a ? Nt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1179
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1180
+ return a && r && Zt(e, o, r), r;
1175
1181
  };
1176
1182
  let ve = class extends le {
1177
1183
  render() {
1178
- return l` <div class="cb-thinking" style="color: rgb(34, 34, 34);"><span></span><span></span><span></span></div>`;
1184
+ return c` <div class="cb-thinking" style="color: rgb(34, 34, 34);"><span></span><span></span><span></span></div>`;
1179
1185
  }
1180
1186
  };
1181
- ve.styles = v`
1187
+ ve.styles = x`
1182
1188
  .cb-thinking {
1183
1189
  text-align: center;
1184
1190
  }
@@ -1216,31 +1222,31 @@ ve.styles = v`
1216
1222
  }
1217
1223
  }
1218
1224
  `;
1219
- ve = Ft([
1220
- x("cb-thinking")
1225
+ ve = Wt([
1226
+ k("cb-thinking")
1221
1227
  ], ve);
1222
- var Ut = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Ne = (t, e, o, r) => {
1223
- for (var a = r > 1 ? void 0 : r ? Zt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1224
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
1225
- return r && a && Ut(e, o, a), a;
1228
+ var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, We = (t, e, o, a) => {
1229
+ for (var r = a > 1 ? void 0 : a ? Jt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1230
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1231
+ return a && r && Kt(e, o, r), r;
1226
1232
  };
1227
1233
  let oe = class extends C {
1228
1234
  constructor() {
1229
1235
  super(...arguments), this.files = [];
1230
1236
  }
1231
1237
  render() {
1232
- return l` <div class="cb-uploading">
1238
+ return c` <div class="cb-uploading">
1233
1239
  <div class="cb-uploading__title">
1234
1240
  <sl-spinner class="cb-spinner"></sl-spinner>
1235
1241
  <span>Uploading...</span>
1236
1242
  </div>
1237
1243
  <div class="cb-uploading__filelist">
1238
- ${this.files.map((t) => l`${t.name}<br />`)}
1244
+ ${this.files.map((t) => c`${t.name}<br />`)}
1239
1245
  </div>
1240
1246
  </div>`;
1241
1247
  }
1242
1248
  };
1243
- oe.styles = v`
1249
+ oe.styles = x`
1244
1250
  .cb-uploading {
1245
1251
  text-align: left;
1246
1252
  }
@@ -1258,14 +1264,14 @@ oe.styles = v`
1258
1264
  margin-right: 5px;
1259
1265
  }
1260
1266
  `;
1261
- Ne([
1262
- i({ type: Array })
1267
+ We([
1268
+ l({ type: Array })
1263
1269
  ], oe.prototype, "files", 2);
1264
- oe = Ne([
1265
- x("cb-uploading")
1270
+ oe = We([
1271
+ k("cb-uploading")
1266
1272
  ], oe);
1267
- const Nt = v`
1268
- ${H}
1273
+ const Yt = x`
1274
+ ${O}
1269
1275
  :host {
1270
1276
  }
1271
1277
 
@@ -1285,17 +1291,17 @@ const Nt = v`
1285
1291
  margin-right: 0.2em;
1286
1292
  }
1287
1293
  `;
1288
- var Wt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, je = (t, e, o, r) => {
1289
- for (var a = r > 1 ? void 0 : r ? Jt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1290
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
1291
- return r && a && Wt(e, o, a), a;
1294
+ var Gt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Me = (t, e, o, a) => {
1295
+ for (var r = a > 1 ? void 0 : a ? Xt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1296
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1297
+ return a && r && Gt(e, o, r), r;
1292
1298
  };
1293
1299
  let W = class extends le {
1294
1300
  constructor() {
1295
1301
  super(...arguments), this.url = "", this.inverse = !1;
1296
1302
  }
1297
1303
  render() {
1298
- return l`
1304
+ return c`
1299
1305
  <a
1300
1306
  class="
1301
1307
  cb-external-link link__item
@@ -1310,7 +1316,7 @@ let W = class extends le {
1310
1316
  `;
1311
1317
  }
1312
1318
  };
1313
- W.styles = v`
1319
+ W.styles = x`
1314
1320
  :host {
1315
1321
  --primary-color: var(--sl-color-primary-600);
1316
1322
  }
@@ -1335,31 +1341,31 @@ W.styles = v`
1335
1341
  text-decoration: underline;
1336
1342
  }
1337
1343
  `;
1338
- je([
1339
- i({ type: String })
1344
+ Me([
1345
+ l({ type: String })
1340
1346
  ], W.prototype, "url", 2);
1341
- je([
1342
- i({ type: Boolean })
1347
+ Me([
1348
+ l({ type: Boolean })
1343
1349
  ], W.prototype, "inverse", 2);
1344
- W = je([
1345
- x("cb-external-link")
1350
+ W = Me([
1351
+ k("cb-external-link")
1346
1352
  ], W);
1347
- const Kt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-2v-1h2a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.928 15.849v-3.337h1.136v-.662H0v.662h1.134v3.337h.794Zm4.689-3.999h-.894L4.9 13.289h-.035l-.832-1.439h-.932l1.228 1.983l-1.24 2.016h.862l.853-1.415h.035l.85 1.415h.907l-1.253-1.992l1.274-2.007Zm1.93.662v3.337h-.794v-3.337H6.619v-.662h3.064v.662H8.546Z"/></svg>', Yt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm1.217-1.333v3.999h1.46c.401 0 .734-.08.998-.237a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.589-.68c-.264-.156-.599-.234-1.005-.234H3.362Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.14 1.14 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082h-.563v-2.707Zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638H7.896Z"/></svg>', Gt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459c.406 0 .741.078 1.005.234c.263.157.46.383.589.68c.13.297.196.655.196 1.075c0 .422-.066.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562c.186 0 .347-.028.484-.082a.8.8 0 0 0 .334-.252a1.14 1.14 0 0 0 .196-.422c.045-.168.067-.365.067-.592a2.1 2.1 0 0 0-.117-.753a.89.89 0 0 0-.354-.454c-.159-.102-.362-.152-.61-.152Z"/></svg>', Xt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM3.517 14.841a1.13 1.13 0 0 0 .401.823c.13.108.289.192.478.252c.19.061.411.091.665.091c.338 0 .624-.053.859-.158c.236-.105.416-.252.539-.44c.125-.189.187-.408.187-.656c0-.224-.045-.41-.134-.56a1.001 1.001 0 0 0-.375-.357a2.027 2.027 0 0 0-.566-.21l-.621-.144a.97.97 0 0 1-.404-.176a.37.37 0 0 1-.144-.299c0-.156.062-.284.185-.384c.125-.101.296-.152.512-.152c.143 0 .266.023.37.068a.624.624 0 0 1 .246.181a.56.56 0 0 1 .12.258h.75a1.092 1.092 0 0 0-.2-.566a1.21 1.21 0 0 0-.5-.41a1.813 1.813 0 0 0-.78-.152c-.293 0-.551.05-.776.15c-.225.099-.4.24-.527.421c-.127.182-.19.395-.19.639c0 .201.04.376.122.524c.082.149.2.27.352.367c.152.095.332.167.539.213l.618.144c.207.049.361.113.463.193a.387.387 0 0 1 .152.326a.505.505 0 0 1-.085.29a.559.559 0 0 1-.255.193c-.111.047-.249.07-.413.07c-.117 0-.223-.013-.32-.04a.838.838 0 0 1-.248-.115a.578.578 0 0 1-.255-.384h-.765ZM.806 13.693c0-.248.034-.46.102-.633a.868.868 0 0 1 .302-.399a.814.814 0 0 1 .475-.137c.15 0 .283.032.398.097a.7.7 0 0 1 .272.26a.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964a1.441 1.441 0 0 0-.489-.272a1.838 1.838 0 0 0-.606-.097c-.356 0-.66.074-.911.223c-.25.148-.44.359-.572.632c-.13.274-.196.6-.196.979v.498c0 .379.064.704.193.976c.131.271.322.48.572.626c.25.145.554.217.914.217c.293 0 .554-.055.785-.164c.23-.11.414-.26.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.799.799 0 0 1-.118.363a.7.7 0 0 1-.272.25a.874.874 0 0 1-.401.087a.845.845 0 0 1-.478-.132a.833.833 0 0 1-.299-.392a1.699 1.699 0 0 1-.102-.627v-.495Zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879l-1.327 4Z"/></svg>', Qt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.817-1.333h-1.6v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474c.108-.201.161-.427.161-.677c0-.25-.052-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.793.793 0 0 1-.375.082H4.15V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.767-.67v3.336H7.48v-3.337H6.346v-.662h3.065v.662H8.274Z"/></svg>', eo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-7.839 9.166v.522c0 .256-.039.47-.117.641a.861.861 0 0 1-.322.387a.877.877 0 0 1-.469.126a.883.883 0 0 1-.471-.126a.868.868 0 0 1-.32-.386a1.55 1.55 0 0 1-.117-.642v-.522c0-.257.04-.471.117-.641a.868.868 0 0 1 .32-.387a.868.868 0 0 1 .471-.129c.176 0 .332.043.469.13a.861.861 0 0 1 .322.386c.078.17.117.384.117.641Zm.803.519v-.513c0-.377-.068-.7-.205-.972a1.46 1.46 0 0 0-.589-.63c-.254-.147-.56-.22-.917-.22c-.355 0-.662.073-.92.22a1.441 1.441 0 0 0-.589.627c-.136.271-.205.596-.205.975v.513c0 .375.069.7.205.973c.137.271.333.48.59.627c.257.144.564.216.92.216c.357 0 .662-.072.916-.216c.256-.147.452-.356.59-.627c.136-.274.204-.598.204-.973ZM0 11.926v4h1.459c.402 0 .735-.08.999-.238a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.59-.68c-.263-.156-.598-.234-1.004-.234H0Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.141 1.141 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082H.79V12.57Zm7.422.483a1.732 1.732 0 0 0-.103.633v.495c0 .246.034.455.103.627a.834.834 0 0 0 .298.393a.845.845 0 0 0 .478.131a.868.868 0 0 0 .401-.088a.699.699 0 0 0 .273-.248a.8.8 0 0 0 .117-.364h.765v.076a1.268 1.268 0 0 1-.226.674c-.137.194-.32.345-.55.454a1.81 1.81 0 0 1-.786.164c-.36 0-.664-.072-.914-.216a1.424 1.424 0 0 1-.571-.627c-.13-.272-.194-.597-.194-.976v-.498c0-.379.066-.705.197-.978c.13-.274.321-.485.571-.633c.252-.149.556-.223.911-.223c.219 0 .421.032.607.097c.187.062.35.153.489.272a1.326 1.326 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38a.7.7 0 0 0-.273-.261a.802.802 0 0 0-.398-.097a.814.814 0 0 0-.475.138a.868.868 0 0 0-.301.398Z"/></svg>', to = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641a.861.861 0 0 0-.322-.387a.862.862 0 0 0-.469-.129a.868.868 0 0 0-.471.13a.868.868 0 0 0-.32.386a1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387a.883.883 0 0 0 .471.126a.877.877 0 0 0 .469-.126a.861.861 0 0 0 .322-.386a1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216a1.463 1.463 0 0 1-.589-.627a2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975c.137-.274.333-.483.59-.627c.257-.147.564-.22.92-.22c.357 0 .662.073.916.22c.256.146.452.356.59.63c.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235c.264.156.46.382.589.68c.13.296.196.655.196 1.074c0 .422-.065.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398a.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26a.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964a1.44 1.44 0 0 0-.49-.272a1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223c-.25.148-.44.359-.571.633c-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976c.13.271.321.48.571.627c.25.144.555.216.914.216c.293 0 .555-.054.785-.164c.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364a.699.699 0 0 1-.273.248a.874.874 0 0 1-.401.088a.845.845 0 0 1-.478-.131a.834.834 0 0 1-.298-.393a1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006l1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015l-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"/></svg>';
1348
- var oo = Object.defineProperty, ro = Object.getOwnPropertyDescriptor, Me = (t, e, o, r) => {
1349
- for (var a = r > 1 ? void 0 : r ? ro(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1350
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
1351
- return r && a && oo(e, o, a), a;
1353
+ const Qt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-2v-1h2a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.928 15.849v-3.337h1.136v-.662H0v.662h1.134v3.337h.794Zm4.689-3.999h-.894L4.9 13.289h-.035l-.832-1.439h-.932l1.228 1.983l-1.24 2.016h.862l.853-1.415h.035l.85 1.415h.907l-1.253-1.992l1.274-2.007Zm1.93.662v3.337h-.794v-3.337H6.619v-.662h3.064v.662H8.546Z"/></svg>', eo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm1.217-1.333v3.999h1.46c.401 0 .734-.08.998-.237a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.589-.68c-.264-.156-.599-.234-1.005-.234H3.362Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.14 1.14 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082h-.563v-2.707Zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638H7.896Z"/></svg>', to = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459c.406 0 .741.078 1.005.234c.263.157.46.383.589.68c.13.297.196.655.196 1.075c0 .422-.066.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562c.186 0 .347-.028.484-.082a.8.8 0 0 0 .334-.252a1.14 1.14 0 0 0 .196-.422c.045-.168.067-.365.067-.592a2.1 2.1 0 0 0-.117-.753a.89.89 0 0 0-.354-.454c-.159-.102-.362-.152-.61-.152Z"/></svg>', oo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM3.517 14.841a1.13 1.13 0 0 0 .401.823c.13.108.289.192.478.252c.19.061.411.091.665.091c.338 0 .624-.053.859-.158c.236-.105.416-.252.539-.44c.125-.189.187-.408.187-.656c0-.224-.045-.41-.134-.56a1.001 1.001 0 0 0-.375-.357a2.027 2.027 0 0 0-.566-.21l-.621-.144a.97.97 0 0 1-.404-.176a.37.37 0 0 1-.144-.299c0-.156.062-.284.185-.384c.125-.101.296-.152.512-.152c.143 0 .266.023.37.068a.624.624 0 0 1 .246.181a.56.56 0 0 1 .12.258h.75a1.092 1.092 0 0 0-.2-.566a1.21 1.21 0 0 0-.5-.41a1.813 1.813 0 0 0-.78-.152c-.293 0-.551.05-.776.15c-.225.099-.4.24-.527.421c-.127.182-.19.395-.19.639c0 .201.04.376.122.524c.082.149.2.27.352.367c.152.095.332.167.539.213l.618.144c.207.049.361.113.463.193a.387.387 0 0 1 .152.326a.505.505 0 0 1-.085.29a.559.559 0 0 1-.255.193c-.111.047-.249.07-.413.07c-.117 0-.223-.013-.32-.04a.838.838 0 0 1-.248-.115a.578.578 0 0 1-.255-.384h-.765ZM.806 13.693c0-.248.034-.46.102-.633a.868.868 0 0 1 .302-.399a.814.814 0 0 1 .475-.137c.15 0 .283.032.398.097a.7.7 0 0 1 .272.26a.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964a1.441 1.441 0 0 0-.489-.272a1.838 1.838 0 0 0-.606-.097c-.356 0-.66.074-.911.223c-.25.148-.44.359-.572.632c-.13.274-.196.6-.196.979v.498c0 .379.064.704.193.976c.131.271.322.48.572.626c.25.145.554.217.914.217c.293 0 .554-.055.785-.164c.23-.11.414-.26.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.799.799 0 0 1-.118.363a.7.7 0 0 1-.272.25a.874.874 0 0 1-.401.087a.845.845 0 0 1-.478-.132a.833.833 0 0 1-.299-.392a1.699 1.699 0 0 1-.102-.627v-.495Zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879l-1.327 4Z"/></svg>', ro = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.817-1.333h-1.6v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474c.108-.201.161-.427.161-.677c0-.25-.052-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.793.793 0 0 1-.375.082H4.15V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.767-.67v3.336H7.48v-3.337H6.346v-.662h3.065v.662H8.274Z"/></svg>', ao = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-7.839 9.166v.522c0 .256-.039.47-.117.641a.861.861 0 0 1-.322.387a.877.877 0 0 1-.469.126a.883.883 0 0 1-.471-.126a.868.868 0 0 1-.32-.386a1.55 1.55 0 0 1-.117-.642v-.522c0-.257.04-.471.117-.641a.868.868 0 0 1 .32-.387a.868.868 0 0 1 .471-.129c.176 0 .332.043.469.13a.861.861 0 0 1 .322.386c.078.17.117.384.117.641Zm.803.519v-.513c0-.377-.068-.7-.205-.972a1.46 1.46 0 0 0-.589-.63c-.254-.147-.56-.22-.917-.22c-.355 0-.662.073-.92.22a1.441 1.441 0 0 0-.589.627c-.136.271-.205.596-.205.975v.513c0 .375.069.7.205.973c.137.271.333.48.59.627c.257.144.564.216.92.216c.357 0 .662-.072.916-.216c.256-.147.452-.356.59-.627c.136-.274.204-.598.204-.973ZM0 11.926v4h1.459c.402 0 .735-.08.999-.238a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.59-.68c-.263-.156-.598-.234-1.004-.234H0Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.141 1.141 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082H.79V12.57Zm7.422.483a1.732 1.732 0 0 0-.103.633v.495c0 .246.034.455.103.627a.834.834 0 0 0 .298.393a.845.845 0 0 0 .478.131a.868.868 0 0 0 .401-.088a.699.699 0 0 0 .273-.248a.8.8 0 0 0 .117-.364h.765v.076a1.268 1.268 0 0 1-.226.674c-.137.194-.32.345-.55.454a1.81 1.81 0 0 1-.786.164c-.36 0-.664-.072-.914-.216a1.424 1.424 0 0 1-.571-.627c-.13-.272-.194-.597-.194-.976v-.498c0-.379.066-.705.197-.978c.13-.274.321-.485.571-.633c.252-.149.556-.223.911-.223c.219 0 .421.032.607.097c.187.062.35.153.489.272a1.326 1.326 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38a.7.7 0 0 0-.273-.261a.802.802 0 0 0-.398-.097a.814.814 0 0 0-.475.138a.868.868 0 0 0-.301.398Z"/></svg>', so = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641a.861.861 0 0 0-.322-.387a.862.862 0 0 0-.469-.129a.868.868 0 0 0-.471.13a.868.868 0 0 0-.32.386a1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387a.883.883 0 0 0 .471.126a.877.877 0 0 0 .469-.126a.861.861 0 0 0 .322-.386a1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216a1.463 1.463 0 0 1-.589-.627a2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975c.137-.274.333-.483.59-.627c.257-.147.564-.22.92-.22c.357 0 .662.073.916.22c.256.146.452.356.59.63c.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235c.264.156.46.382.589.68c.13.296.196.655.196 1.074c0 .422-.065.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398a.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26a.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964a1.44 1.44 0 0 0-.49-.272a1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223c-.25.148-.44.359-.571.633c-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976c.13.271.321.48.571.627c.25.144.555.216.914.216c.293 0 .555-.054.785-.164c.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364a.699.699 0 0 1-.273.248a.874.874 0 0 1-.401.088a.845.845 0 0 1-.478-.131a.834.834 0 0 1-.298-.393a1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006l1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015l-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"/></svg>';
1354
+ var no = Object.defineProperty, io = Object.getOwnPropertyDescriptor, Se = (t, e, o, a) => {
1355
+ for (var r = a > 1 ? void 0 : a ? io(e, o) : e, s = t.length - 1, n; s >= 0; s--)
1356
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
1357
+ return a && r && no(e, o, r), r;
1352
1358
  };
1353
1359
  const Pe = {
1354
- pdf: Yt,
1355
- txt: Kt,
1356
- md: Gt,
1357
- csv: Xt,
1358
- ppd: Qt,
1359
- doc: eo,
1360
- docx: to
1360
+ pdf: eo,
1361
+ txt: Qt,
1362
+ md: to,
1363
+ csv: oo,
1364
+ ppd: ro,
1365
+ doc: ao,
1366
+ docx: so
1361
1367
  };
1362
- let J = class extends C {
1368
+ let K = class extends C {
1363
1369
  constructor() {
1364
1370
  super(...arguments), this.filename = "", this.url = "";
1365
1371
  }
@@ -1371,7 +1377,7 @@ let J = class extends C {
1371
1377
  return e ? e.toLowerCase() : t;
1372
1378
  }
1373
1379
  render() {
1374
- return l`
1380
+ return c`
1375
1381
  <cb-external-link url="${this.url}" inverse>
1376
1382
  <div class="cb-file">
1377
1383
  ${this.renderFileIcon()}
@@ -1381,7 +1387,7 @@ let J = class extends C {
1381
1387
  `;
1382
1388
  }
1383
1389
  renderFileIcon() {
1384
- return l`
1390
+ return c`
1385
1391
  <cb-icon
1386
1392
  class="cb-file-icon"
1387
1393
  svg="${Pe[this.type] || Pe.txt}"
@@ -1389,17 +1395,17 @@ let J = class extends C {
1389
1395
  `;
1390
1396
  }
1391
1397
  };
1392
- J.styles = Nt;
1393
- Me([
1394
- i({ type: String })
1395
- ], J.prototype, "filename", 2);
1396
- Me([
1397
- i({ type: String })
1398
- ], J.prototype, "url", 2);
1399
- J = Me([
1400
- x("cb-file")
1401
- ], J);
1402
- const ao = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"/></g></svg>', so = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 8a3 3 0 1 0 0-6a3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0a2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1s1-4 6-4s6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664h10Z"/></svg>', no = v`
1398
+ K.styles = Yt;
1399
+ Se([
1400
+ l({ type: String })
1401
+ ], K.prototype, "filename", 2);
1402
+ Se([
1403
+ l({ type: String })
1404
+ ], K.prototype, "url", 2);
1405
+ K = Se([
1406
+ k("cb-file")
1407
+ ], K);
1408
+ const lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"/></g></svg>', co = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 8a3 3 0 1 0 0-6a3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0a2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1s1-4 6-4s6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664h10Z"/></svg>', po = x`
1403
1409
  pre code.hljs {
1404
1410
  display: block;
1405
1411
  overflow-x: auto;
@@ -2564,9 +2570,9 @@ const ao = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="curr
2564
2570
  pre {
2565
2571
  background-color: #282c34;
2566
2572
  }
2567
- `, io = v`
2568
- ${H}
2569
- ${no}
2573
+ `, ho = x`
2574
+ ${O}
2575
+ ${po}
2570
2576
 
2571
2577
  .cb-message-row {
2572
2578
  width: 100%;
@@ -2720,20 +2726,20 @@ const ao = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="curr
2720
2726
  font-size: 1em;
2721
2727
  }
2722
2728
  `;
2723
- function lo() {
2724
- const t = new lt({
2729
+ function uo() {
2730
+ const t = new ut({
2725
2731
  linkify: !0
2726
2732
  });
2727
- return t.use(dt, { attrs: { target: "_blank", rel: "noopener" } }), t.use(ct), t;
2733
+ return t.use(gt, { attrs: { target: "_blank", rel: "noopener" } }), t;
2728
2734
  }
2729
- async function Ie(t) {
2730
- const e = lo();
2731
- return l`${Z(e.render(t))}`;
2735
+ async function ze(t) {
2736
+ const e = uo();
2737
+ return c`${Z(e.render(t))}`;
2732
2738
  }
2733
- var co = Object.defineProperty, po = Object.getOwnPropertyDescriptor, de = (t, e, o, r) => {
2734
- for (var a = r > 1 ? void 0 : r ? po(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2735
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
2736
- return r && a && co(e, o, a), a;
2739
+ var go = Object.defineProperty, bo = Object.getOwnPropertyDescriptor, de = (t, e, o, a) => {
2740
+ for (var r = a > 1 ? void 0 : a ? bo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2741
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
2742
+ return a && r && go(e, o, r), r;
2737
2743
  };
2738
2744
  let V = class extends C {
2739
2745
  constructor() {
@@ -2762,9 +2768,9 @@ let V = class extends C {
2762
2768
  _addCopyEvents() {
2763
2769
  this.copyBtns.forEach((t) => {
2764
2770
  t.addEventListener("click", () => {
2765
- var o, r;
2766
- const e = (r = (o = t.parentElement) == null ? void 0 : o.nextElementSibling) == null ? void 0 : r.textContent;
2767
- e && $t(e).then(() => {
2771
+ var o, a;
2772
+ const e = (a = (o = t.parentElement) == null ? void 0 : o.nextElementSibling) == null ? void 0 : a.textContent;
2773
+ e && At(e).then(() => {
2768
2774
  t.textContent = "Success", setTimeout(() => {
2769
2775
  t.textContent = "Copy";
2770
2776
  }, 500);
@@ -2781,7 +2787,7 @@ let V = class extends C {
2781
2787
  render() {
2782
2788
  return B(
2783
2789
  this.message.data || this.message.isThinking,
2784
- () => l`
2790
+ () => c`
2785
2791
  <div class="cb-message-row" part="cb-message-row">
2786
2792
  <!-- message -->
2787
2793
  ${B(
@@ -2795,15 +2801,15 @@ let V = class extends C {
2795
2801
  );
2796
2802
  }
2797
2803
  renderButtons(t = "left") {
2798
- return l`<div class="cb-message__buttons ${t}">
2804
+ return c`<div class="cb-message__buttons ${t}">
2799
2805
  <!-- delete button -->
2800
2806
  <sl-button class="cb-message__delete-button" name="trash" @click=${this._removeMessageHandler} circle variant="text" size="small">
2801
- <cb-icon svg="${ao}" style="font-size: 1em !important;"></cb-icon>
2807
+ <cb-icon svg="${lo}" style="font-size: 1em !important;"></cb-icon>
2802
2808
  </sl-button>
2803
2809
  </div>`;
2804
2810
  }
2805
2811
  renderMessage(t) {
2806
- return l`
2812
+ return c`
2807
2813
  <div
2808
2814
  class="cb-message__content
2809
2815
  ${t.author}-message
@@ -2816,38 +2822,38 @@ let V = class extends C {
2816
2822
  `;
2817
2823
  }
2818
2824
  async _getMessageText(t) {
2819
- return Ie(t.data.text);
2825
+ return ze(t.data.text);
2820
2826
  }
2821
2827
  renderMessageContent(t) {
2822
2828
  var e;
2823
- return t.isThinking ? l`<cb-thinking></cb-thinking>` : t.isUploading ? l`<cb-uploading .files="${t.data.files || []}"></cb-uploading>` : t.type === "text" ? l`<div class="cb-message-text">
2829
+ return t.isThinking ? c`<cb-thinking></cb-thinking>` : t.isUploading ? c`<cb-uploading .files="${t.data.files || []}"></cb-uploading>` : t.type === "text" ? c`<div class="cb-message-text">
2824
2830
  ${B(
2825
2831
  t.data.userName,
2826
- () => l`<div style="font-size: 12px; color:#9ca3af">${t.data.userName}</div>`,
2832
+ () => c`<div style="font-size: 12px; color:#9ca3af">${t.data.userName}</div>`,
2827
2833
  () => null
2828
2834
  )}
2829
- ${Oe(
2830
- this._getMessageText(t).then((o) => l`${o}`)
2835
+ ${Ie(
2836
+ this._getMessageText(t).then((o) => c`${o}`)
2831
2837
  )}
2832
- </div>` : t.type === "file" ? l`${me(
2838
+ </div>` : t.type === "file" ? c`${me(
2833
2839
  t.data.files || [],
2834
2840
  (o) => o.id,
2835
- (o) => l`<cb-file filename="${o.name}" url="${o.url}"></cb-file>`
2836
- )}` : l`<div class="cb-message-text">
2837
- ${Oe(
2838
- Ie(((e = t.data.text) == null ? void 0 : e.toString()) || "").then((o) => l`${o}`)
2841
+ (o) => c`<cb-file filename="${o.name}" url="${o.url}"></cb-file>`
2842
+ )}` : c`<div class="cb-message-text">
2843
+ ${Ie(
2844
+ ze(((e = t.data.text) == null ? void 0 : e.toString()) || "").then((o) => c`${o}`)
2839
2845
  )}
2840
2846
  </div>`;
2841
2847
  }
2842
2848
  renderBotMessageAvatar(t) {
2843
2849
  if (t.data.userName && t.data.userName !== "") {
2844
2850
  const e = t.data.userAvatar || "";
2845
- return l` <img src="${e}" style="width: 24px;height: 24px;" /> `;
2851
+ return c` <img src="${e}" style="width: 24px;height: 24px;" /> `;
2846
2852
  }
2847
- return t.author === "system" ? Le`${Z(m.setting.systemIconSvg)}` : Le`${Z(m.setting.botIconSvg)}`;
2853
+ return t.author === "system" ? Le`${Z(p.setting.systemIconSvg)}` : Le`${Z(p.setting.botIconSvg)}`;
2848
2854
  }
2849
2855
  renderBotMessage(t) {
2850
- return l`
2856
+ return c`
2851
2857
  <div class="cb-message cb-bot-message-wrapper" part="cb-message">
2852
2858
  <div class="avatar assistant-avatar xsmall" style="margin-top:4px;">${this.renderBotMessageAvatar(t)}</div>
2853
2859
  <div style="margin-left: 4px;width: 100%">${this.renderMessage(t)}</div>
@@ -2855,34 +2861,34 @@ let V = class extends C {
2855
2861
  `;
2856
2862
  }
2857
2863
  renderUserMessage(t) {
2858
- return l`
2864
+ return c`
2859
2865
  <div class="cb-message" part="cb-message" style="display: flex; justify-content: end;align-items: start;">
2860
2866
  <!--<sl-avatar class="avatar user-avatar small" label="User">
2861
- <cb-icon slot="icon" svg="${so}" color="white"></cb-icon>
2867
+ <cb-icon slot="icon" svg="${co}" color="white"></cb-icon>
2862
2868
  </sl-avatar>-->
2863
- <div class="avatar user-avatar">${Z(m.setting.userIconSvg)}</div>
2869
+ <div class="avatar user-avatar">${Z(p.setting.userIconSvg)}</div>
2864
2870
  ${this.renderMessage(t)}
2865
2871
  </div>
2866
2872
  `;
2867
2873
  }
2868
2874
  };
2869
- V.styles = io;
2875
+ V.styles = ho;
2870
2876
  de([
2871
- i({ type: Object })
2877
+ l({ type: Object })
2872
2878
  ], V.prototype, "message", 2);
2873
2879
  de([
2874
- i({ type: String })
2880
+ l({ type: String })
2875
2881
  ], V.prototype, "type", 2);
2876
2882
  de([
2877
- it(".code-block-header__copy")
2883
+ ht(".code-block-header__copy")
2878
2884
  ], V.prototype, "copyBtns", 2);
2879
2885
  V = de([
2880
- x("cb-message")
2886
+ k("cb-message")
2881
2887
  ], V);
2882
- var ho = Object.defineProperty, uo = Object.getOwnPropertyDescriptor, K = (t, e, o, r) => {
2883
- for (var a = r > 1 ? void 0 : r ? uo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2884
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
2885
- return r && a && ho(e, o, a), a;
2888
+ var mo = Object.defineProperty, yo = Object.getOwnPropertyDescriptor, J = (t, e, o, a) => {
2889
+ for (var r = a > 1 ? void 0 : a ? yo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2890
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
2891
+ return a && r && mo(e, o, r), r;
2886
2892
  };
2887
2893
  const Q = ce.noConflict();
2888
2894
  Q.setLevel("info");
@@ -2891,19 +2897,19 @@ let R = class extends C {
2891
2897
  super(...arguments), this.messages = [], this.actions = [], this.calendlyInjected = !1, this.activeCalendlyAction = -1;
2892
2898
  }
2893
2899
  render() {
2894
- return l`
2900
+ return c`
2895
2901
  <div class="cb-message-list" part="cb-message-list">
2896
2902
  ${me(
2897
2903
  this.messages,
2898
2904
  (t) => t.id + JSON.stringify(t.data),
2899
- (t) => l`<cb-message .message="${t}"></cb-message>`
2905
+ (t) => c`<cb-message .message="${t}"></cb-message>`
2900
2906
  )}
2901
2907
  ${this.renderActions()}
2902
2908
  </div>
2903
2909
  `;
2904
2910
  }
2905
2911
  renderActions() {
2906
- return !Array.isArray(this.actions) || this.actions.length <= 0 ? null : l`
2912
+ return !Array.isArray(this.actions) || this.actions.length <= 0 ? null : c`
2907
2913
  <div class="cb-actions-list">
2908
2914
  ${me(
2909
2915
  this.actions,
@@ -2926,7 +2932,7 @@ let R = class extends C {
2926
2932
  switch (Q.info("Got Calendly Event:", t.data), t.data.event) {
2927
2933
  case "calendly.event_scheduled": {
2928
2934
  const e = this.activeCalendlyAction;
2929
- e >= 0 && (m.removeAction(e), m.addSystemMessage("Your meeting has been scheduled!"), this.activeCalendlyAction = -1);
2935
+ e >= 0 && (p.removeAction(e), p.addSystemMessage("Your meeting has been scheduled!"), this.activeCalendlyAction = -1);
2930
2936
  }
2931
2937
  }
2932
2938
  }
@@ -2941,11 +2947,11 @@ let R = class extends C {
2941
2947
  let e = document.createElement("link");
2942
2948
  e.href = "https://assets.calendly.com/assets/external/widget.css", e.rel = "stylesheet", document.body.appendChild(e);
2943
2949
  let o = document.createElement("script");
2944
- o.type = "text/javascript", o.src = "https://assets.calendly.com/assets/external/widget.js", document.body.appendChild(o), console.log("Injected Calendly"), window.addEventListener("message", (r) => {
2945
- r.origin === "https://calendly.com" && r.data.event && r.data.event.indexOf("calendly.") !== -1 && this.handleCalendlyEvent(r);
2950
+ o.type = "text/javascript", o.src = "https://assets.calendly.com/assets/external/widget.js", document.body.appendChild(o), console.log("Injected Calendly"), window.addEventListener("message", (a) => {
2951
+ a.origin === "https://calendly.com" && a.data.event && a.data.event.indexOf("calendly.") !== -1 && this.handleCalendlyEvent(a);
2946
2952
  }), this.calendlyInjected = !0;
2947
2953
  }
2948
- return l`
2954
+ return c`
2949
2955
  <div class="cb-actions-list">
2950
2956
  <div class="cb-action ripple" @click="${this.invokeCalendlyAction.bind(this, t)}">
2951
2957
  <div class="cb-action-icon">
@@ -2962,7 +2968,7 @@ let R = class extends C {
2962
2968
  `;
2963
2969
  }
2964
2970
  renderLinkAction(t) {
2965
- return l`
2971
+ return c`
2966
2972
  <div class="cb-actions-list">
2967
2973
  <div class="cb-action ripple" @click="${this.invokeLinkAction.bind(this, t)}">
2968
2974
  <div class="cb-action-icon">
@@ -2976,24 +2982,24 @@ let R = class extends C {
2976
2982
  `;
2977
2983
  }
2978
2984
  };
2979
- R.styles = Vt;
2980
- K([
2981
- i({ type: Array })
2985
+ R.styles = Ut;
2986
+ J([
2987
+ l({ type: Array })
2982
2988
  ], R.prototype, "messages", 2);
2983
- K([
2984
- i({ type: Array })
2989
+ J([
2990
+ l({ type: Array })
2985
2991
  ], R.prototype, "actions", 2);
2986
- K([
2987
- Ve({ capture: !1, passive: !0 })
2992
+ J([
2993
+ qe({ capture: !1, passive: !0 })
2988
2994
  ], R.prototype, "invokeLinkAction", 1);
2989
- K([
2990
- Ve({ capture: !1, passive: !0 })
2995
+ J([
2996
+ qe({ capture: !1, passive: !0 })
2991
2997
  ], R.prototype, "invokeCalendlyAction", 1);
2992
- R = K([
2993
- x("cb-message-list")
2998
+ R = J([
2999
+ k("cb-message-list")
2994
3000
  ], R);
2995
- const go = v`
2996
- ${H}
3001
+ const fo = x`
3002
+ ${O}
2997
3003
 
2998
3004
  :host {
2999
3005
  width: 100%;
@@ -3035,11 +3041,11 @@ const go = v`
3035
3041
  .cb-input-buttons {
3036
3042
  padding: 0 5px;
3037
3043
  }
3038
- `, bo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576L6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76l7.494-7.493Z"/></svg>', mo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0V3z"/></svg>';
3039
- var yo = Object.defineProperty, fo = Object.getOwnPropertyDescriptor, O = (t, e, o, r) => {
3040
- for (var a = r > 1 ? void 0 : r ? fo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3041
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
3042
- return r && a && yo(e, o, a), a;
3044
+ `, vo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576L6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76l7.494-7.493Z"/></svg>', wo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0V3z"/></svg>';
3045
+ var xo = Object.defineProperty, ko = Object.getOwnPropertyDescriptor, P = (t, e, o, a) => {
3046
+ for (var r = a > 1 ? void 0 : a ? ko(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3047
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3048
+ return a && r && xo(e, o, r), r;
3043
3049
  };
3044
3050
  let A = class extends C {
3045
3051
  constructor() {
@@ -3062,7 +3068,7 @@ let A = class extends C {
3062
3068
  }), this.value = "", this.inputElement.blur();
3063
3069
  }
3064
3070
  async _sendFileHandler() {
3065
- const t = await jt();
3071
+ const t = await Ot();
3066
3072
  this.emit("message:send:file", {
3067
3073
  detail: {
3068
3074
  files: t
@@ -3070,7 +3076,7 @@ let A = class extends C {
3070
3076
  });
3071
3077
  }
3072
3078
  render() {
3073
- return l`
3079
+ return c`
3074
3080
  <div class="cb-user-input-wrapper" part="user-input-wrapper">
3075
3081
  <sl-textarea
3076
3082
  @sl-input=${this._inputChangeHandler}
@@ -3089,7 +3095,7 @@ let A = class extends C {
3089
3095
  <span class="cb-input-buttons">
3090
3096
  ${B(
3091
3097
  this.enableFileUpload,
3092
- () => l`
3098
+ () => c`
3093
3099
  <sl-button
3094
3100
  @click=${this._sendFileHandler}
3095
3101
  name="paperclip"
@@ -3099,7 +3105,7 @@ let A = class extends C {
3099
3105
  variant="text"
3100
3106
  circle
3101
3107
  >
3102
- <cb-icon svg="${mo}"></cb-icon>
3108
+ <cb-icon svg="${wo}"></cb-icon>
3103
3109
  <!-- select file input -->
3104
3110
  <input
3105
3111
  type="file"
@@ -3109,7 +3115,7 @@ let A = class extends C {
3109
3115
  />
3110
3116
  </sl-button>
3111
3117
  `,
3112
- () => l``
3118
+ () => c``
3113
3119
  )}
3114
3120
  <sl-button
3115
3121
  @click=${this._sendHandler}
@@ -3122,7 +3128,7 @@ let A = class extends C {
3122
3128
  ?loading=${this.loading}
3123
3129
  circle
3124
3130
  >
3125
- <cb-icon svg="${bo}"></cb-icon>
3131
+ <cb-icon svg="${vo}"></cb-icon>
3126
3132
  </sl-button>
3127
3133
  </span>
3128
3134
  </div>
@@ -3132,36 +3138,36 @@ let A = class extends C {
3132
3138
  t.key === "Enter" && !t.shiftKey && this._sendHandler();
3133
3139
  }
3134
3140
  };
3135
- A.styles = go;
3136
- O([
3137
- i({ type: String, attribute: "placeholder" })
3141
+ A.styles = fo;
3142
+ P([
3143
+ l({ type: String, attribute: "placeholder" })
3138
3144
  ], A.prototype, "placeholder", 2);
3139
- O([
3140
- i({ type: String, attribute: "send-button-label" })
3145
+ P([
3146
+ l({ type: String, attribute: "send-button-label" })
3141
3147
  ], A.prototype, "sendButtonLabel", 2);
3142
- O([
3143
- i({ type: Boolean, attribute: "enable-file-upload" })
3148
+ P([
3149
+ l({ type: Boolean, attribute: "enable-file-upload" })
3144
3150
  ], A.prototype, "enableFileUpload", 2);
3145
- O([
3146
- i({ type: String })
3151
+ P([
3152
+ l({ type: String })
3147
3153
  ], A.prototype, "value", 2);
3148
- O([
3149
- i({ type: Boolean })
3154
+ P([
3155
+ l({ type: Boolean })
3150
3156
  ], A.prototype, "loading", 2);
3151
- O([
3152
- i({ type: Boolean })
3157
+ P([
3158
+ l({ type: Boolean })
3153
3159
  ], A.prototype, "disabled", 2);
3154
- O([
3155
- i({ type: String })
3160
+ P([
3161
+ l({ type: String })
3156
3162
  ], A.prototype, "currentKey", 2);
3157
- O([
3158
- _e("sl-textarea")
3163
+ P([
3164
+ Ce("sl-textarea")
3159
3165
  ], A.prototype, "inputElement", 2);
3160
- A = O([
3161
- x("cb-user-input")
3166
+ A = P([
3167
+ k("cb-user-input")
3162
3168
  ], A);
3163
- const vo = v`
3164
- ${H}
3169
+ const _o = x`
3170
+ ${O}
3165
3171
 
3166
3172
  sl-dialog::part(base) {
3167
3173
  z-index: 1000;
@@ -3195,10 +3201,10 @@ const vo = v`
3195
3201
  gap: 8px;
3196
3202
  }
3197
3203
  `;
3198
- var wo = Object.defineProperty, xo = Object.getOwnPropertyDescriptor, pe = (t, e, o, r) => {
3199
- for (var a = r > 1 ? void 0 : r ? xo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3200
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
3201
- return r && a && wo(e, o, a), a;
3204
+ var Co = Object.defineProperty, $o = Object.getOwnPropertyDescriptor, pe = (t, e, o, a) => {
3205
+ for (var r = a > 1 ? void 0 : a ? $o(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3206
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3207
+ return a && r && Co(e, o, r), r;
3202
3208
  };
3203
3209
  let q = class extends C {
3204
3210
  constructor() {
@@ -3208,7 +3214,7 @@ let q = class extends C {
3208
3214
  this.emit("cancel");
3209
3215
  }
3210
3216
  render() {
3211
- return l` <sl-dialog
3217
+ return c` <sl-dialog
3212
3218
  label="Setting"
3213
3219
  class="cb-dialog"
3214
3220
  style="sl-dialog::part(base) { z-index: ${this.zindex}; }"
@@ -3218,7 +3224,7 @@ let q = class extends C {
3218
3224
  >
3219
3225
  <header class="cb-header">
3220
3226
  <div class="cb-header__left">
3221
- ${this.label ? l`<span class="title">${this.label}</span>` : ""}
3227
+ ${this.label ? c`<span class="title">${this.label}</span>` : ""}
3222
3228
  </div>
3223
3229
  <sl-button
3224
3230
  @click=${this._settingCancelHandler}
@@ -3231,7 +3237,7 @@ let q = class extends C {
3231
3237
  <cb-icon
3232
3238
  color="default"
3233
3239
  style="font-size: 1em;"
3234
- svg="${$e}"
3240
+ svg="${je}"
3235
3241
  ></cb-icon>
3236
3242
  </sl-button>
3237
3243
  </header>
@@ -3244,30 +3250,30 @@ let q = class extends C {
3244
3250
  </sl-dialog>`;
3245
3251
  }
3246
3252
  };
3247
- q.styles = vo;
3253
+ q.styles = _o;
3248
3254
  pe([
3249
- i({ type: Boolean })
3255
+ l({ type: Boolean })
3250
3256
  ], q.prototype, "open", 2);
3251
3257
  pe([
3252
- i({ type: String, attribute: "label" })
3258
+ l({ type: String, attribute: "label" })
3253
3259
  ], q.prototype, "label", 2);
3254
3260
  pe([
3255
- i({ type: Number })
3261
+ l({ type: Number })
3256
3262
  ], q.prototype, "zindex", 2);
3257
3263
  q = pe([
3258
- x("cb-dialog")
3264
+ k("cb-dialog")
3259
3265
  ], q);
3260
- var ko = Object.defineProperty, _o = Object.getOwnPropertyDescriptor, We = (t, e, o, r) => {
3261
- for (var a = r > 1 ? void 0 : r ? _o(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3262
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
3263
- return r && a && ko(e, o, a), a;
3266
+ var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, Ke = (t, e, o, a) => {
3267
+ for (var r = a > 1 ? void 0 : a ? Mo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3268
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3269
+ return a && r && jo(e, o, r), r;
3264
3270
  };
3265
3271
  let re = class extends C {
3266
3272
  constructor() {
3267
3273
  super(...arguments), this.open = !1;
3268
3274
  }
3269
3275
  render() {
3270
- return l` <cb-dialog
3276
+ return c` <cb-dialog
3271
3277
  label="Confirm"
3272
3278
  class="cb-clear-message-dialog"
3273
3279
  ?open=${this.open}
@@ -3296,7 +3302,7 @@ let re = class extends C {
3296
3302
  this.emit("cancel");
3297
3303
  }
3298
3304
  };
3299
- re.styles = v`
3305
+ re.styles = x`
3300
3306
  .cb-clear-message-dialog {
3301
3307
  }
3302
3308
 
@@ -3304,13 +3310,13 @@ re.styles = v`
3304
3310
  z-index: 1000;
3305
3311
  }
3306
3312
  `;
3307
- We([
3308
- i({ type: Boolean })
3313
+ Ke([
3314
+ l({ type: Boolean })
3309
3315
  ], re.prototype, "open", 2);
3310
- re = We([
3311
- x("cb-clear-message-dialog")
3316
+ re = Ke([
3317
+ k("cb-clear-message-dialog")
3312
3318
  ], re);
3313
- const Co = v`
3319
+ const So = x`
3314
3320
  :host {
3315
3321
  // width: 380px;
3316
3322
 
@@ -3370,17 +3376,17 @@ const Co = v`
3370
3376
  grid-column-start: 2;
3371
3377
  }
3372
3378
  `;
3373
- var $o = Object.defineProperty, jo = Object.getOwnPropertyDescriptor, U = (t, e, o, r) => {
3374
- for (var a = r > 1 ? void 0 : r ? jo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3375
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
3376
- return r && a && $o(e, o, a), a;
3379
+ var Ao = Object.defineProperty, Oo = Object.getOwnPropertyDescriptor, U = (t, e, o, a) => {
3380
+ for (var r = a > 1 ? void 0 : a ? Oo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3381
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3382
+ return a && r && Ao(e, o, r), r;
3377
3383
  };
3378
- let P = class extends C {
3384
+ let z = class extends C {
3379
3385
  constructor() {
3380
3386
  super(...arguments), this.open = !1, this.clearMessageDialogOpen = !1, this.customRequest = !1;
3381
3387
  }
3382
3388
  render() {
3383
- return this.customRequest = this.setting.customRequest, l`
3389
+ return this.customRequest = this.setting.customRequest, c`
3384
3390
  <cb-dialog
3385
3391
  label="Setting"
3386
3392
  class="cb-dialog"
@@ -3473,7 +3479,7 @@ let P = class extends C {
3473
3479
  `;
3474
3480
  }
3475
3481
  renderInternalServices() {
3476
- return l`
3482
+ return c`
3477
3483
  <div class="form-item">
3478
3484
  <label class="label">Service</label>
3479
3485
  <sl-radio-group name="openai" value="openai" size="small">
@@ -3511,13 +3517,13 @@ let P = class extends C {
3511
3517
  }
3512
3518
  // input change handler
3513
3519
  _inputChangeHandler(t) {
3514
- const { name: e, value: o } = t.target, [r, a] = e.split(".");
3515
- a ? this.setting[r][a] = o : this.setting[r] = o;
3520
+ const { name: e, value: o } = t.target, [a, r] = e.split(".");
3521
+ r ? this.setting[a][r] = o : this.setting[a] = o;
3516
3522
  }
3517
3523
  // checked change handler
3518
3524
  _checkChangeHandler(t) {
3519
- const { name: e, checked: o } = t.target, [r, a] = e.split(".");
3520
- a ? this.setting[r][a] = o : this.setting[r] = o, r === "customRequest" && (this.customRequest = o);
3525
+ const { name: e, checked: o } = t.target, [a, r] = e.split(".");
3526
+ r ? this.setting[a][r] = o : this.setting[a] = o, a === "customRequest" && (this.customRequest = o);
3521
3527
  }
3522
3528
  // emit setting confirm event
3523
3529
  _settingConfirmHandler() {
@@ -3538,27 +3544,27 @@ let P = class extends C {
3538
3544
  });
3539
3545
  }
3540
3546
  };
3541
- P.styles = Co;
3547
+ z.styles = So;
3542
3548
  U([
3543
- i({ type: Boolean })
3544
- ], P.prototype, "open", 2);
3549
+ l({ type: Boolean })
3550
+ ], z.prototype, "open", 2);
3545
3551
  U([
3546
- i({ type: Object })
3547
- ], P.prototype, "setting", 2);
3552
+ l({ type: Object })
3553
+ ], z.prototype, "setting", 2);
3548
3554
  U([
3549
- i({ type: Boolean })
3550
- ], P.prototype, "clearMessageDialogOpen", 2);
3555
+ l({ type: Boolean })
3556
+ ], z.prototype, "clearMessageDialogOpen", 2);
3551
3557
  U([
3552
- _e("sl-dialog")
3553
- ], P.prototype, "dialog", 2);
3558
+ Ce("sl-dialog")
3559
+ ], z.prototype, "dialog", 2);
3554
3560
  U([
3555
- i({ type: Boolean })
3556
- ], P.prototype, "customRequest", 2);
3557
- P = U([
3558
- x("cb-setting")
3559
- ], P);
3560
- const Mo = v`
3561
- ${H}
3561
+ l({ type: Boolean })
3562
+ ], z.prototype, "customRequest", 2);
3563
+ z = U([
3564
+ k("cb-setting")
3565
+ ], z);
3566
+ const Ho = x`
3567
+ ${O}
3562
3568
  :host {
3563
3569
  --primary-color: var(--sl-color-primary-600);
3564
3570
 
@@ -3626,11 +3632,11 @@ const Mo = v`
3626
3632
  .cb-anchor sl-popup {
3627
3633
  --arrow-color: var(--sl-color-gray-300);
3628
3634
  }
3629
- `, So = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M16 8c0 3.866-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234c-.2.032-.352-.176-.273-.362c.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7zM5 8a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm4 0a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm3 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2z"/></svg>';
3630
- var Ao = Object.defineProperty, Ho = Object.getOwnPropertyDescriptor, Je = (t, e, o, r) => {
3631
- for (var a = r > 1 ? void 0 : r ? Ho(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3632
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
3633
- return r && a && Ao(e, o, a), a;
3635
+ `, Lo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M16 8c0 3.866-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234c-.2.032-.352-.176-.273-.362c.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7zM5 8a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm4 0a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm3 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2z"/></svg>';
3636
+ var Io = Object.defineProperty, Po = Object.getOwnPropertyDescriptor, Je = (t, e, o, a) => {
3637
+ for (var r = a > 1 ? void 0 : a ? Po(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3638
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3639
+ return a && r && Io(e, o, r), r;
3634
3640
  };
3635
3641
  let ae = class extends C {
3636
3642
  constructor() {
@@ -3649,14 +3655,14 @@ let ae = class extends C {
3649
3655
  console.log("Popup clicked!");
3650
3656
  }
3651
3657
  render() {
3652
- return l`
3658
+ return c`
3653
3659
  <div class="cb-anchor ${this.open ? "open" : ""}" part="cb-anchor" @click=${this._clickHandler.bind(this)}>
3654
3660
  <sl-popup placement="top-end" distance="16">
3655
3661
  <sl-button slot="anchor" label="Start" size="large" variant="primary" class="icon anchor-button" circle>
3656
3662
  ${B(
3657
3663
  this.open,
3658
- () => l`<cb-icon color="white" svg="${$e}"></cb-icon>`,
3659
- () => l`<cb-icon color="white" svg="${So}"></cb-icon>`
3664
+ () => c`<cb-icon color="white" svg="${je}"></cb-icon>`,
3665
+ () => c`<cb-icon color="white" svg="${Lo}"></cb-icon>`
3660
3666
  )}
3661
3667
  </sl-button>
3662
3668
  <div class="cb-engage-popup">Popup</div>
@@ -3665,41 +3671,41 @@ let ae = class extends C {
3665
3671
  `;
3666
3672
  }
3667
3673
  };
3668
- ae.styles = Mo;
3674
+ ae.styles = Ho;
3669
3675
  Je([
3670
- i({ type: Boolean })
3676
+ l({ type: Boolean })
3671
3677
  ], ae.prototype, "open", 2);
3672
3678
  ae = Je([
3673
- x("cb-anchor")
3679
+ k("cb-anchor")
3674
3680
  ], ae);
3675
- const Lo = v`
3676
- ${H}
3677
- `, ze = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1H5.1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/></g></svg>', Oo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016a.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06a.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017a.163.163 0 0 1-.054-.06a.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/><path d="M7.002 12a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/></g></svg>', Po = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764a.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0a5.5 5.5 0 1 1-11 0z"/><path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293L5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l7-7z"/></g></svg>', Io = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="m8.93 6.588l-2.29.287l-.082.38l.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319c.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246c-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0z"/></g></svg>';
3678
- var zo = Object.defineProperty, Eo = Object.getOwnPropertyDescriptor, Ke = (t, e, o, r) => {
3679
- for (var a = r > 1 ? void 0 : r ? Eo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3680
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
3681
- return r && a && zo(e, o, a), a;
3681
+ const zo = x`
3682
+ ${O}
3683
+ `, we = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1H5.1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/></g></svg>', Ye = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016a.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06a.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017a.163.163 0 0 1-.054-.06a.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/><path d="M7.002 12a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/></g></svg>', Ge = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764a.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0a5.5 5.5 0 1 1-11 0z"/><path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293L5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l7-7z"/></g></svg>', Xe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="m8.93 6.588l-2.29.287l-.082.38l.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319c.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246c-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0z"/></g></svg>';
3684
+ var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, Qe = (t, e, o, a) => {
3685
+ for (var r = a > 1 ? void 0 : a ? To(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3686
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3687
+ return a && r && Eo(e, o, r), r;
3682
3688
  };
3683
3689
  const Ee = {
3684
3690
  error: {
3685
3691
  variant: "danger",
3686
- icon: ze
3692
+ icon: we
3687
3693
  },
3688
3694
  danger: {
3689
3695
  variant: "danger",
3690
- icon: ze
3696
+ icon: we
3691
3697
  },
3692
3698
  warning: {
3693
3699
  variant: "warning",
3694
- icon: Oo
3700
+ icon: Ye
3695
3701
  },
3696
3702
  success: {
3697
3703
  variant: "success",
3698
- icon: Po
3704
+ icon: Ge
3699
3705
  },
3700
3706
  info: {
3701
3707
  variant: "primary",
3702
- icon: Io
3708
+ icon: Xe
3703
3709
  }
3704
3710
  };
3705
3711
  let se = class extends C {
@@ -3708,24 +3714,24 @@ let se = class extends C {
3708
3714
  }
3709
3715
  render() {
3710
3716
  const { variant: t, icon: e } = Ee[this.status] || Ee.info;
3711
- return l`<cb-icon svg=${e} color="${t}"></cb-icon>`;
3717
+ return c`<cb-icon svg=${e} color="${t}"></cb-icon>`;
3712
3718
  }
3713
3719
  };
3714
- se.styles = Ue;
3715
- Ke([
3716
- i({ type: String })
3720
+ se.styles = Ze;
3721
+ Qe([
3722
+ l({ type: String })
3717
3723
  ], se.prototype, "status", 2);
3718
- se = Ke([
3719
- x("cb-status-icon")
3724
+ se = Qe([
3725
+ k("cb-status-icon")
3720
3726
  ], se);
3721
- var To = Object.defineProperty, Ro = Object.getOwnPropertyDescriptor, Bo = (t, e, o, r) => {
3722
- for (var a = r > 1 ? void 0 : r ? Ro(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3723
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
3724
- return r && a && To(e, o, a), a;
3727
+ var Ro = Object.defineProperty, Bo = Object.getOwnPropertyDescriptor, Vo = (t, e, o, a) => {
3728
+ for (var r = a > 1 ? void 0 : a ? Bo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3729
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3730
+ return a && r && Ro(e, o, r), r;
3725
3731
  };
3726
- let we = class extends C {
3732
+ let xe = class extends C {
3727
3733
  render() {
3728
- return l` <sl-alert variant="danger" open>
3734
+ return c` <sl-alert variant="danger" open>
3729
3735
  <cb-status-icon status="error" slot="icon"></cb-status-icon>
3730
3736
  Please config openai api key in the settings.
3731
3737
  <span
@@ -3739,14 +3745,14 @@ let we = class extends C {
3739
3745
  this.emit("setting:show");
3740
3746
  }
3741
3747
  };
3742
- we.styles = Lo;
3743
- we = Bo([
3744
- x("cb-auth-alert")
3745
- ], we);
3748
+ xe.styles = zo;
3749
+ xe = Vo([
3750
+ k("cb-auth-alert")
3751
+ ], xe);
3746
3752
  class Te extends Error {
3747
- constructor(e, o, r) {
3748
- const a = e.status || e.status === 0 ? e.status : "", s = e.statusText || "", n = `${a} ${s}`.trim(), c = n ? `status code ${n}` : "an unknown error";
3749
- super(`Request failed with ${c}`), Object.defineProperty(this, "response", {
3753
+ constructor(e, o, a) {
3754
+ const r = e.status || e.status === 0 ? e.status : "", s = e.statusText || "", n = `${r} ${s}`.trim(), i = n ? `status code ${n}` : "an unknown error";
3755
+ super(`Request failed with ${i}`), Object.defineProperty(this, "response", {
3750
3756
  enumerable: !0,
3751
3757
  configurable: !0,
3752
3758
  writable: !0,
@@ -3761,10 +3767,10 @@ class Te extends Error {
3761
3767
  configurable: !0,
3762
3768
  writable: !0,
3763
3769
  value: void 0
3764
- }), this.name = "HTTPError", this.response = e, this.request = o, this.options = r;
3770
+ }), this.name = "HTTPError", this.response = e, this.request = o, this.options = a;
3765
3771
  }
3766
3772
  }
3767
- class Ye extends Error {
3773
+ class et extends Error {
3768
3774
  constructor(e) {
3769
3775
  super("Request timed out"), Object.defineProperty(this, "request", {
3770
3776
  enumerable: !0,
@@ -3778,27 +3784,27 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
3778
3784
  for (const e of t)
3779
3785
  if ((!ee(e) || Array.isArray(e)) && typeof e < "u")
3780
3786
  throw new TypeError("The `options` argument must be an object");
3781
- return Se({}, ...t);
3782
- }, Ge = (t = {}, e = {}) => {
3783
- const o = new globalThis.Headers(t), r = e instanceof globalThis.Headers, a = new globalThis.Headers(e);
3784
- for (const [s, n] of a.entries())
3785
- r && n === "undefined" || n === void 0 ? o.delete(s) : o.set(s, n);
3787
+ return Ae({}, ...t);
3788
+ }, tt = (t = {}, e = {}) => {
3789
+ const o = new globalThis.Headers(t), a = e instanceof globalThis.Headers, r = new globalThis.Headers(e);
3790
+ for (const [s, n] of r.entries())
3791
+ a && n === "undefined" || n === void 0 ? o.delete(s) : o.set(s, n);
3786
3792
  return o;
3787
- }, Se = (...t) => {
3793
+ }, Ae = (...t) => {
3788
3794
  let e = {}, o = {};
3789
- for (const r of t)
3790
- if (Array.isArray(r))
3791
- Array.isArray(e) || (e = []), e = [...e, ...r];
3792
- else if (ee(r)) {
3793
- for (let [a, s] of Object.entries(r))
3794
- ee(s) && a in e && (s = Se(e[a], s)), e = { ...e, [a]: s };
3795
- ee(r.headers) && (o = Ge(o, r.headers), e.headers = o);
3795
+ for (const a of t)
3796
+ if (Array.isArray(a))
3797
+ Array.isArray(e) || (e = []), e = [...e, ...a];
3798
+ else if (ee(a)) {
3799
+ for (let [r, s] of Object.entries(a))
3800
+ ee(s) && r in e && (s = Ae(e[r], s)), e = { ...e, [r]: s };
3801
+ ee(a.headers) && (o = tt(o, a.headers), e.headers = o);
3796
3802
  }
3797
3803
  return e;
3798
- }, Vo = (() => {
3804
+ }, qo = (() => {
3799
3805
  let t = !1, e = !1;
3800
- const o = typeof globalThis.ReadableStream == "function", r = typeof globalThis.Request == "function";
3801
- return o && r && (e = new globalThis.Request("https://a.com", {
3806
+ const o = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
3807
+ return o && a && (e = new globalThis.Request("https://a.com", {
3802
3808
  body: new globalThis.ReadableStream(),
3803
3809
  method: "POST",
3804
3810
  // @ts-expect-error - Types are outdated.
@@ -3806,17 +3812,17 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
3806
3812
  return t = !0, "half";
3807
3813
  }
3808
3814
  }).headers.has("Content-Type")), t && !e;
3809
- })(), qo = typeof globalThis.AbortController == "function", Do = typeof globalThis.ReadableStream == "function", Fo = typeof globalThis.FormData == "function", Xe = ["get", "post", "put", "patch", "head", "delete"], Uo = {
3815
+ })(), Do = typeof globalThis.AbortController == "function", Fo = typeof globalThis.ReadableStream == "function", Uo = typeof globalThis.FormData == "function", ot = ["get", "post", "put", "patch", "head", "delete"], Zo = {
3810
3816
  json: "application/json",
3811
3817
  text: "text/*",
3812
3818
  formData: "multipart/form-data",
3813
3819
  arrayBuffer: "*/*",
3814
3820
  blob: "*/*"
3815
- }, be = 2147483647, Qe = Symbol("stop"), Zo = (t) => Xe.includes(t) ? t.toUpperCase() : t, No = ["get", "put", "head", "delete", "options", "trace"], Wo = [408, 413, 429, 500, 502, 503, 504], et = [413, 429, 503], Re = {
3821
+ }, be = 2147483647, rt = Symbol("stop"), No = (t) => ot.includes(t) ? t.toUpperCase() : t, Wo = ["get", "put", "head", "delete", "options", "trace"], Ko = [408, 413, 429, 500, 502, 503, 504], at = [413, 429, 503], Re = {
3816
3822
  limit: 2,
3817
- methods: No,
3818
- statusCodes: Wo,
3819
- afterStatusCodes: et,
3823
+ methods: Wo,
3824
+ statusCodes: Ko,
3825
+ afterStatusCodes: at,
3820
3826
  maxRetryAfter: Number.POSITIVE_INFINITY,
3821
3827
  backoffLimit: Number.POSITIVE_INFINITY
3822
3828
  }, Jo = (t = {}) => {
@@ -3832,81 +3838,81 @@ const ee = (t) => t !== null && typeof t == "object", G = (...t) => {
3832
3838
  return {
3833
3839
  ...Re,
3834
3840
  ...t,
3835
- afterStatusCodes: et
3841
+ afterStatusCodes: at
3836
3842
  };
3837
3843
  };
3838
- async function Ko(t, e, o) {
3839
- return new Promise((r, a) => {
3844
+ async function Yo(t, e, o) {
3845
+ return new Promise((a, r) => {
3840
3846
  const s = setTimeout(() => {
3841
- e && e.abort(), a(new Ye(t));
3847
+ e && e.abort(), r(new et(t));
3842
3848
  }, o.timeout);
3843
- o.fetch(t).then(r).catch(a).then(() => {
3849
+ o.fetch(t).then(a).catch(r).then(() => {
3844
3850
  clearTimeout(s);
3845
3851
  });
3846
3852
  });
3847
3853
  }
3848
- const Yo = !!globalThis.DOMException;
3854
+ const Go = !!globalThis.DOMException;
3849
3855
  function Be(t) {
3850
- if (Yo)
3856
+ if (Go)
3851
3857
  return new DOMException((t == null ? void 0 : t.reason) ?? "The operation was aborted.", "AbortError");
3852
3858
  const e = new Error((t == null ? void 0 : t.reason) ?? "The operation was aborted.");
3853
3859
  return e.name = "AbortError", e;
3854
3860
  }
3855
- async function Go(t, { signal: e }) {
3856
- return new Promise((o, r) => {
3861
+ async function Xo(t, { signal: e }) {
3862
+ return new Promise((o, a) => {
3857
3863
  if (e) {
3858
3864
  if (e.aborted) {
3859
- r(Be(e));
3865
+ a(Be(e));
3860
3866
  return;
3861
3867
  }
3862
- e.addEventListener("abort", a, { once: !0 });
3868
+ e.addEventListener("abort", r, { once: !0 });
3863
3869
  }
3864
- function a() {
3865
- r(Be(e)), clearTimeout(s);
3870
+ function r() {
3871
+ a(Be(e)), clearTimeout(s);
3866
3872
  }
3867
3873
  const s = setTimeout(() => {
3868
- e == null || e.removeEventListener("abort", a), o();
3874
+ e == null || e.removeEventListener("abort", r), o();
3869
3875
  }, t);
3870
3876
  });
3871
3877
  }
3872
3878
  class ne {
3873
3879
  // eslint-disable-next-line @typescript-eslint/promise-function-async
3874
3880
  static create(e, o) {
3875
- const r = new ne(e, o), a = async () => {
3876
- if (r._options.timeout > be)
3881
+ const a = new ne(e, o), r = async () => {
3882
+ if (a._options.timeout > be)
3877
3883
  throw new RangeError(`The \`timeout\` option cannot be greater than ${be}`);
3878
3884
  await Promise.resolve();
3879
- let c = await r._fetch();
3880
- for (const g of r._options.hooks.afterResponse) {
3881
- const w = await g(r.request, r._options, r._decorateResponse(c.clone()));
3882
- w instanceof globalThis.Response && (c = w);
3885
+ let i = await a._fetch();
3886
+ for (const g of a._options.hooks.afterResponse) {
3887
+ const m = await g(a.request, a._options, a._decorateResponse(i.clone()));
3888
+ m instanceof globalThis.Response && (i = m);
3883
3889
  }
3884
- if (r._decorateResponse(c), !c.ok && r._options.throwHttpErrors) {
3885
- let g = new Te(c, r.request, r._options);
3886
- for (const w of r._options.hooks.beforeError)
3887
- g = await w(g);
3890
+ if (a._decorateResponse(i), !i.ok && a._options.throwHttpErrors) {
3891
+ let g = new Te(i, a.request, a._options);
3892
+ for (const m of a._options.hooks.beforeError)
3893
+ g = await m(g);
3888
3894
  throw g;
3889
3895
  }
3890
- if (r._options.onDownloadProgress) {
3891
- if (typeof r._options.onDownloadProgress != "function")
3896
+ if (a._options.onDownloadProgress) {
3897
+ if (typeof a._options.onDownloadProgress != "function")
3892
3898
  throw new TypeError("The `onDownloadProgress` option must be a function");
3893
- if (!Do)
3899
+ if (!Fo)
3894
3900
  throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
3895
- return r._stream(c.clone(), r._options.onDownloadProgress);
3901
+ return a._stream(i.clone(), a._options.onDownloadProgress);
3896
3902
  }
3897
- return c;
3898
- }, n = r._options.retry.methods.includes(r.request.method.toLowerCase()) ? r._retry(a) : a();
3899
- for (const [c, g] of Object.entries(Uo))
3900
- n[c] = async () => {
3901
- r.request.headers.set("accept", r.request.headers.get("accept") || g);
3902
- const _ = (await n).clone();
3903
- if (c === "json") {
3904
- if (_.status === 204 || (await _.clone().arrayBuffer()).byteLength === 0)
3903
+ return i;
3904
+ }, n = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(r) : r();
3905
+ for (const [i, g] of Object.entries(Zo))
3906
+ n[i] = async () => {
3907
+ a.request.headers.set("accept", a.request.headers.get("accept") || g);
3908
+ const y = (await n).clone();
3909
+ if (i === "json") {
3910
+ if (y.status === 204 || (await y.clone().arrayBuffer()).byteLength === 0)
3905
3911
  return "";
3906
3912
  if (o.parseJson)
3907
- return o.parseJson(await _.text());
3913
+ return o.parseJson(await y.text());
3908
3914
  }
3909
- return _[c]();
3915
+ return y[i]();
3910
3916
  };
3911
3917
  return n;
3912
3918
  }
@@ -3941,14 +3947,14 @@ class ne {
3941
3947
  // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
3942
3948
  credentials: this._input.credentials || "same-origin",
3943
3949
  ...o,
3944
- headers: Ge(this._input.headers, o.headers),
3945
- hooks: Se({
3950
+ headers: tt(this._input.headers, o.headers),
3951
+ hooks: Ae({
3946
3952
  beforeRequest: [],
3947
3953
  beforeRetry: [],
3948
3954
  beforeError: [],
3949
3955
  afterResponse: []
3950
3956
  }, o.hooks),
3951
- method: Zo(o.method ?? this._input.method),
3957
+ method: No(o.method ?? this._input.method),
3952
3958
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
3953
3959
  prefixUrl: String(o.prefixUrl || ""),
3954
3960
  retry: Jo(o.retry),
@@ -3962,30 +3968,30 @@ class ne {
3962
3968
  throw new Error("`input` must not begin with a slash when using `prefixUrl`");
3963
3969
  this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
3964
3970
  }
3965
- if (qo) {
3971
+ if (Do) {
3966
3972
  if (this.abortController = new globalThis.AbortController(), this._options.signal) {
3967
- const r = this._options.signal;
3973
+ const a = this._options.signal;
3968
3974
  this._options.signal.addEventListener("abort", () => {
3969
- this.abortController.abort(r.reason);
3975
+ this.abortController.abort(a.reason);
3970
3976
  });
3971
3977
  }
3972
3978
  this._options.signal = this.abortController.signal;
3973
3979
  }
3974
- if (Vo && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
3975
- const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
3976
- (Fo && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(s, { ...this.request }), this._options);
3980
+ if (qo && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
3981
+ const r = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, r);
3982
+ (Uo && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(s, { ...this.request }), this._options);
3977
3983
  }
3978
3984
  this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
3979
3985
  }
3980
3986
  _calculateRetryDelay(e) {
3981
- if (this._retryCount++, this._retryCount < this._options.retry.limit && !(e instanceof Ye)) {
3987
+ if (this._retryCount++, this._retryCount < this._options.retry.limit && !(e instanceof et)) {
3982
3988
  if (e instanceof Te) {
3983
3989
  if (!this._options.retry.statusCodes.includes(e.response.status))
3984
3990
  return 0;
3985
- const r = e.response.headers.get("Retry-After");
3986
- if (r && this._options.retry.afterStatusCodes.includes(e.response.status)) {
3987
- let a = Number(r);
3988
- return Number.isNaN(a) ? a = Date.parse(r) - Date.now() : a *= 1e3, typeof this._options.retry.maxRetryAfter < "u" && a > this._options.retry.maxRetryAfter ? 0 : a;
3991
+ const a = e.response.headers.get("Retry-After");
3992
+ if (a && this._options.retry.afterStatusCodes.includes(e.response.status)) {
3993
+ let r = Number(a);
3994
+ return Number.isNaN(r) ? r = Date.parse(a) - Date.now() : r *= 1e3, typeof this._options.retry.maxRetryAfter < "u" && r > this._options.retry.maxRetryAfter ? 0 : r;
3989
3995
  }
3990
3996
  if (e.response.status === 413)
3991
3997
  return 0;
@@ -4002,16 +4008,16 @@ class ne {
4002
4008
  try {
4003
4009
  return await e();
4004
4010
  } catch (o) {
4005
- const r = Math.min(this._calculateRetryDelay(o), be);
4006
- if (r !== 0 && this._retryCount > 0) {
4007
- await Go(r, { signal: this._options.signal });
4008
- for (const a of this._options.hooks.beforeRetry)
4009
- if (await a({
4011
+ const a = Math.min(this._calculateRetryDelay(o), be);
4012
+ if (a !== 0 && this._retryCount > 0) {
4013
+ await Xo(a, { signal: this._options.signal });
4014
+ for (const r of this._options.hooks.beforeRetry)
4015
+ if (await r({
4010
4016
  request: this.request,
4011
4017
  options: this._options,
4012
4018
  error: o,
4013
4019
  retryCount: this._retryCount
4014
- }) === Qe)
4020
+ }) === rt)
4015
4021
  return;
4016
4022
  return this._retry(e);
4017
4023
  }
@@ -4028,34 +4034,34 @@ class ne {
4028
4034
  if (o instanceof Response)
4029
4035
  return o;
4030
4036
  }
4031
- return this._options.timeout === !1 ? this._options.fetch(this.request.clone()) : Ko(this.request.clone(), this.abortController, this._options);
4037
+ return this._options.timeout === !1 ? this._options.fetch(this.request.clone()) : Yo(this.request.clone(), this.abortController, this._options);
4032
4038
  }
4033
4039
  /* istanbul ignore next */
4034
4040
  _stream(e, o) {
4035
- const r = Number(e.headers.get("content-length")) || 0;
4036
- let a = 0;
4037
- return e.status === 204 ? (o && o({ percent: 1, totalBytes: r, transferredBytes: a }, new Uint8Array()), new globalThis.Response(null, {
4041
+ const a = Number(e.headers.get("content-length")) || 0;
4042
+ let r = 0;
4043
+ return e.status === 204 ? (o && o({ percent: 1, totalBytes: a, transferredBytes: r }, new Uint8Array()), new globalThis.Response(null, {
4038
4044
  status: e.status,
4039
4045
  statusText: e.statusText,
4040
4046
  headers: e.headers
4041
4047
  })) : new globalThis.Response(new globalThis.ReadableStream({
4042
4048
  async start(s) {
4043
4049
  const n = e.body.getReader();
4044
- o && o({ percent: 0, transferredBytes: 0, totalBytes: r }, new Uint8Array());
4045
- async function c() {
4046
- const { done: g, value: w } = await n.read();
4050
+ o && o({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
4051
+ async function i() {
4052
+ const { done: g, value: m } = await n.read();
4047
4053
  if (g) {
4048
4054
  s.close();
4049
4055
  return;
4050
4056
  }
4051
4057
  if (o) {
4052
- a += w.byteLength;
4053
- const _ = r === 0 ? 0 : a / r;
4054
- o({ percent: _, transferredBytes: a, totalBytes: r }, w);
4058
+ r += m.byteLength;
4059
+ const y = a === 0 ? 0 : r / a;
4060
+ o({ percent: y, transferredBytes: r, totalBytes: a }, m);
4055
4061
  }
4056
- s.enqueue(w), await c();
4062
+ s.enqueue(m), await i();
4057
4063
  }
4058
- await c();
4064
+ await i();
4059
4065
  }
4060
4066
  }), {
4061
4067
  status: e.status,
@@ -4065,12 +4071,12 @@ class ne {
4065
4071
  }
4066
4072
  }
4067
4073
  /*! MIT License © Sindre Sorhus */
4068
- const xe = (t) => {
4069
- const e = (o, r) => ne.create(o, G(t, r));
4070
- for (const o of Xe)
4071
- e[o] = (r, a) => ne.create(r, G(t, a, { method: o }));
4072
- return e.create = (o) => xe(G(o)), e.extend = (o) => xe(G(t, o)), e.stop = Qe, e;
4073
- }, Xo = xe(), Qo = Xo, er = Qo.extend({
4074
+ const ke = (t) => {
4075
+ const e = (o, a) => ne.create(o, G(t, a));
4076
+ for (const o of ot)
4077
+ e[o] = (a, r) => ne.create(a, G(t, r, { method: o }));
4078
+ return e.create = (o) => ke(G(o)), e.extend = (o) => ke(G(t, o)), e.stop = rt, e;
4079
+ }, Qo = ke(), er = Qo, st = er.extend({
4074
4080
  hooks: {
4075
4081
  beforeRequest: [
4076
4082
  () => {
@@ -4079,17 +4085,17 @@ const xe = (t) => {
4079
4085
  }
4080
4086
  });
4081
4087
  async function tr(t, e) {
4082
- const { onmessage: o, onclose: r, ...a } = e, s = async (n, c) => {
4083
- const { value: g, done: w } = await c.read();
4084
- w ? (n.close(), r == null || r()) : (o == null || o(g), n.enqueue(g), s(n, c));
4088
+ const { onmessage: o, onclose: a, ...r } = e, s = async (n, i) => {
4089
+ const { value: g, done: m } = await i.read();
4090
+ m ? (n.close(), a == null || a()) : (o == null || o(g), n.enqueue(g), s(n, i));
4085
4091
  };
4086
- return a.body && typeof a.body == "object" && (a.body = JSON.stringify(a.body)), console.log("Fetching:", a), fetch(t, a).then((n) => {
4087
- const c = n.body.getReader();
4092
+ return r.body && typeof r.body == "object" && (r.body = JSON.stringify(r.body)), console.log("Fetching:", r), fetch(t, r).then((n) => {
4093
+ const i = n.body.getReader();
4088
4094
  return new ReadableStream({
4089
- start(w) {
4095
+ start(m) {
4090
4096
  s(
4091
- w,
4092
- c
4097
+ m,
4098
+ i
4093
4099
  );
4094
4100
  }
4095
4101
  });
@@ -4101,31 +4107,117 @@ async function tr(t, e) {
4101
4107
  }
4102
4108
  async function or(t, e) {
4103
4109
  const o = new FormData();
4104
- for (let a = 0; a < e.length; a++)
4105
- o.append("files", e[a]);
4106
- const r = await er.post(t, {
4110
+ for (let r = 0; r < e.length; r++)
4111
+ o.append("files", e[r]);
4112
+ const a = await st.post(t, {
4107
4113
  body: o
4108
4114
  });
4109
4115
  try {
4110
- return await r.json();
4111
- } catch (a) {
4116
+ return await a.json();
4117
+ } catch (r) {
4112
4118
  return {
4113
4119
  code: 1,
4114
4120
  url: "",
4115
- message: a.message
4121
+ message: r.message
4116
4122
  };
4117
4123
  }
4118
4124
  }
4119
- var rr = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, y = (t, e, o, r) => {
4120
- for (var a = r > 1 ? void 0 : r ? ar(e, o) : e, s = t.length - 1, n; s >= 0; s--)
4121
- (n = t[s]) && (a = (r ? n(e, o, a) : n(a)) || a);
4122
- return r && a && rr(e, o, a), a;
4125
+ const Ve = {
4126
+ error: {
4127
+ variant: "danger",
4128
+ icon: we
4129
+ },
4130
+ warning: {
4131
+ variant: "warning",
4132
+ icon: Ye
4133
+ },
4134
+ success: {
4135
+ variant: "success",
4136
+ icon: Ge
4137
+ },
4138
+ info: {
4139
+ variant: "primary",
4140
+ icon: Xe
4141
+ }
4123
4142
  };
4124
- const ke = ce.noConflict();
4125
- ke.setLevel("info");
4126
- let u = class extends C {
4143
+ function rr(t) {
4144
+ const e = document.createElement("div");
4145
+ return e.textContent = t, e.innerHTML;
4146
+ }
4147
+ function ar(t = "info", e, o = 1e8) {
4148
+ const { variant: a, icon: r } = Ve[t] || Ve.info, s = Object.assign(document.createElement("sl-alert"), {
4149
+ variant: a,
4150
+ closable: !0,
4151
+ duration: o,
4152
+ innerHTML: `
4153
+ <cb-status-icon slot="icon" status="${t}"></cb-status-icon>
4154
+ ${rr(e)}
4155
+ `
4156
+ });
4157
+ return document.body.append(s), s.toast();
4158
+ }
4159
+ async function sr(t, e) {
4160
+ const o = t.getReader(), a = new TextDecoder("utf-8");
4161
+ let r = !1;
4162
+ for (; !r; ) {
4163
+ const { value: s, done: n } = await o.read();
4164
+ if (s) {
4165
+ let i = a.decode(s);
4166
+ const g = i.lastIndexOf("data:"), m = i.lastIndexOf(`
4167
+ `);
4168
+ if (g !== -1 && (i = i.slice(g + 6)), m !== -1 && (i = i.slice(0, m)), i = i.trim(), i === `
4169
+ ` || i === "")
4170
+ continue;
4171
+ if (i === "[DONE]") {
4172
+ r = !0;
4173
+ continue;
4174
+ }
4175
+ try {
4176
+ const y = JSON.parse(i);
4177
+ e(null, y);
4178
+ } catch (y) {
4179
+ console.log("error", y), e(y, null);
4180
+ }
4181
+ }
4182
+ r = n;
4183
+ }
4184
+ }
4185
+ async function nr(t) {
4186
+ var r;
4187
+ if (!t.apiKey)
4188
+ throw new Error("apiKey is required");
4189
+ const e = t.options ?? {};
4190
+ e.model || (e.model = "gpt-3.5-turbo");
4191
+ const o = await st.post(t.url, {
4192
+ json: {
4193
+ messages: t.messages,
4194
+ ...t.options ?? {}
4195
+ },
4196
+ headers: {
4197
+ "Content-Type": "application/json",
4198
+ Authorization: `Bearer ${t.apiKey}`
4199
+ },
4200
+ timeout: 1e3 * 60 * 10,
4201
+ signal: t.signal
4202
+ }), a = o.body;
4203
+ if (!a)
4204
+ throw new Error("No data");
4205
+ if ((r = t.options) != null && r.stream) {
4206
+ await sr(a, t.onMessage);
4207
+ return;
4208
+ }
4209
+ return o.json();
4210
+ }
4211
+ var ir = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, v = (t, e, o, a) => {
4212
+ for (var r = a > 1 ? void 0 : a ? lr(e, o) : e, s = t.length - 1, n; s >= 0; s--)
4213
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
4214
+ return a && r && ir(e, o, r), r;
4215
+ };
4216
+ const _e = ce.noConflict();
4217
+ _e.setLevel("info");
4218
+ let b = class extends C {
4127
4219
  constructor() {
4128
- super(...arguments), this.store = new ht(this, m), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.url = "ws://localhost:3070", this.welcomeMessage = "Hello! How can I help you today ?", this.logoSvg = ` <svg width="24" height="24" viewBox="0 0 40 40">
4220
+ super(...arguments), this.store = new mt(this, p), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.url = "ws://localhost:3070", this.welcomeMessage = "Hello! How can I help you today ?", this.logoSvg = ` <svg width="24" height="24" viewBox="0 0 40 40">
4129
4221
  <path
4130
4222
  d="M34.728 0.275L2.245 15.267c-3.748 1.749 -2.498 7.246 1.499 7.246h13.743v13.743c0 3.998 5.497 5.248 7.246 1.499l14.992 -32.483c1.249 -2.999 -1.999 -6.248 -4.998 -4.998z"
4131
4223
  fill="#E24D42"
@@ -4146,20 +4238,20 @@ let u = class extends C {
4146
4238
  isThinking: !0,
4147
4239
  data: {}
4148
4240
  };
4149
- return m.addMessage(t), t;
4241
+ return p.addMessage(t), t;
4150
4242
  }
4151
4243
  render() {
4152
- return m.disabled ? (ke.error("Bot is disabled"), null) : l`
4244
+ return c`
4153
4245
  <div class="cb-wrapper" style="${this.open ? "display:flex" : "display:none"}">
4154
4246
  <cb-header title="${this.name}"></cb-header>
4155
- <cb-message-list .messages=${m.messages} .actions=${m.actions}></cb-message-list>
4247
+ <cb-message-list .messages=${p.messages} .actions=${p.actions}></cb-message-list>
4156
4248
  <cb-user-input ?loading=${this.loading} ?disabled=${this.loading || this.showAuthAlert} ?enable-file-upload=${this.enableFileUpload}></cb-user-input>
4157
4249
  </div>
4158
4250
  <cb-anchor ?open=${this.open}></cb-anchor>
4159
4251
  `;
4160
4252
  }
4161
4253
  connectedCallback() {
4162
- super.connectedCallback(), ke.info("connectedCallback"), addEventListener("setting:show", () => {
4254
+ super.connectedCallback(), _e.info("connectedCallback"), addEventListener("setting:show", () => {
4163
4255
  this.showSetting = !0;
4164
4256
  }), addEventListener("message:send", this._addMessageHandler.bind(this)), addEventListener("message:remove", this._deleteMessageHandler.bind(this)), addEventListener("setting:confirm", this._settingConfirmHandler.bind(this)), addEventListener("setting:hide", () => {
4165
4257
  this.showSetting = !1;
@@ -4167,7 +4259,7 @@ let u = class extends C {
4167
4259
  const e = t.detail;
4168
4260
  this.open = e.open;
4169
4261
  }), addEventListener("message:clear", () => {
4170
- m.clearMessages();
4262
+ p.clearMessages();
4171
4263
  }), addEventListener("message:send:file", this._sendFileHandler.bind(this)), addEventListener("setting:show", () => {
4172
4264
  this.showSetting = !0;
4173
4265
  });
@@ -4176,131 +4268,115 @@ let u = class extends C {
4176
4268
  // Use to initialize
4177
4269
  // This is also called when state changes - ??? - i.e. when message added to the array
4178
4270
  updated(t) {
4179
- super.updated(t), t.size > 0 && this._initSetting(), setTimeout(() => {
4271
+ super.updated(t), t.size > 0 && (_e.info("updated,_changedProperties:", t), this._initSetting()), setTimeout(() => {
4180
4272
  this._scrollToBottom();
4181
4273
  }, 0);
4182
4274
  }
4183
4275
  // initialize setting
4184
4276
  _initSetting() {
4185
- const t = m.setting;
4186
- t.orgId = this.orgId, t.botId = this.botId, t.url = this.url, t.welcomeMessage = this.welcomeMessage, t.logoSvg = this.logoSvg, t.botIconSvg = this.botIconSvg, t.userIconSvg = this.userIconSvg, t.systemIconSvg = this.systemIconSvg, m.setSetting(t);
4277
+ const t = p.setting;
4278
+ t.orgId = this.orgId, t.botId = this.botId, t.url = this.url, t.welcomeMessage = this.welcomeMessage, t.logoSvg = this.logoSvg, t.botIconSvg = this.botIconSvg, t.userIconSvg = this.userIconSvg, t.systemIconSvg = this.systemIconSvg, p.setSetting(t);
4187
4279
  }
4188
4280
  setLoading(t) {
4189
4281
  this.loading = t;
4190
4282
  }
4191
4283
  clearConversation() {
4192
- m.clearConversation();
4284
+ p.clearConversation();
4193
4285
  }
4194
4286
  // check auth
4195
4287
  _checkAuth() {
4196
4288
  }
4197
- /* TODO Remove
4198
- private async _sendToOpenai(newMsg: Chatbot.NewMessage, messages: Chatbot.OpenaiMessage[]) {
4199
- let text = '';
4200
- const apiBase = appState.setting.openai.apiBase || 'https://api.openai.com/v1';
4201
- const data = await openai.chat({
4202
- url: `${apiBase}/chat/completions`,
4203
- apiKey: appState.setting.openai.apiKey,
4204
- messages: messages,
4289
+ // TODO Remove
4290
+ async _sendToOpenai(t, e) {
4291
+ let o = "";
4292
+ const a = p.setting.openai.apiBase || "https://api.openai.com/v1", r = await nr({
4293
+ url: `${a}/chat/completions`,
4294
+ apiKey: p.setting.openai.apiKey,
4295
+ messages: e,
4205
4296
  options: {
4206
- stream: appState.setting.stream,
4207
- model: appState.setting.openai.model,
4297
+ stream: p.setting.stream,
4298
+ model: p.setting.openai.model
4208
4299
  // temperature: 0.9,
4209
4300
  },
4210
- onMessage: (err, data) => {
4211
- if (err) {
4212
- console.error(err);
4301
+ onMessage: (s, n) => {
4302
+ var i;
4303
+ if (s) {
4304
+ console.error(s);
4213
4305
  return;
4214
4306
  }
4215
- if (data && data.choices[0].delta?.content) {
4216
- requestIdleCallback(() => {
4217
- // handle openai response
4218
- text += data.choices[0].delta.content;
4219
- // update message
4220
- appState.updateMessage(newMsg, text);
4221
- });
4222
- }
4223
- },
4224
- });
4225
- if (!appState.setting.stream && data) {
4226
- // update message
4227
- appState.updateMessage(newMsg, data.choices[0].message.content);
4228
- }
4229
- } */
4230
- /* TODO Remove
4231
- private async _sendHandler(messages: Chatbot.OpenaiMessage[]) {
4232
- this.setLoading(true);
4233
-
4234
- const newMsg: Chatbot.NewMessage = {
4235
- author: 'assistant',
4236
- type: 'text',
4237
- isThinking: true,
4238
- data: {},
4239
- };
4240
-
4241
- // add message to store
4242
- appState.addMessage(newMsg);
4243
-
4244
- if (this.customRequest) {
4245
- await this.emit('chatbot:send', {
4246
- detail: {
4247
- newMessage: newMsg,
4248
- messages,
4249
- },
4250
- bubbles: true,
4251
- composed: true,
4307
+ n && ((i = n.choices[0].delta) != null && i.content) && requestIdleCallback(() => {
4308
+ o += n.choices[0].delta.content, p.updateMessage(t, o);
4252
4309
  });
4253
- } else {
4254
- try {
4255
- await this._sendToOpenai(newMsg, messages);
4256
- } catch (err) {
4257
- notify('error', (err as Error).message);
4258
- console.error(err);
4259
- }
4260
4310
  }
4261
-
4262
- this.setLoading(false);
4263
- }*/
4311
+ });
4312
+ !p.setting.stream && r && p.updateMessage(t, r.choices[0].message.content);
4313
+ }
4314
+ // TODO Remove
4315
+ async _sendHandler(t) {
4316
+ this.setLoading(!0);
4317
+ const e = {
4318
+ author: "assistant",
4319
+ type: "text",
4320
+ isThinking: !0,
4321
+ data: {}
4322
+ };
4323
+ if (p.addMessage(e), this.customRequest)
4324
+ await this.emit("chatbot:send", {
4325
+ detail: {
4326
+ newMessage: e,
4327
+ messages: t
4328
+ },
4329
+ bubbles: !0,
4330
+ composed: !0
4331
+ });
4332
+ else
4333
+ try {
4334
+ await this._sendToOpenai(e, t);
4335
+ } catch (o) {
4336
+ ar("error", o.message), console.error(o);
4337
+ }
4338
+ this.setLoading(!1);
4339
+ }
4264
4340
  _addMessageHandler(t) {
4265
4341
  const e = t.detail;
4266
- m.sendMessage(e);
4342
+ p.sendMessage(e);
4267
4343
  }
4268
4344
  _deleteMessageHandler(t) {
4269
4345
  const e = t.detail;
4270
- m.removeMessage(e.id);
4346
+ p.removeMessage(e.id);
4271
4347
  }
4272
4348
  async _sendFileHandler(t) {
4273
- const e = t.detail, r = {
4349
+ const e = t.detail, a = {
4274
4350
  author: "user",
4275
4351
  type: "file",
4276
4352
  isUploading: !0,
4277
4353
  data: {
4278
- files: e.files.map((a, s) => ({
4279
- id: `${a.name}-${s}`,
4280
- name: a.name,
4281
- size: a.size,
4282
- type: a.type,
4354
+ files: e.files.map((r, s) => ({
4355
+ id: `${r.name}-${s}`,
4356
+ name: r.name,
4357
+ size: r.size,
4358
+ type: r.type,
4283
4359
  url: ""
4284
4360
  }))
4285
4361
  }
4286
4362
  };
4287
- if (m.addMessage(r), this.uploadFileUrl) {
4288
- const a = await or(this.uploadFileUrl, e.files);
4289
- a.code === 0 && a.data && (r.isUploading = !1, r.data = {
4290
- files: a.data
4291
- }, m.updateMessage(r));
4363
+ if (p.addMessage(a), this.uploadFileUrl) {
4364
+ const r = await or(this.uploadFileUrl, e.files);
4365
+ r.code === 0 && r.data && (a.isUploading = !1, a.data = {
4366
+ files: r.data
4367
+ }, p.updateMessage(a));
4292
4368
  }
4293
4369
  this.emit("chatbot:file:send", {
4294
4370
  detail: {
4295
4371
  files: e.files,
4296
- message: r
4372
+ message: a
4297
4373
  }
4298
4374
  });
4299
4375
  }
4300
4376
  // setting confirm handler
4301
4377
  _settingConfirmHandler(t) {
4302
4378
  const e = t.detail;
4303
- m.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
4379
+ p.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
4304
4380
  }
4305
4381
  // scroll to bottom
4306
4382
  _scrollToBottom(t = !1) {
@@ -4314,67 +4390,67 @@ let u = class extends C {
4314
4390
  });
4315
4391
  }
4316
4392
  };
4317
- u.styles = ft;
4318
- y([
4319
- i({ type: Boolean, attribute: "display-license" })
4320
- ], u.prototype, "displayLicense", 2);
4321
- y([
4322
- i({ type: String, attribute: "name" })
4323
- ], u.prototype, "name", 2);
4324
- y([
4325
- i({ type: String, attribute: "org-id" })
4326
- ], u.prototype, "orgId", 2);
4327
- y([
4328
- i({ type: String, attribute: "bot-id" })
4329
- ], u.prototype, "botId", 2);
4330
- y([
4331
- i({ type: String, attribute: "url" })
4332
- ], u.prototype, "url", 2);
4333
- y([
4334
- i({ type: String, attribute: "welcome-message" })
4335
- ], u.prototype, "welcomeMessage", 2);
4336
- y([
4337
- i({ type: String, attribute: "logo-svg" })
4338
- ], u.prototype, "logoSvg", 2);
4339
- y([
4340
- i({ type: String, attribute: "bot-icon-svg" })
4341
- ], u.prototype, "botIconSvg", 2);
4342
- y([
4343
- i({ type: String, attribute: "user-icon-svg" })
4344
- ], u.prototype, "userIconSvg", 2);
4345
- y([
4346
- i({ type: String, attribute: "system-icon-svg" })
4347
- ], u.prototype, "systemIconSvg", 2);
4348
- y([
4349
- i({ type: Boolean, attribute: "stream" })
4350
- ], u.prototype, "stream", 2);
4351
- y([
4352
- i({ type: Boolean, attribute: "custom-request" })
4353
- ], u.prototype, "customRequest", 2);
4354
- y([
4355
- i({ type: Boolean, attribute: "enable-file-upload" })
4356
- ], u.prototype, "enableFileUpload", 2);
4357
- y([
4358
- i({ type: String, attribute: "upload-file-url" })
4359
- ], u.prototype, "uploadFileUrl", 2);
4360
- y([
4361
- i({ type: Boolean, attribute: "open" })
4362
- ], u.prototype, "open", 2);
4363
- y([
4364
- i({ type: Boolean })
4365
- ], u.prototype, "loading", 2);
4366
- y([
4367
- i({ type: Boolean })
4368
- ], u.prototype, "showSetting", 2);
4369
- y([
4370
- i({ type: Boolean })
4371
- ], u.prototype, "showAuthAlert", 2);
4372
- y([
4373
- _e("cb-message-list")
4374
- ], u.prototype, "_messageList", 2);
4375
- u = y([
4376
- x("enegelai-bot")
4377
- ], u);
4393
+ b.styles = kt;
4394
+ v([
4395
+ l({ type: Boolean, attribute: "display-license" })
4396
+ ], b.prototype, "displayLicense", 2);
4397
+ v([
4398
+ l({ type: String, attribute: "name" })
4399
+ ], b.prototype, "name", 2);
4400
+ v([
4401
+ l({ type: String, attribute: "org-id" })
4402
+ ], b.prototype, "orgId", 2);
4403
+ v([
4404
+ l({ type: String, attribute: "bot-id" })
4405
+ ], b.prototype, "botId", 2);
4406
+ v([
4407
+ l({ type: String, attribute: "url" })
4408
+ ], b.prototype, "url", 2);
4409
+ v([
4410
+ l({ type: String, attribute: "welcome-message" })
4411
+ ], b.prototype, "welcomeMessage", 2);
4412
+ v([
4413
+ l({ type: String, attribute: "logo-svg" })
4414
+ ], b.prototype, "logoSvg", 2);
4415
+ v([
4416
+ l({ type: String, attribute: "bot-icon-svg" })
4417
+ ], b.prototype, "botIconSvg", 2);
4418
+ v([
4419
+ l({ type: String, attribute: "user-icon-svg" })
4420
+ ], b.prototype, "userIconSvg", 2);
4421
+ v([
4422
+ l({ type: String, attribute: "system-icon-svg" })
4423
+ ], b.prototype, "systemIconSvg", 2);
4424
+ v([
4425
+ l({ type: Boolean, attribute: "stream" })
4426
+ ], b.prototype, "stream", 2);
4427
+ v([
4428
+ l({ type: Boolean, attribute: "custom-request" })
4429
+ ], b.prototype, "customRequest", 2);
4430
+ v([
4431
+ l({ type: Boolean, attribute: "enable-file-upload" })
4432
+ ], b.prototype, "enableFileUpload", 2);
4433
+ v([
4434
+ l({ type: String, attribute: "upload-file-url" })
4435
+ ], b.prototype, "uploadFileUrl", 2);
4436
+ v([
4437
+ l({ type: Boolean, attribute: "open" })
4438
+ ], b.prototype, "open", 2);
4439
+ v([
4440
+ l({ type: Boolean })
4441
+ ], b.prototype, "loading", 2);
4442
+ v([
4443
+ l({ type: Boolean })
4444
+ ], b.prototype, "showSetting", 2);
4445
+ v([
4446
+ l({ type: Boolean })
4447
+ ], b.prototype, "showAuthAlert", 2);
4448
+ v([
4449
+ Ce("cb-message-list")
4450
+ ], b.prototype, "_messageList", 2);
4451
+ b = v([
4452
+ k("enegelai-bot")
4453
+ ], b);
4378
4454
  export {
4379
- u as default
4455
+ b as default
4380
4456
  };