obi-sdk 0.1.10 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -29
- package/dist/modular/chunks/{session-c3b70ffb.js → index-2d0b05af.js} +5409 -818
- package/dist/modular/chunks/index-2d0b05af.js.map +1 -0
- package/dist/modular/chunks/obi-widget-0970cbbe.js +2221 -0
- package/dist/modular/chunks/obi-widget-0970cbbe.js.map +1 -0
- package/dist/modular/core.js +3 -8
- package/dist/modular/core.js.map +1 -1
- package/dist/modular/index.js +29 -228
- package/dist/modular/index.js.map +1 -1
- package/dist/modular/ui.js +17 -16
- package/dist/modular/ui.js.map +1 -1
- package/dist/obi-sdk.es.js +21074 -7
- package/dist/obi-sdk.standalone.iife.js +60 -33
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/obi-sdk.umd.js +103 -76
- package/index.d.ts +10 -61
- package/package.json +4 -4
- package/dist/index-719ec57d.js +0 -5168
- package/dist/modular/chunks/mitt-3c1f932d.js +0 -20
- package/dist/modular/chunks/mitt-3c1f932d.js.map +0 -1
- package/dist/modular/chunks/obi-widget-ff350828.js +0 -6369
- package/dist/modular/chunks/obi-widget-ff350828.js.map +0 -1
- package/dist/modular/chunks/session-c3b70ffb.js.map +0 -1
- package/dist/session-730ff76c.js +0 -15762
|
@@ -0,0 +1,2221 @@
|
|
|
1
|
+
import { S as SDKState, A as API_BASE_URL, O as ObiSession, z as z$1, N as N$1 } from "./index-2d0b05af.js";
|
|
2
|
+
const t$2 = globalThis, e$4 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$3 = Symbol(), o$6 = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
let n$5 = class n {
|
|
4
|
+
constructor(t2, e2, o2) {
|
|
5
|
+
if (this._$cssResult$ = true, o2 !== s$3)
|
|
6
|
+
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
7
|
+
this.cssText = t2, this.t = e2;
|
|
8
|
+
}
|
|
9
|
+
get styleSheet() {
|
|
10
|
+
let t2 = this.o;
|
|
11
|
+
const s2 = this.t;
|
|
12
|
+
if (e$4 && void 0 === t2) {
|
|
13
|
+
const e2 = void 0 !== s2 && 1 === s2.length;
|
|
14
|
+
e2 && (t2 = o$6.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$6.set(s2, t2));
|
|
15
|
+
}
|
|
16
|
+
return t2;
|
|
17
|
+
}
|
|
18
|
+
toString() {
|
|
19
|
+
return this.cssText;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const r$5 = (t2) => new n$5("string" == typeof t2 ? t2 : t2 + "", void 0, s$3), i$4 = (t2, ...e2) => {
|
|
23
|
+
const o2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, o3) => e3 + ((t3) => {
|
|
24
|
+
if (true === t3._$cssResult$)
|
|
25
|
+
return t3.cssText;
|
|
26
|
+
if ("number" == typeof t3)
|
|
27
|
+
return t3;
|
|
28
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
29
|
+
})(s2) + t2[o3 + 1], t2[0]);
|
|
30
|
+
return new n$5(o2, t2, s$3);
|
|
31
|
+
}, S$1 = (s2, o2) => {
|
|
32
|
+
if (e$4)
|
|
33
|
+
s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
|
|
34
|
+
else
|
|
35
|
+
for (const e2 of o2) {
|
|
36
|
+
const o3 = document.createElement("style"), n3 = t$2.litNonce;
|
|
37
|
+
void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
|
|
38
|
+
}
|
|
39
|
+
}, c$3 = e$4 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
|
|
40
|
+
let e2 = "";
|
|
41
|
+
for (const s2 of t3.cssRules)
|
|
42
|
+
e2 += s2.cssText;
|
|
43
|
+
return r$5(e2);
|
|
44
|
+
})(t2) : t2;
|
|
45
|
+
const { is: i$3, defineProperty: e$3, getOwnPropertyDescriptor: h$3, getOwnPropertyNames: r$4, getOwnPropertySymbols: o$5, getPrototypeOf: n$4 } = Object, a$1 = globalThis, c$2 = a$1.trustedTypes, l$1 = c$2 ? c$2.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
|
|
46
|
+
switch (s2) {
|
|
47
|
+
case Boolean:
|
|
48
|
+
t2 = t2 ? l$1 : null;
|
|
49
|
+
break;
|
|
50
|
+
case Object:
|
|
51
|
+
case Array:
|
|
52
|
+
t2 = null == t2 ? t2 : JSON.stringify(t2);
|
|
53
|
+
}
|
|
54
|
+
return t2;
|
|
55
|
+
}, fromAttribute(t2, s2) {
|
|
56
|
+
let i3 = t2;
|
|
57
|
+
switch (s2) {
|
|
58
|
+
case Boolean:
|
|
59
|
+
i3 = null !== t2;
|
|
60
|
+
break;
|
|
61
|
+
case Number:
|
|
62
|
+
i3 = null === t2 ? null : Number(t2);
|
|
63
|
+
break;
|
|
64
|
+
case Object:
|
|
65
|
+
case Array:
|
|
66
|
+
try {
|
|
67
|
+
i3 = JSON.parse(t2);
|
|
68
|
+
} catch (t3) {
|
|
69
|
+
i3 = null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return i3;
|
|
73
|
+
} }, f$3 = (t2, s2) => !i$3(t2, s2), b$1 = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$3 };
|
|
74
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$1.litPropertyMetadata ?? (a$1.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
75
|
+
let y$1 = class y extends HTMLElement {
|
|
76
|
+
static addInitializer(t2) {
|
|
77
|
+
this._$Ei(), (this.l ?? (this.l = [])).push(t2);
|
|
78
|
+
}
|
|
79
|
+
static get observedAttributes() {
|
|
80
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
81
|
+
}
|
|
82
|
+
static createProperty(t2, s2 = b$1) {
|
|
83
|
+
if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
|
|
84
|
+
const i3 = Symbol(), h2 = this.getPropertyDescriptor(t2, i3, s2);
|
|
85
|
+
void 0 !== h2 && e$3(this.prototype, t2, h2);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
static getPropertyDescriptor(t2, s2, i3) {
|
|
89
|
+
const { get: e2, set: r2 } = h$3(this.prototype, t2) ?? { get() {
|
|
90
|
+
return this[s2];
|
|
91
|
+
}, set(t3) {
|
|
92
|
+
this[s2] = t3;
|
|
93
|
+
} };
|
|
94
|
+
return { get: e2, set(s3) {
|
|
95
|
+
const h2 = e2?.call(this);
|
|
96
|
+
r2?.call(this, s3), this.requestUpdate(t2, h2, i3);
|
|
97
|
+
}, configurable: true, enumerable: true };
|
|
98
|
+
}
|
|
99
|
+
static getPropertyOptions(t2) {
|
|
100
|
+
return this.elementProperties.get(t2) ?? b$1;
|
|
101
|
+
}
|
|
102
|
+
static _$Ei() {
|
|
103
|
+
if (this.hasOwnProperty(d$1("elementProperties")))
|
|
104
|
+
return;
|
|
105
|
+
const t2 = n$4(this);
|
|
106
|
+
t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
|
|
107
|
+
}
|
|
108
|
+
static finalize() {
|
|
109
|
+
if (this.hasOwnProperty(d$1("finalized")))
|
|
110
|
+
return;
|
|
111
|
+
if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
112
|
+
const t3 = this.properties, s2 = [...r$4(t3), ...o$5(t3)];
|
|
113
|
+
for (const i3 of s2)
|
|
114
|
+
this.createProperty(i3, t3[i3]);
|
|
115
|
+
}
|
|
116
|
+
const t2 = this[Symbol.metadata];
|
|
117
|
+
if (null !== t2) {
|
|
118
|
+
const s2 = litPropertyMetadata.get(t2);
|
|
119
|
+
if (void 0 !== s2)
|
|
120
|
+
for (const [t3, i3] of s2)
|
|
121
|
+
this.elementProperties.set(t3, i3);
|
|
122
|
+
}
|
|
123
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const [t3, s2] of this.elementProperties) {
|
|
125
|
+
const i3 = this._$Eu(t3, s2);
|
|
126
|
+
void 0 !== i3 && this._$Eh.set(i3, t3);
|
|
127
|
+
}
|
|
128
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
129
|
+
}
|
|
130
|
+
static finalizeStyles(s2) {
|
|
131
|
+
const i3 = [];
|
|
132
|
+
if (Array.isArray(s2)) {
|
|
133
|
+
const e2 = new Set(s2.flat(1 / 0).reverse());
|
|
134
|
+
for (const s3 of e2)
|
|
135
|
+
i3.unshift(c$3(s3));
|
|
136
|
+
} else
|
|
137
|
+
void 0 !== s2 && i3.push(c$3(s2));
|
|
138
|
+
return i3;
|
|
139
|
+
}
|
|
140
|
+
static _$Eu(t2, s2) {
|
|
141
|
+
const i3 = s2.attribute;
|
|
142
|
+
return false === i3 ? void 0 : "string" == typeof i3 ? i3 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
|
|
143
|
+
}
|
|
144
|
+
constructor() {
|
|
145
|
+
super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
|
|
146
|
+
}
|
|
147
|
+
_$Ev() {
|
|
148
|
+
this._$ES = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t2) => t2(this));
|
|
149
|
+
}
|
|
150
|
+
addController(t2) {
|
|
151
|
+
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && t2.hostConnected?.();
|
|
152
|
+
}
|
|
153
|
+
removeController(t2) {
|
|
154
|
+
this._$EO?.delete(t2);
|
|
155
|
+
}
|
|
156
|
+
_$E_() {
|
|
157
|
+
const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
|
|
158
|
+
for (const i3 of s2.keys())
|
|
159
|
+
this.hasOwnProperty(i3) && (t2.set(i3, this[i3]), delete this[i3]);
|
|
160
|
+
t2.size > 0 && (this._$Ep = t2);
|
|
161
|
+
}
|
|
162
|
+
createRenderRoot() {
|
|
163
|
+
const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
+
return S$1(t2, this.constructor.elementStyles), t2;
|
|
165
|
+
}
|
|
166
|
+
connectedCallback() {
|
|
167
|
+
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), this._$EO?.forEach((t2) => t2.hostConnected?.());
|
|
168
|
+
}
|
|
169
|
+
enableUpdating(t2) {
|
|
170
|
+
}
|
|
171
|
+
disconnectedCallback() {
|
|
172
|
+
this._$EO?.forEach((t2) => t2.hostDisconnected?.());
|
|
173
|
+
}
|
|
174
|
+
attributeChangedCallback(t2, s2, i3) {
|
|
175
|
+
this._$AK(t2, i3);
|
|
176
|
+
}
|
|
177
|
+
_$ET(t2, s2) {
|
|
178
|
+
const i3 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i3);
|
|
179
|
+
if (void 0 !== e2 && true === i3.reflect) {
|
|
180
|
+
const h2 = (void 0 !== i3.converter?.toAttribute ? i3.converter : u$1).toAttribute(s2, i3.type);
|
|
181
|
+
this._$Em = t2, null == h2 ? this.removeAttribute(e2) : this.setAttribute(e2, h2), this._$Em = null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
_$AK(t2, s2) {
|
|
185
|
+
const i3 = this.constructor, e2 = i3._$Eh.get(t2);
|
|
186
|
+
if (void 0 !== e2 && this._$Em !== e2) {
|
|
187
|
+
const t3 = i3.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== t3.converter?.fromAttribute ? t3.converter : u$1;
|
|
188
|
+
this._$Em = e2, this[e2] = h2.fromAttribute(s2, t3.type) ?? this._$Ej?.get(e2) ?? null, this._$Em = null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
requestUpdate(t2, s2, i3) {
|
|
192
|
+
if (void 0 !== t2) {
|
|
193
|
+
const e2 = this.constructor, h2 = this[t2];
|
|
194
|
+
if (i3 ?? (i3 = e2.getPropertyOptions(t2)), !((i3.hasChanged ?? f$3)(h2, s2) || i3.useDefault && i3.reflect && h2 === this._$Ej?.get(t2) && !this.hasAttribute(e2._$Eu(t2, i3))))
|
|
195
|
+
return;
|
|
196
|
+
this.C(t2, s2, i3);
|
|
197
|
+
}
|
|
198
|
+
false === this.isUpdatePending && (this._$ES = this._$EP());
|
|
199
|
+
}
|
|
200
|
+
C(t2, s2, { useDefault: i3, reflect: e2, wrapped: h2 }, r2) {
|
|
201
|
+
i3 && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t2) && (this._$Ej.set(t2, r2 ?? s2 ?? this[t2]), true !== h2 || void 0 !== r2) || (this._$AL.has(t2) || (this.hasUpdated || i3 || (s2 = void 0), this._$AL.set(t2, s2)), true === e2 && this._$Em !== t2 && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t2));
|
|
202
|
+
}
|
|
203
|
+
async _$EP() {
|
|
204
|
+
this.isUpdatePending = true;
|
|
205
|
+
try {
|
|
206
|
+
await this._$ES;
|
|
207
|
+
} catch (t3) {
|
|
208
|
+
Promise.reject(t3);
|
|
209
|
+
}
|
|
210
|
+
const t2 = this.scheduleUpdate();
|
|
211
|
+
return null != t2 && await t2, !this.isUpdatePending;
|
|
212
|
+
}
|
|
213
|
+
scheduleUpdate() {
|
|
214
|
+
return this.performUpdate();
|
|
215
|
+
}
|
|
216
|
+
performUpdate() {
|
|
217
|
+
if (!this.isUpdatePending)
|
|
218
|
+
return;
|
|
219
|
+
if (!this.hasUpdated) {
|
|
220
|
+
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
221
|
+
for (const [t4, s3] of this._$Ep)
|
|
222
|
+
this[t4] = s3;
|
|
223
|
+
this._$Ep = void 0;
|
|
224
|
+
}
|
|
225
|
+
const t3 = this.constructor.elementProperties;
|
|
226
|
+
if (t3.size > 0)
|
|
227
|
+
for (const [s3, i3] of t3) {
|
|
228
|
+
const { wrapped: t4 } = i3, e2 = this[s3];
|
|
229
|
+
true !== t4 || this._$AL.has(s3) || void 0 === e2 || this.C(s3, void 0, i3, e2);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
let t2 = false;
|
|
233
|
+
const s2 = this._$AL;
|
|
234
|
+
try {
|
|
235
|
+
t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), this._$EO?.forEach((t3) => t3.hostUpdate?.()), this.update(s2)) : this._$EM();
|
|
236
|
+
} catch (s3) {
|
|
237
|
+
throw t2 = false, this._$EM(), s3;
|
|
238
|
+
}
|
|
239
|
+
t2 && this._$AE(s2);
|
|
240
|
+
}
|
|
241
|
+
willUpdate(t2) {
|
|
242
|
+
}
|
|
243
|
+
_$AE(t2) {
|
|
244
|
+
this._$EO?.forEach((t3) => t3.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
|
|
245
|
+
}
|
|
246
|
+
_$EM() {
|
|
247
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
|
|
248
|
+
}
|
|
249
|
+
get updateComplete() {
|
|
250
|
+
return this.getUpdateComplete();
|
|
251
|
+
}
|
|
252
|
+
getUpdateComplete() {
|
|
253
|
+
return this._$ES;
|
|
254
|
+
}
|
|
255
|
+
shouldUpdate(t2) {
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
update(t2) {
|
|
259
|
+
this._$Eq && (this._$Eq = this._$Eq.forEach((t3) => this._$ET(t3, this[t3]))), this._$EM();
|
|
260
|
+
}
|
|
261
|
+
updated(t2) {
|
|
262
|
+
}
|
|
263
|
+
firstUpdated(t2) {
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ?? (a$1.reactiveElementVersions = [])).push("2.1.0");
|
|
267
|
+
const t$1 = globalThis, i$2 = t$1.trustedTypes, s$2 = i$2 ? i$2.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$2 = "$lit$", h$2 = `lit$${Math.random().toFixed(9).slice(2)}$`, o$4 = "?" + h$2, n$3 = `<${o$4}>`, r$3 = document, l = () => r$3.createComment(""), c$1 = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof t2?.[Symbol.iterator], d = "[ \n\f\r]", f$2 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
268
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), x = y2(1), b = y2(2), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$3.createTreeWalker(r$3, 129);
|
|
269
|
+
function P(t2, i3) {
|
|
270
|
+
if (!a(t2) || !t2.hasOwnProperty("raw"))
|
|
271
|
+
throw Error("invalid template strings array");
|
|
272
|
+
return void 0 !== s$2 ? s$2.createHTML(i3) : i3;
|
|
273
|
+
}
|
|
274
|
+
const V = (t2, i3) => {
|
|
275
|
+
const s2 = t2.length - 1, o2 = [];
|
|
276
|
+
let r2, l2 = 2 === i3 ? "<svg>" : 3 === i3 ? "<math>" : "", c2 = f$2;
|
|
277
|
+
for (let i4 = 0; i4 < s2; i4++) {
|
|
278
|
+
const s3 = t2[i4];
|
|
279
|
+
let a2, u2, d2 = -1, y3 = 0;
|
|
280
|
+
for (; y3 < s3.length && (c2.lastIndex = y3, u2 = c2.exec(s3), null !== u2); )
|
|
281
|
+
y3 = c2.lastIndex, c2 === f$2 ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f$2, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f$2 : (c2 = m, r2 = void 0);
|
|
282
|
+
const x2 = c2 === m && t2[i4 + 1].startsWith("/>") ? " " : "";
|
|
283
|
+
l2 += c2 === f$2 ? s3 + n$3 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$2 + s3.slice(d2) + h$2 + x2) : s3 + h$2 + (-2 === d2 ? i4 : x2);
|
|
284
|
+
}
|
|
285
|
+
return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i3 ? "</svg>" : 3 === i3 ? "</math>" : "")), o2];
|
|
286
|
+
};
|
|
287
|
+
class N {
|
|
288
|
+
constructor({ strings: t2, _$litType$: s2 }, n3) {
|
|
289
|
+
let r2;
|
|
290
|
+
this.parts = [];
|
|
291
|
+
let c2 = 0, a2 = 0;
|
|
292
|
+
const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2);
|
|
293
|
+
if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
|
|
294
|
+
const t3 = this.el.content.firstChild;
|
|
295
|
+
t3.replaceWith(...t3.childNodes);
|
|
296
|
+
}
|
|
297
|
+
for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) {
|
|
298
|
+
if (1 === r2.nodeType) {
|
|
299
|
+
if (r2.hasAttributes())
|
|
300
|
+
for (const t3 of r2.getAttributeNames())
|
|
301
|
+
if (t3.endsWith(e$2)) {
|
|
302
|
+
const i3 = v2[a2++], s3 = r2.getAttribute(t3).split(h$2), e2 = /([.?@])?(.*)/.exec(i3);
|
|
303
|
+
d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r2.removeAttribute(t3);
|
|
304
|
+
} else
|
|
305
|
+
t3.startsWith(h$2) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
|
|
306
|
+
if ($.test(r2.tagName)) {
|
|
307
|
+
const t3 = r2.textContent.split(h$2), s3 = t3.length - 1;
|
|
308
|
+
if (s3 > 0) {
|
|
309
|
+
r2.textContent = i$2 ? i$2.emptyScript : "";
|
|
310
|
+
for (let i3 = 0; i3 < s3; i3++)
|
|
311
|
+
r2.append(t3[i3], l()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
|
|
312
|
+
r2.append(t3[s3], l());
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
} else if (8 === r2.nodeType)
|
|
316
|
+
if (r2.data === o$4)
|
|
317
|
+
d2.push({ type: 2, index: c2 });
|
|
318
|
+
else {
|
|
319
|
+
let t3 = -1;
|
|
320
|
+
for (; -1 !== (t3 = r2.data.indexOf(h$2, t3 + 1)); )
|
|
321
|
+
d2.push({ type: 7, index: c2 }), t3 += h$2.length - 1;
|
|
322
|
+
}
|
|
323
|
+
c2++;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
static createElement(t2, i3) {
|
|
327
|
+
const s2 = r$3.createElement("template");
|
|
328
|
+
return s2.innerHTML = t2, s2;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function S(t2, i3, s2 = t2, e2) {
|
|
332
|
+
if (i3 === T)
|
|
333
|
+
return i3;
|
|
334
|
+
let h2 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
|
|
335
|
+
const o2 = c$1(i3) ? void 0 : i3._$litDirective$;
|
|
336
|
+
return h2?.constructor !== o2 && (h2?._$AO?.(false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i3 = S(t2, h2._$AS(t2, i3.values), h2, e2)), i3;
|
|
337
|
+
}
|
|
338
|
+
class M {
|
|
339
|
+
constructor(t2, i3) {
|
|
340
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3;
|
|
341
|
+
}
|
|
342
|
+
get parentNode() {
|
|
343
|
+
return this._$AM.parentNode;
|
|
344
|
+
}
|
|
345
|
+
get _$AU() {
|
|
346
|
+
return this._$AM._$AU;
|
|
347
|
+
}
|
|
348
|
+
u(t2) {
|
|
349
|
+
const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = (t2?.creationScope ?? r$3).importNode(i3, true);
|
|
350
|
+
C.currentNode = e2;
|
|
351
|
+
let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
|
|
352
|
+
for (; void 0 !== l2; ) {
|
|
353
|
+
if (o2 === l2.index) {
|
|
354
|
+
let i4;
|
|
355
|
+
2 === l2.type ? i4 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i4 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i4 = new z(h2, this, t2)), this._$AV.push(i4), l2 = s2[++n3];
|
|
356
|
+
}
|
|
357
|
+
o2 !== l2?.index && (h2 = C.nextNode(), o2++);
|
|
358
|
+
}
|
|
359
|
+
return C.currentNode = r$3, e2;
|
|
360
|
+
}
|
|
361
|
+
p(t2) {
|
|
362
|
+
let i3 = 0;
|
|
363
|
+
for (const s2 of this._$AV)
|
|
364
|
+
void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
class R {
|
|
368
|
+
get _$AU() {
|
|
369
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
370
|
+
}
|
|
371
|
+
constructor(t2, i3, s2, e2) {
|
|
372
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
|
|
373
|
+
}
|
|
374
|
+
get parentNode() {
|
|
375
|
+
let t2 = this._$AA.parentNode;
|
|
376
|
+
const i3 = this._$AM;
|
|
377
|
+
return void 0 !== i3 && 11 === t2?.nodeType && (t2 = i3.parentNode), t2;
|
|
378
|
+
}
|
|
379
|
+
get startNode() {
|
|
380
|
+
return this._$AA;
|
|
381
|
+
}
|
|
382
|
+
get endNode() {
|
|
383
|
+
return this._$AB;
|
|
384
|
+
}
|
|
385
|
+
_$AI(t2, i3 = this) {
|
|
386
|
+
t2 = S(this, t2, i3), c$1(t2) ? t2 === E || null == t2 || "" === t2 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t2 !== this._$AH && t2 !== T && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u(t2) ? this.k(t2) : this._(t2);
|
|
387
|
+
}
|
|
388
|
+
O(t2) {
|
|
389
|
+
return this._$AA.parentNode.insertBefore(t2, this._$AB);
|
|
390
|
+
}
|
|
391
|
+
T(t2) {
|
|
392
|
+
this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
|
|
393
|
+
}
|
|
394
|
+
_(t2) {
|
|
395
|
+
this._$AH !== E && c$1(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r$3.createTextNode(t2)), this._$AH = t2;
|
|
396
|
+
}
|
|
397
|
+
$(t2) {
|
|
398
|
+
const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N.createElement(P(s2.h, s2.h[0]), this.options)), s2);
|
|
399
|
+
if (this._$AH?._$AD === e2)
|
|
400
|
+
this._$AH.p(i3);
|
|
401
|
+
else {
|
|
402
|
+
const t3 = new M(e2, this), s3 = t3.u(this.options);
|
|
403
|
+
t3.p(i3), this.T(s3), this._$AH = t3;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
_$AC(t2) {
|
|
407
|
+
let i3 = A.get(t2.strings);
|
|
408
|
+
return void 0 === i3 && A.set(t2.strings, i3 = new N(t2)), i3;
|
|
409
|
+
}
|
|
410
|
+
k(t2) {
|
|
411
|
+
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
412
|
+
const i3 = this._$AH;
|
|
413
|
+
let s2, e2 = 0;
|
|
414
|
+
for (const h2 of t2)
|
|
415
|
+
e2 === i3.length ? i3.push(s2 = new R(this.O(l()), this.O(l()), this, this.options)) : s2 = i3[e2], s2._$AI(h2), e2++;
|
|
416
|
+
e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2);
|
|
417
|
+
}
|
|
418
|
+
_$AR(t2 = this._$AA.nextSibling, i3) {
|
|
419
|
+
for (this._$AP?.(false, true, i3); t2 && t2 !== this._$AB; ) {
|
|
420
|
+
const i4 = t2.nextSibling;
|
|
421
|
+
t2.remove(), t2 = i4;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
setConnected(t2) {
|
|
425
|
+
void 0 === this._$AM && (this._$Cv = t2, this._$AP?.(t2));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
class k {
|
|
429
|
+
get tagName() {
|
|
430
|
+
return this.element.tagName;
|
|
431
|
+
}
|
|
432
|
+
get _$AU() {
|
|
433
|
+
return this._$AM._$AU;
|
|
434
|
+
}
|
|
435
|
+
constructor(t2, i3, s2, e2, h2) {
|
|
436
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E;
|
|
437
|
+
}
|
|
438
|
+
_$AI(t2, i3 = this, s2, e2) {
|
|
439
|
+
const h2 = this.strings;
|
|
440
|
+
let o2 = false;
|
|
441
|
+
if (void 0 === h2)
|
|
442
|
+
t2 = S(this, t2, i3, 0), o2 = !c$1(t2) || t2 !== this._$AH && t2 !== T, o2 && (this._$AH = t2);
|
|
443
|
+
else {
|
|
444
|
+
const e3 = t2;
|
|
445
|
+
let n3, r2;
|
|
446
|
+
for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++)
|
|
447
|
+
r2 = S(this, e3[s2 + n3], i3, n3), r2 === T && (r2 = this._$AH[n3]), o2 || (o2 = !c$1(r2) || r2 !== this._$AH[n3]), r2 === E ? t2 = E : t2 !== E && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
|
|
448
|
+
}
|
|
449
|
+
o2 && !e2 && this.j(t2);
|
|
450
|
+
}
|
|
451
|
+
j(t2) {
|
|
452
|
+
t2 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
class H extends k {
|
|
456
|
+
constructor() {
|
|
457
|
+
super(...arguments), this.type = 3;
|
|
458
|
+
}
|
|
459
|
+
j(t2) {
|
|
460
|
+
this.element[this.name] = t2 === E ? void 0 : t2;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
class I extends k {
|
|
464
|
+
constructor() {
|
|
465
|
+
super(...arguments), this.type = 4;
|
|
466
|
+
}
|
|
467
|
+
j(t2) {
|
|
468
|
+
this.element.toggleAttribute(this.name, !!t2 && t2 !== E);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
class L extends k {
|
|
472
|
+
constructor(t2, i3, s2, e2, h2) {
|
|
473
|
+
super(t2, i3, s2, e2, h2), this.type = 5;
|
|
474
|
+
}
|
|
475
|
+
_$AI(t2, i3 = this) {
|
|
476
|
+
if ((t2 = S(this, t2, i3, 0) ?? E) === T)
|
|
477
|
+
return;
|
|
478
|
+
const s2 = this._$AH, e2 = t2 === E && s2 !== E || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E && (s2 === E || e2);
|
|
479
|
+
e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
|
|
480
|
+
}
|
|
481
|
+
handleEvent(t2) {
|
|
482
|
+
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t2) : this._$AH.handleEvent(t2);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
class z {
|
|
486
|
+
constructor(t2, i3, s2) {
|
|
487
|
+
this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2;
|
|
488
|
+
}
|
|
489
|
+
get _$AU() {
|
|
490
|
+
return this._$AM._$AU;
|
|
491
|
+
}
|
|
492
|
+
_$AI(t2) {
|
|
493
|
+
S(this, t2);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
const j = t$1.litHtmlPolyfillSupport;
|
|
497
|
+
j?.(N, R), (t$1.litHtmlVersions ?? (t$1.litHtmlVersions = [])).push("3.3.0");
|
|
498
|
+
const B = (t2, i3, s2) => {
|
|
499
|
+
const e2 = s2?.renderBefore ?? i3;
|
|
500
|
+
let h2 = e2._$litPart$;
|
|
501
|
+
if (void 0 === h2) {
|
|
502
|
+
const t3 = s2?.renderBefore ?? null;
|
|
503
|
+
e2._$litPart$ = h2 = new R(i3.insertBefore(l(), t3), t3, void 0, s2 ?? {});
|
|
504
|
+
}
|
|
505
|
+
return h2._$AI(t2), h2;
|
|
506
|
+
};
|
|
507
|
+
const s$1 = globalThis;
|
|
508
|
+
let i$1 = class i extends y$1 {
|
|
509
|
+
constructor() {
|
|
510
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
511
|
+
}
|
|
512
|
+
createRenderRoot() {
|
|
513
|
+
var _a;
|
|
514
|
+
const t2 = super.createRenderRoot();
|
|
515
|
+
return (_a = this.renderOptions).renderBefore ?? (_a.renderBefore = t2.firstChild), t2;
|
|
516
|
+
}
|
|
517
|
+
update(t2) {
|
|
518
|
+
const r2 = this.render();
|
|
519
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = B(r2, this.renderRoot, this.renderOptions);
|
|
520
|
+
}
|
|
521
|
+
connectedCallback() {
|
|
522
|
+
super.connectedCallback(), this._$Do?.setConnected(true);
|
|
523
|
+
}
|
|
524
|
+
disconnectedCallback() {
|
|
525
|
+
super.disconnectedCallback(), this._$Do?.setConnected(false);
|
|
526
|
+
}
|
|
527
|
+
render() {
|
|
528
|
+
return T;
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
i$1._$litElement$ = true, i$1["finalized"] = true, s$1.litElementHydrateSupport?.({ LitElement: i$1 });
|
|
532
|
+
const o$3 = s$1.litElementPolyfillSupport;
|
|
533
|
+
o$3?.({ LitElement: i$1 });
|
|
534
|
+
(s$1.litElementVersions ?? (s$1.litElementVersions = [])).push("4.2.0");
|
|
535
|
+
const o$2 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$3 }, r$2 = (t2 = o$2, e2, r2) => {
|
|
536
|
+
const { kind: n3, metadata: i3 } = r2;
|
|
537
|
+
let s2 = globalThis.litPropertyMetadata.get(i3);
|
|
538
|
+
if (void 0 === s2 && globalThis.litPropertyMetadata.set(i3, s2 = /* @__PURE__ */ new Map()), "setter" === n3 && ((t2 = Object.create(t2)).wrapped = true), s2.set(r2.name, t2), "accessor" === n3) {
|
|
539
|
+
const { name: o2 } = r2;
|
|
540
|
+
return { set(r3) {
|
|
541
|
+
const n4 = e2.get.call(this);
|
|
542
|
+
e2.set.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
543
|
+
}, init(e3) {
|
|
544
|
+
return void 0 !== e3 && this.C(o2, void 0, t2, e3), e3;
|
|
545
|
+
} };
|
|
546
|
+
}
|
|
547
|
+
if ("setter" === n3) {
|
|
548
|
+
const { name: o2 } = r2;
|
|
549
|
+
return function(r3) {
|
|
550
|
+
const n4 = this[o2];
|
|
551
|
+
e2.call(this, r3), this.requestUpdate(o2, n4, t2);
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
throw Error("Unsupported decorator location: " + n3);
|
|
555
|
+
};
|
|
556
|
+
function n$2(t2) {
|
|
557
|
+
return (e2, o2) => "object" == typeof o2 ? r$2(t2, e2, o2) : ((t3, e3, o3) => {
|
|
558
|
+
const r2 = e3.hasOwnProperty(o3);
|
|
559
|
+
return e3.constructor.createProperty(o3, t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
|
|
560
|
+
})(t2, e2, o2);
|
|
561
|
+
}
|
|
562
|
+
function r$1(r2) {
|
|
563
|
+
return n$2({ ...r2, state: true, attribute: false });
|
|
564
|
+
}
|
|
565
|
+
class StorageManager {
|
|
566
|
+
/**
|
|
567
|
+
* Create a new StorageManager with a specific namespace
|
|
568
|
+
* @param namespace The namespace to prefix all keys with
|
|
569
|
+
*/
|
|
570
|
+
constructor(namespace) {
|
|
571
|
+
this.namespace = namespace;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Get a value from localStorage with the namespace prefix
|
|
575
|
+
* @param key The key to retrieve
|
|
576
|
+
* @returns The stored value or null if not found
|
|
577
|
+
*/
|
|
578
|
+
getItem(key) {
|
|
579
|
+
return localStorage.getItem(`${this.namespace}.${key}`);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Set a value in localStorage with the namespace prefix
|
|
583
|
+
* @param key The key to set
|
|
584
|
+
* @param value The value to store
|
|
585
|
+
*/
|
|
586
|
+
setItem(key, value) {
|
|
587
|
+
localStorage.setItem(`${this.namespace}.${key}`, value);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Remove a value from localStorage with the namespace prefix
|
|
591
|
+
* @param key The key to remove
|
|
592
|
+
*/
|
|
593
|
+
removeItem(key) {
|
|
594
|
+
localStorage.removeItem(`${this.namespace}.${key}`);
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Clear all keys that belong to this namespace
|
|
598
|
+
*/
|
|
599
|
+
clear() {
|
|
600
|
+
for (let i3 = 0; i3 < localStorage.length; i3++) {
|
|
601
|
+
const key = localStorage.key(i3);
|
|
602
|
+
if (key && key.startsWith(`${this.namespace}.`)) {
|
|
603
|
+
localStorage.removeItem(key);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
const STORAGE_KEYS = {
|
|
609
|
+
SESSION_DATA: "session_data"
|
|
610
|
+
};
|
|
611
|
+
const storage = new StorageManager("io.obi.widget");
|
|
612
|
+
var __defProp$6 = Object.defineProperty;
|
|
613
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
614
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
615
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
616
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
617
|
+
if (decorator = decorators[i3])
|
|
618
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
619
|
+
if (kind && result)
|
|
620
|
+
__defProp$6(target, key, result);
|
|
621
|
+
return result;
|
|
622
|
+
};
|
|
623
|
+
class NavIcon extends i$1 {
|
|
624
|
+
constructor() {
|
|
625
|
+
super(...arguments);
|
|
626
|
+
this.id = "";
|
|
627
|
+
this.isActive = false;
|
|
628
|
+
this.isSpecial = false;
|
|
629
|
+
}
|
|
630
|
+
handleClick(e2) {
|
|
631
|
+
e2.preventDefault();
|
|
632
|
+
e2.stopPropagation();
|
|
633
|
+
const event = new CustomEvent("click", {
|
|
634
|
+
detail: {
|
|
635
|
+
id: this.id,
|
|
636
|
+
isActive: !this.isActive
|
|
637
|
+
},
|
|
638
|
+
bubbles: true,
|
|
639
|
+
composed: true
|
|
640
|
+
});
|
|
641
|
+
this.dispatchEvent(event);
|
|
642
|
+
if (this.onClick) {
|
|
643
|
+
this.onClick(this.id, !this.isActive);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
render() {
|
|
647
|
+
return x`
|
|
648
|
+
<button
|
|
649
|
+
id="obi-nav-${this.id}"
|
|
650
|
+
class=${this.isSpecial ? "special" : ""}
|
|
651
|
+
?active=${this.isActive}
|
|
652
|
+
@click=${this.handleClick}
|
|
653
|
+
aria-label="${this.id} control"
|
|
654
|
+
>
|
|
655
|
+
<slot></slot>
|
|
656
|
+
</button>
|
|
657
|
+
`;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
NavIcon.styles = i$4`
|
|
661
|
+
:host {
|
|
662
|
+
display: block;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
button {
|
|
666
|
+
display: flex;
|
|
667
|
+
height: 40px;
|
|
668
|
+
width: 40px;
|
|
669
|
+
align-items: center;
|
|
670
|
+
justify-content: center;
|
|
671
|
+
border-radius: 2px;
|
|
672
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
673
|
+
transition: all 0.2s;
|
|
674
|
+
cursor: pointer;
|
|
675
|
+
margin: 4px 0;
|
|
676
|
+
padding: 0;
|
|
677
|
+
border: none;
|
|
678
|
+
color: black;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
button.special {
|
|
682
|
+
color: #fff;
|
|
683
|
+
background-color: #000;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
button.special svg {
|
|
687
|
+
stroke: #fff;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
button.special.active {
|
|
691
|
+
background-color: black;
|
|
692
|
+
color: white;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
button.special.active:hover {
|
|
696
|
+
background-color: #27272a;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
button:not(.special) {
|
|
700
|
+
background-color: white;
|
|
701
|
+
color: black;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
button:not(.special):hover {
|
|
705
|
+
background-color: #e5e5e5;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
::slotted(*) {
|
|
709
|
+
width: 18px;
|
|
710
|
+
height: 18px;
|
|
711
|
+
}
|
|
712
|
+
`;
|
|
713
|
+
__decorateClass$6([
|
|
714
|
+
n$2({ type: String })
|
|
715
|
+
], NavIcon.prototype, "id", 2);
|
|
716
|
+
__decorateClass$6([
|
|
717
|
+
n$2({ type: Boolean })
|
|
718
|
+
], NavIcon.prototype, "isActive", 2);
|
|
719
|
+
__decorateClass$6([
|
|
720
|
+
n$2({ type: Boolean })
|
|
721
|
+
], NavIcon.prototype, "isSpecial", 2);
|
|
722
|
+
__decorateClass$6([
|
|
723
|
+
n$2({ type: Function })
|
|
724
|
+
], NavIcon.prototype, "onClick", 2);
|
|
725
|
+
if (!customElements.get("obi-nav-icon")) {
|
|
726
|
+
customElements.define("obi-nav-icon", NavIcon);
|
|
727
|
+
}
|
|
728
|
+
const navIcon = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
729
|
+
__proto__: null,
|
|
730
|
+
NavIcon
|
|
731
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
732
|
+
const svgWrapper = (content) => x`
|
|
733
|
+
<svg
|
|
734
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
735
|
+
width="24"
|
|
736
|
+
height="24"
|
|
737
|
+
viewBox="0 0 24 24"
|
|
738
|
+
fill="none"
|
|
739
|
+
stroke="currentColor"
|
|
740
|
+
stroke-width="2"
|
|
741
|
+
stroke-linecap="round"
|
|
742
|
+
stroke-linejoin="round"
|
|
743
|
+
class="lucide"
|
|
744
|
+
style="display: block;"
|
|
745
|
+
>
|
|
746
|
+
${content}
|
|
747
|
+
</svg>
|
|
748
|
+
`;
|
|
749
|
+
const pauseIcon = svgWrapper(b`
|
|
750
|
+
<rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/>
|
|
751
|
+
`);
|
|
752
|
+
const playIcon = svgWrapper(b`<polygon points="6 3 20 12 6 21 6 3"/>`);
|
|
753
|
+
const powerIcon = svgWrapper(b`
|
|
754
|
+
<path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.77.04"/>
|
|
755
|
+
`);
|
|
756
|
+
const closeIcon = svgWrapper(b`
|
|
757
|
+
<path d="M18 6 6 18"/><path d="m6 6 12 12"/>
|
|
758
|
+
`);
|
|
759
|
+
const bookOpenIcon = svgWrapper(b`
|
|
760
|
+
<path d="M12 7v14" />
|
|
761
|
+
<path
|
|
762
|
+
d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"
|
|
763
|
+
/>
|
|
764
|
+
`);
|
|
765
|
+
const obiIcon = x`
|
|
766
|
+
<img
|
|
767
|
+
class="widget-icon"
|
|
768
|
+
src="data:image/svg+xml;base64,${btoa(`<?xml version="1.0" encoding="UTF-8"?>
|
|
769
|
+
<svg width="32" height="32" viewBox="0 0 32 34" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
770
|
+
<g id="obi-icon">
|
|
771
|
+
<g id="Subtract">
|
|
772
|
+
<path d="M15.5845 9.29177L8.20527 5.00637L8.20527 13.4502L15.5845 17.7356L15.5845 9.29177Z" fill="white" />
|
|
773
|
+
<path d="M15.5896 27.7146L8.21035 31.9994L8.21032 23.4698L15.5896 19.1843L15.5896 27.7146Z" fill="white" />
|
|
774
|
+
<path d="M16.4104 27.7146L16.4104 19.1786L23.7897 23.4641L23.7897 32L16.4104 27.7146Z" fill="white" />
|
|
775
|
+
<path d="M32 27.7142L24.6207 31.9996L24.6207 23.47L32 19.1846L32 27.7142Z" fill="white" />
|
|
776
|
+
<path d="M24.2048 22.748L31.5911 18.4585L24.2845 14.2154L16.8983 18.5048L24.2048 22.748Z" fill="white" />
|
|
777
|
+
<path d="M23.7948 5.01235L23.7948 13.4564L16.4156 17.7418L16.4156 9.29775L23.7948 5.01235Z" fill="white" />
|
|
778
|
+
<path d="M16.0052 0L23.3865 4.2866L16.0003 8.57606L8.61897 4.28946L16.0052 0Z" fill="white" />
|
|
779
|
+
<path d="M7.72042 14.2182L15.1017 18.5048L7.79445 22.7477L0.413699 18.4615L7.72042 14.2182Z" fill="white" />
|
|
780
|
+
<path d="M7.37926 31.9997L7.37926 23.4638L0 19.1784L3.79636e-05 27.7143L7.37926 31.9997Z" fill="white" />
|
|
781
|
+
</g>
|
|
782
|
+
</g>
|
|
783
|
+
</svg>`)}"
|
|
784
|
+
alt="Obi Icon"
|
|
785
|
+
/>
|
|
786
|
+
`;
|
|
787
|
+
var __defProp$5 = Object.defineProperty;
|
|
788
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
789
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
790
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
791
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
792
|
+
if (decorator = decorators[i3])
|
|
793
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
794
|
+
if (kind && result)
|
|
795
|
+
__defProp$5(target, key, result);
|
|
796
|
+
return result;
|
|
797
|
+
};
|
|
798
|
+
class NavigationBar extends i$1 {
|
|
799
|
+
constructor() {
|
|
800
|
+
super();
|
|
801
|
+
this.isActive = false;
|
|
802
|
+
this.isScreenActive = false;
|
|
803
|
+
this.position = { top: 0, left: 0 };
|
|
804
|
+
this.currentState = SDKState.READY;
|
|
805
|
+
this.direction = "up";
|
|
806
|
+
}
|
|
807
|
+
connectedCallback() {
|
|
808
|
+
super.connectedCallback();
|
|
809
|
+
}
|
|
810
|
+
handleIconClick(id, isActive) {
|
|
811
|
+
if (this.onItemSelect) {
|
|
812
|
+
this.onItemSelect(id, isActive);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
render() {
|
|
816
|
+
return x`
|
|
817
|
+
${this.isActive ? x`
|
|
818
|
+
<obi-nav-icon
|
|
819
|
+
id="pause"
|
|
820
|
+
?isActive=${this.currentState === SDKState.PAUSED}
|
|
821
|
+
@click=${() => this.handleIconClick("pause", this.currentState === SDKState.PAUSED ? false : true)}
|
|
822
|
+
>
|
|
823
|
+
${this.currentState === SDKState.PAUSED ? playIcon : pauseIcon}
|
|
824
|
+
</obi-nav-icon>
|
|
825
|
+
<obi-nav-icon
|
|
826
|
+
id="activate"
|
|
827
|
+
?isActive=${this.isActive}
|
|
828
|
+
?isSpecial=${true}
|
|
829
|
+
@click=${() => this.handleIconClick("activate", this.isActive ? false : true)}
|
|
830
|
+
>
|
|
831
|
+
${this.isActive ? closeIcon : powerIcon}
|
|
832
|
+
</obi-nav-icon>
|
|
833
|
+
` : x`
|
|
834
|
+
<obi-nav-icon
|
|
835
|
+
id="experiences"
|
|
836
|
+
@click=${() => this.handleIconClick("experiences", true)}
|
|
837
|
+
>
|
|
838
|
+
${bookOpenIcon}
|
|
839
|
+
</obi-nav-icon>
|
|
840
|
+
`}
|
|
841
|
+
`;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
NavigationBar.styles = i$4`
|
|
845
|
+
:host {
|
|
846
|
+
display: flex;
|
|
847
|
+
position: absolute;
|
|
848
|
+
z-index: 10000;
|
|
849
|
+
width: 40px;
|
|
850
|
+
transition: all 0.2s ease-in-out;
|
|
851
|
+
opacity: 1;
|
|
852
|
+
transform: scale(1);
|
|
853
|
+
pointer-events: auto;
|
|
854
|
+
background-color: #fff;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
:host([data-direction="up"]) {
|
|
858
|
+
bottom: 64px;
|
|
859
|
+
top: auto;
|
|
860
|
+
flex-direction: column-reverse;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
:host([data-direction="down"]) {
|
|
864
|
+
top: 64px;
|
|
865
|
+
bottom: auto;
|
|
866
|
+
flex-direction: column;
|
|
867
|
+
}
|
|
868
|
+
`;
|
|
869
|
+
__decorateClass$5([
|
|
870
|
+
n$2({ type: Boolean })
|
|
871
|
+
], NavigationBar.prototype, "isActive", 2);
|
|
872
|
+
__decorateClass$5([
|
|
873
|
+
n$2({ type: Boolean })
|
|
874
|
+
], NavigationBar.prototype, "isScreenActive", 2);
|
|
875
|
+
__decorateClass$5([
|
|
876
|
+
n$2({ type: Object })
|
|
877
|
+
], NavigationBar.prototype, "position", 2);
|
|
878
|
+
__decorateClass$5([
|
|
879
|
+
n$2({ type: String })
|
|
880
|
+
], NavigationBar.prototype, "currentState", 2);
|
|
881
|
+
__decorateClass$5([
|
|
882
|
+
n$2({ type: String })
|
|
883
|
+
], NavigationBar.prototype, "direction", 2);
|
|
884
|
+
__decorateClass$5([
|
|
885
|
+
n$2({ type: Function })
|
|
886
|
+
], NavigationBar.prototype, "onItemSelect", 2);
|
|
887
|
+
if (!customElements.get("obi-navigation-bar")) {
|
|
888
|
+
customElements.define("obi-navigation-bar", NavigationBar);
|
|
889
|
+
}
|
|
890
|
+
const navigationBar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
891
|
+
__proto__: null,
|
|
892
|
+
NavigationBar
|
|
893
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
894
|
+
var __defProp$4 = Object.defineProperty;
|
|
895
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
896
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
897
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
898
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
899
|
+
if (decorator = decorators[i3])
|
|
900
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
901
|
+
if (kind && result)
|
|
902
|
+
__defProp$4(target, key, result);
|
|
903
|
+
return result;
|
|
904
|
+
};
|
|
905
|
+
class Course extends i$1 {
|
|
906
|
+
constructor() {
|
|
907
|
+
super(...arguments);
|
|
908
|
+
this.id = "";
|
|
909
|
+
this.name = "";
|
|
910
|
+
this.description = "";
|
|
911
|
+
this.imageSrc = "";
|
|
912
|
+
}
|
|
913
|
+
handleClick() {
|
|
914
|
+
if (this.onSelect) {
|
|
915
|
+
this.onSelect(this.id);
|
|
916
|
+
}
|
|
917
|
+
this.dispatchEvent(
|
|
918
|
+
new CustomEvent("course-select", {
|
|
919
|
+
detail: { id: this.id },
|
|
920
|
+
bubbles: true,
|
|
921
|
+
composed: true
|
|
922
|
+
})
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
render() {
|
|
926
|
+
return x`
|
|
927
|
+
<div class="course-container" @click=${this.handleClick}>
|
|
928
|
+
<img src=${this.imageSrc} alt="Course Preview" class="course-image" />
|
|
929
|
+
<h2 class="course-title">${this.name}</h2>
|
|
930
|
+
${this.description ? x`<p class="course-description">${this.description}</p>` : ""}
|
|
931
|
+
</div>
|
|
932
|
+
`;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
Course.styles = i$4`
|
|
936
|
+
:host {
|
|
937
|
+
display: block;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
.course-container {
|
|
941
|
+
padding: 16px 12px;
|
|
942
|
+
gap: 12px;
|
|
943
|
+
border-radius: 4px;
|
|
944
|
+
border: 1px solid #e5e7eb;
|
|
945
|
+
cursor: pointer;
|
|
946
|
+
transition: all 0.2s;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.course-container:hover {
|
|
950
|
+
background-color: #f9fafb;
|
|
951
|
+
border-color: #d1d5db;
|
|
952
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
.course-container:active {
|
|
956
|
+
transform: scale(0.98);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
.course-image {
|
|
960
|
+
max-height: 160px;
|
|
961
|
+
border-radius: 2px;
|
|
962
|
+
border: 1px solid #e5e7eb;
|
|
963
|
+
object-fit: cover;
|
|
964
|
+
width: 100%;
|
|
965
|
+
margin-bottom: 12px;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
.course-title {
|
|
969
|
+
font-size: 14px;
|
|
970
|
+
font-weight: bold;
|
|
971
|
+
margin: 0;
|
|
972
|
+
margin-bottom: 12px;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
.course-description {
|
|
976
|
+
font-size: 14px;
|
|
977
|
+
color: #71717a;
|
|
978
|
+
margin: 0;
|
|
979
|
+
}
|
|
980
|
+
`;
|
|
981
|
+
__decorateClass$4([
|
|
982
|
+
n$2({ type: String })
|
|
983
|
+
], Course.prototype, "id", 2);
|
|
984
|
+
__decorateClass$4([
|
|
985
|
+
n$2({ type: String })
|
|
986
|
+
], Course.prototype, "name", 2);
|
|
987
|
+
__decorateClass$4([
|
|
988
|
+
n$2({ type: String })
|
|
989
|
+
], Course.prototype, "description", 2);
|
|
990
|
+
__decorateClass$4([
|
|
991
|
+
n$2({ type: String })
|
|
992
|
+
], Course.prototype, "imageSrc", 2);
|
|
993
|
+
__decorateClass$4([
|
|
994
|
+
n$2({ type: Function })
|
|
995
|
+
], Course.prototype, "onSelect", 2);
|
|
996
|
+
class CourseList extends i$1 {
|
|
997
|
+
constructor() {
|
|
998
|
+
super(...arguments);
|
|
999
|
+
this.courses = [];
|
|
1000
|
+
this.loading = false;
|
|
1001
|
+
this.error = "";
|
|
1002
|
+
}
|
|
1003
|
+
handleCourseSelect(e2) {
|
|
1004
|
+
if (this.onCourseSelect) {
|
|
1005
|
+
this.onCourseSelect(e2.detail.id);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
render() {
|
|
1009
|
+
if (this.loading) {
|
|
1010
|
+
return x`<div class="loading">Loading...</div>`;
|
|
1011
|
+
}
|
|
1012
|
+
if (this.error) {
|
|
1013
|
+
return x`<div class="error">${this.error}</div>`;
|
|
1014
|
+
}
|
|
1015
|
+
if (!this.courses || this.courses.length === 0) {
|
|
1016
|
+
return x`<div class="empty">No courses available</div>`;
|
|
1017
|
+
}
|
|
1018
|
+
const gridClass = this.courses.length === 1 ? "grid-cols-1" : this.courses.length === 2 ? "grid-cols-2" : "grid-cols-3";
|
|
1019
|
+
return x`
|
|
1020
|
+
<div class="course-grid ${gridClass}">
|
|
1021
|
+
${this.courses.map(
|
|
1022
|
+
(course) => x`
|
|
1023
|
+
<obi-course
|
|
1024
|
+
id=${course.id}
|
|
1025
|
+
name=${course.name}
|
|
1026
|
+
description=${course.description || ""}
|
|
1027
|
+
imageSrc=${course.imageSrc}
|
|
1028
|
+
@course-select=${this.handleCourseSelect}
|
|
1029
|
+
></obi-course>
|
|
1030
|
+
`
|
|
1031
|
+
)}
|
|
1032
|
+
</div>
|
|
1033
|
+
`;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
CourseList.styles = i$4`
|
|
1037
|
+
:host {
|
|
1038
|
+
display: block;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
.course-grid {
|
|
1042
|
+
display: grid;
|
|
1043
|
+
gap: 12px;
|
|
1044
|
+
margin-top: 24px;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
.course-grid.grid-cols-1 {
|
|
1048
|
+
grid-template-columns: 1fr;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.course-grid.grid-cols-2 {
|
|
1052
|
+
grid-template-columns: 1fr 1fr;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
.course-grid.grid-cols-3 {
|
|
1056
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
.loading,
|
|
1060
|
+
.error,
|
|
1061
|
+
.empty {
|
|
1062
|
+
display: flex;
|
|
1063
|
+
justify-content: center;
|
|
1064
|
+
align-items: center;
|
|
1065
|
+
margin-top: 16px;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
.error {
|
|
1069
|
+
color: #ef4444;
|
|
1070
|
+
}
|
|
1071
|
+
`;
|
|
1072
|
+
__decorateClass$4([
|
|
1073
|
+
n$2({ type: Array })
|
|
1074
|
+
], CourseList.prototype, "courses", 2);
|
|
1075
|
+
__decorateClass$4([
|
|
1076
|
+
n$2({ type: Boolean })
|
|
1077
|
+
], CourseList.prototype, "loading", 2);
|
|
1078
|
+
__decorateClass$4([
|
|
1079
|
+
n$2({ type: String })
|
|
1080
|
+
], CourseList.prototype, "error", 2);
|
|
1081
|
+
__decorateClass$4([
|
|
1082
|
+
n$2({ type: Function })
|
|
1083
|
+
], CourseList.prototype, "onCourseSelect", 2);
|
|
1084
|
+
if (!customElements.get("obi-course")) {
|
|
1085
|
+
customElements.define("obi-course", Course);
|
|
1086
|
+
}
|
|
1087
|
+
if (!customElements.get("obi-course-list")) {
|
|
1088
|
+
customElements.define("obi-course-list", CourseList);
|
|
1089
|
+
}
|
|
1090
|
+
const courses = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1091
|
+
__proto__: null,
|
|
1092
|
+
Course,
|
|
1093
|
+
CourseList
|
|
1094
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1095
|
+
var __defProp$3 = Object.defineProperty;
|
|
1096
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
1097
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
1098
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
1099
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
1100
|
+
if (decorator = decorators[i3])
|
|
1101
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1102
|
+
if (kind && result)
|
|
1103
|
+
__defProp$3(target, key, result);
|
|
1104
|
+
return result;
|
|
1105
|
+
};
|
|
1106
|
+
class CourseModal extends i$1 {
|
|
1107
|
+
constructor() {
|
|
1108
|
+
super(...arguments);
|
|
1109
|
+
this.courses = [];
|
|
1110
|
+
this.loading = true;
|
|
1111
|
+
this.error = "";
|
|
1112
|
+
this.apiKey = "";
|
|
1113
|
+
this.apiBaseUrl = "";
|
|
1114
|
+
}
|
|
1115
|
+
handleCourseSelect(e2) {
|
|
1116
|
+
if (this.onCourseSelect) {
|
|
1117
|
+
this.onCourseSelect(e2.detail.id);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
handleClose() {
|
|
1121
|
+
if (this.onClose) {
|
|
1122
|
+
this.onClose();
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
async fetchCourses() {
|
|
1126
|
+
try {
|
|
1127
|
+
this.loading = true;
|
|
1128
|
+
const raw_response = await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`);
|
|
1129
|
+
const response = await raw_response.json();
|
|
1130
|
+
const mappedCourses = response.map((session) => ({
|
|
1131
|
+
id: session.uuid,
|
|
1132
|
+
name: session.onboarding_plan.name,
|
|
1133
|
+
description: session.onboarding_plan.description,
|
|
1134
|
+
imageSrc: session.onboarding_plan.screen_url || "https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"
|
|
1135
|
+
}));
|
|
1136
|
+
const filteredCourses = mappedCourses.filter((course) => !!course.name);
|
|
1137
|
+
this.courses = [...filteredCourses];
|
|
1138
|
+
this.requestUpdate();
|
|
1139
|
+
} catch (err) {
|
|
1140
|
+
console.error("Fetch error:", err);
|
|
1141
|
+
this.error = "Failed to fetch courses";
|
|
1142
|
+
} finally {
|
|
1143
|
+
this.loading = false;
|
|
1144
|
+
this.requestUpdate();
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
connectedCallback() {
|
|
1148
|
+
super.connectedCallback();
|
|
1149
|
+
if (window.obiWidgetConfig?.apiKey) {
|
|
1150
|
+
this.apiKey = window.obiWidgetConfig.apiKey;
|
|
1151
|
+
}
|
|
1152
|
+
this.apiBaseUrl = API_BASE_URL;
|
|
1153
|
+
if (this.apiBaseUrl && this.apiKey) {
|
|
1154
|
+
this.fetchCourses();
|
|
1155
|
+
} else {
|
|
1156
|
+
this.loading = false;
|
|
1157
|
+
this.error = "API base URL or API key is missing";
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
render() {
|
|
1161
|
+
return x`
|
|
1162
|
+
<div class="backdrop" @click=${this.handleClose}></div>
|
|
1163
|
+
<div class="container">
|
|
1164
|
+
<button class="close-button" @click=${this.handleClose}>×</button>
|
|
1165
|
+
<div class="header">
|
|
1166
|
+
<h1>Give Obi a try!</h1>
|
|
1167
|
+
<p class="subtitle">Pick a tour, share your screen, and Obi will take it from there.</p>
|
|
1168
|
+
</div>
|
|
1169
|
+
|
|
1170
|
+
<obi-course-list
|
|
1171
|
+
.courses=${this.courses}
|
|
1172
|
+
.loading=${this.loading}
|
|
1173
|
+
.error=${this.error}
|
|
1174
|
+
@course-select=${this.handleCourseSelect}
|
|
1175
|
+
></obi-course-list>
|
|
1176
|
+
</div>
|
|
1177
|
+
`;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
CourseModal.styles = i$4`
|
|
1181
|
+
:host {
|
|
1182
|
+
display: block;
|
|
1183
|
+
font-family: "Syne", sans-serif;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
.backdrop {
|
|
1187
|
+
position: fixed;
|
|
1188
|
+
top: 0;
|
|
1189
|
+
right: 0;
|
|
1190
|
+
bottom: 0;
|
|
1191
|
+
left: 0;
|
|
1192
|
+
background-color: black;
|
|
1193
|
+
opacity: 0.7;
|
|
1194
|
+
z-index: 40;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
.container {
|
|
1198
|
+
position: fixed;
|
|
1199
|
+
background-color: white;
|
|
1200
|
+
color: black;
|
|
1201
|
+
border: 1px solid #e5e7eb;
|
|
1202
|
+
width: 640px;
|
|
1203
|
+
max-height: 80vh;
|
|
1204
|
+
overflow-y: auto;
|
|
1205
|
+
padding: 48px;
|
|
1206
|
+
gap: 12px;
|
|
1207
|
+
top: 50%;
|
|
1208
|
+
left: 50%;
|
|
1209
|
+
transform: translate(-50%, -50%);
|
|
1210
|
+
border-radius: 4px;
|
|
1211
|
+
z-index: 50;
|
|
1212
|
+
display: flex;
|
|
1213
|
+
flex-direction: column;
|
|
1214
|
+
text-align: center;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
.container:hover {
|
|
1218
|
+
cursor: auto;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
.container::-webkit-scrollbar {
|
|
1222
|
+
width: 0.5rem;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.container::-webkit-scrollbar-track {
|
|
1226
|
+
background-color: #f3f4f6;
|
|
1227
|
+
border-radius: 9999px;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.container::-webkit-scrollbar-thumb {
|
|
1231
|
+
background-color: #d1d5db;
|
|
1232
|
+
border-radius: 9999px;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
.header {
|
|
1236
|
+
margin-bottom: 24px;
|
|
1237
|
+
text-align: center;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
h1 {
|
|
1241
|
+
font-size: 32px;
|
|
1242
|
+
font-weight: 700;
|
|
1243
|
+
margin: 0;
|
|
1244
|
+
margin-bottom: 8px;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
.subtitle {
|
|
1248
|
+
font-size: 20px;
|
|
1249
|
+
color: rgb(113 113 122 / 1);
|
|
1250
|
+
margin: 0;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
.close-button {
|
|
1254
|
+
position: absolute;
|
|
1255
|
+
top: 16px;
|
|
1256
|
+
right: 16px;
|
|
1257
|
+
background: none;
|
|
1258
|
+
border: none;
|
|
1259
|
+
cursor: pointer;
|
|
1260
|
+
font-size: 24px;
|
|
1261
|
+
color: #6b7280;
|
|
1262
|
+
}
|
|
1263
|
+
`;
|
|
1264
|
+
__decorateClass$3([
|
|
1265
|
+
n$2({ type: Array })
|
|
1266
|
+
], CourseModal.prototype, "courses", 2);
|
|
1267
|
+
__decorateClass$3([
|
|
1268
|
+
n$2({ type: Boolean })
|
|
1269
|
+
], CourseModal.prototype, "loading", 2);
|
|
1270
|
+
__decorateClass$3([
|
|
1271
|
+
n$2({ type: String })
|
|
1272
|
+
], CourseModal.prototype, "error", 2);
|
|
1273
|
+
__decorateClass$3([
|
|
1274
|
+
n$2({ type: String })
|
|
1275
|
+
], CourseModal.prototype, "apiKey", 2);
|
|
1276
|
+
__decorateClass$3([
|
|
1277
|
+
n$2({ type: Function })
|
|
1278
|
+
], CourseModal.prototype, "onCourseSelect", 2);
|
|
1279
|
+
__decorateClass$3([
|
|
1280
|
+
n$2({ type: Function })
|
|
1281
|
+
], CourseModal.prototype, "onClose", 2);
|
|
1282
|
+
__decorateClass$3([
|
|
1283
|
+
r$1()
|
|
1284
|
+
], CourseModal.prototype, "apiBaseUrl", 2);
|
|
1285
|
+
if (!customElements.get("obi-course-modal")) {
|
|
1286
|
+
customElements.define("obi-course-modal", CourseModal);
|
|
1287
|
+
}
|
|
1288
|
+
const courseModal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1289
|
+
__proto__: null,
|
|
1290
|
+
CourseModal
|
|
1291
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1292
|
+
const f$1 = (o2) => void 0 === o2.strings;
|
|
1293
|
+
const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e$1 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
|
|
1294
|
+
class i2 {
|
|
1295
|
+
constructor(t2) {
|
|
1296
|
+
}
|
|
1297
|
+
get _$AU() {
|
|
1298
|
+
return this._$AM._$AU;
|
|
1299
|
+
}
|
|
1300
|
+
_$AT(t2, e2, i3) {
|
|
1301
|
+
this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
|
|
1302
|
+
}
|
|
1303
|
+
_$AS(t2, e2) {
|
|
1304
|
+
return this.update(t2, e2);
|
|
1305
|
+
}
|
|
1306
|
+
update(t2, e2) {
|
|
1307
|
+
return this.render(...e2);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
const s = (i3, t2) => {
|
|
1311
|
+
const e2 = i3._$AN;
|
|
1312
|
+
if (void 0 === e2)
|
|
1313
|
+
return false;
|
|
1314
|
+
for (const i4 of e2)
|
|
1315
|
+
i4._$AO?.(t2, false), s(i4, t2);
|
|
1316
|
+
return true;
|
|
1317
|
+
}, o$1 = (i3) => {
|
|
1318
|
+
let t2, e2;
|
|
1319
|
+
do {
|
|
1320
|
+
if (void 0 === (t2 = i3._$AM))
|
|
1321
|
+
break;
|
|
1322
|
+
e2 = t2._$AN, e2.delete(i3), i3 = t2;
|
|
1323
|
+
} while (0 === e2?.size);
|
|
1324
|
+
}, r = (i3) => {
|
|
1325
|
+
for (let t2; t2 = i3._$AM; i3 = t2) {
|
|
1326
|
+
let e2 = t2._$AN;
|
|
1327
|
+
if (void 0 === e2)
|
|
1328
|
+
t2._$AN = e2 = /* @__PURE__ */ new Set();
|
|
1329
|
+
else if (e2.has(i3))
|
|
1330
|
+
break;
|
|
1331
|
+
e2.add(i3), c(t2);
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
function h$1(i3) {
|
|
1335
|
+
void 0 !== this._$AN ? (o$1(this), this._$AM = i3, r(this)) : this._$AM = i3;
|
|
1336
|
+
}
|
|
1337
|
+
function n$1(i3, t2 = false, e2 = 0) {
|
|
1338
|
+
const r2 = this._$AH, h2 = this._$AN;
|
|
1339
|
+
if (void 0 !== h2 && 0 !== h2.size)
|
|
1340
|
+
if (t2)
|
|
1341
|
+
if (Array.isArray(r2))
|
|
1342
|
+
for (let i4 = e2; i4 < r2.length; i4++)
|
|
1343
|
+
s(r2[i4], false), o$1(r2[i4]);
|
|
1344
|
+
else
|
|
1345
|
+
null != r2 && (s(r2, false), o$1(r2));
|
|
1346
|
+
else
|
|
1347
|
+
s(this, i3);
|
|
1348
|
+
}
|
|
1349
|
+
const c = (i3) => {
|
|
1350
|
+
i3.type == t.CHILD && (i3._$AP ?? (i3._$AP = n$1), i3._$AQ ?? (i3._$AQ = h$1));
|
|
1351
|
+
};
|
|
1352
|
+
class f extends i2 {
|
|
1353
|
+
constructor() {
|
|
1354
|
+
super(...arguments), this._$AN = void 0;
|
|
1355
|
+
}
|
|
1356
|
+
_$AT(i3, t2, e2) {
|
|
1357
|
+
super._$AT(i3, t2, e2), r(this), this.isConnected = i3._$AU;
|
|
1358
|
+
}
|
|
1359
|
+
_$AO(i3, t2 = true) {
|
|
1360
|
+
i3 !== this.isConnected && (this.isConnected = i3, i3 ? this.reconnected?.() : this.disconnected?.()), t2 && (s(this, i3), o$1(this));
|
|
1361
|
+
}
|
|
1362
|
+
setValue(t2) {
|
|
1363
|
+
if (f$1(this._$Ct))
|
|
1364
|
+
this._$Ct._$AI(t2, this);
|
|
1365
|
+
else {
|
|
1366
|
+
const i3 = [...this._$Ct._$AH];
|
|
1367
|
+
i3[this._$Ci] = t2, this._$Ct._$AI(i3, this, 0);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
disconnected() {
|
|
1371
|
+
}
|
|
1372
|
+
reconnected() {
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
const e = () => new h();
|
|
1376
|
+
class h {
|
|
1377
|
+
}
|
|
1378
|
+
const o = /* @__PURE__ */ new WeakMap(), n2 = e$1(class extends f {
|
|
1379
|
+
render(i3) {
|
|
1380
|
+
return E;
|
|
1381
|
+
}
|
|
1382
|
+
update(i3, [s2]) {
|
|
1383
|
+
const e2 = s2 !== this.G;
|
|
1384
|
+
return e2 && void 0 !== this.G && this.rt(void 0), (e2 || this.lt !== this.ct) && (this.G = s2, this.ht = i3.options?.host, this.rt(this.ct = i3.element)), E;
|
|
1385
|
+
}
|
|
1386
|
+
rt(t2) {
|
|
1387
|
+
if (this.isConnected || (t2 = void 0), "function" == typeof this.G) {
|
|
1388
|
+
const i3 = this.ht ?? globalThis;
|
|
1389
|
+
let s2 = o.get(i3);
|
|
1390
|
+
void 0 === s2 && (s2 = /* @__PURE__ */ new WeakMap(), o.set(i3, s2)), void 0 !== s2.get(this.G) && this.G.call(this.ht, void 0), s2.set(this.G, t2), void 0 !== t2 && this.G.call(this.ht, t2);
|
|
1391
|
+
} else
|
|
1392
|
+
this.G.value = t2;
|
|
1393
|
+
}
|
|
1394
|
+
get lt() {
|
|
1395
|
+
return "function" == typeof this.G ? o.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
|
|
1396
|
+
}
|
|
1397
|
+
disconnected() {
|
|
1398
|
+
this.lt === this.ct && this.rt(void 0);
|
|
1399
|
+
}
|
|
1400
|
+
reconnected() {
|
|
1401
|
+
this.rt(this.ct);
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
var __defProp$2 = Object.defineProperty;
|
|
1405
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
1406
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
1407
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
1408
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
1409
|
+
if (decorator = decorators[i3])
|
|
1410
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1411
|
+
if (kind && result)
|
|
1412
|
+
__defProp$2(target, key, result);
|
|
1413
|
+
return result;
|
|
1414
|
+
};
|
|
1415
|
+
class AudioEqualizer extends i$1 {
|
|
1416
|
+
constructor() {
|
|
1417
|
+
super(...arguments);
|
|
1418
|
+
this.volume = { speaker: "ASSISTANT", volume: 0, spectrum: [] };
|
|
1419
|
+
this.canvasRef = e();
|
|
1420
|
+
this.barCount = 8;
|
|
1421
|
+
this.animationFrame = null;
|
|
1422
|
+
}
|
|
1423
|
+
connectedCallback() {
|
|
1424
|
+
super.connectedCallback();
|
|
1425
|
+
this.startAnimation();
|
|
1426
|
+
}
|
|
1427
|
+
disconnectedCallback() {
|
|
1428
|
+
super.disconnectedCallback();
|
|
1429
|
+
this.stopAnimation();
|
|
1430
|
+
}
|
|
1431
|
+
startAnimation() {
|
|
1432
|
+
const animate = () => {
|
|
1433
|
+
this.drawEqualizer();
|
|
1434
|
+
this.animationFrame = requestAnimationFrame(animate);
|
|
1435
|
+
};
|
|
1436
|
+
this.animationFrame = requestAnimationFrame(animate);
|
|
1437
|
+
}
|
|
1438
|
+
stopAnimation() {
|
|
1439
|
+
if (this.animationFrame) {
|
|
1440
|
+
cancelAnimationFrame(this.animationFrame);
|
|
1441
|
+
this.animationFrame = null;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
drawEqualizer() {
|
|
1445
|
+
const canvas = this.canvasRef.value;
|
|
1446
|
+
if (!canvas)
|
|
1447
|
+
return;
|
|
1448
|
+
const ctx = canvas.getContext("2d");
|
|
1449
|
+
if (!ctx)
|
|
1450
|
+
return;
|
|
1451
|
+
const dpr = window.devicePixelRatio || 1;
|
|
1452
|
+
const displayWidth = canvas.clientWidth;
|
|
1453
|
+
const displayHeight = canvas.clientHeight;
|
|
1454
|
+
canvas.width = displayWidth * dpr;
|
|
1455
|
+
canvas.height = displayHeight * dpr;
|
|
1456
|
+
ctx.scale(dpr, dpr);
|
|
1457
|
+
ctx.clearRect(0, 0, displayWidth, displayHeight);
|
|
1458
|
+
const gap = 3;
|
|
1459
|
+
const barWidth = Math.max(1, (displayWidth - (this.barCount - 1) * gap) / this.barCount);
|
|
1460
|
+
const barMaxHeight = displayHeight / 2;
|
|
1461
|
+
const currentVolume = this.volume.speaker === "USER" ? this.volume.volume : this.volume.volume;
|
|
1462
|
+
const currentSpectrum = this.volume.speaker === "USER" ? this.volume.spectrum : this.volume.spectrum;
|
|
1463
|
+
if (currentVolume === 0)
|
|
1464
|
+
return;
|
|
1465
|
+
let processedSpectrum = [];
|
|
1466
|
+
if (currentSpectrum && currentSpectrum.length > 0) {
|
|
1467
|
+
const spectrumLength = currentSpectrum.length;
|
|
1468
|
+
const regionSize = Math.ceil(spectrumLength / 10);
|
|
1469
|
+
let energyByRegion = [];
|
|
1470
|
+
for (let i3 = 0; i3 < 10; i3++) {
|
|
1471
|
+
const start = i3 * regionSize;
|
|
1472
|
+
const end = Math.min((i3 + 1) * regionSize, spectrumLength);
|
|
1473
|
+
let regionEnergy = 0;
|
|
1474
|
+
for (let j2 = start; j2 < end; j2++) {
|
|
1475
|
+
regionEnergy += currentSpectrum[j2] || 0;
|
|
1476
|
+
}
|
|
1477
|
+
energyByRegion.push({ region: i3, startIdx: start, endIdx: end, energy: regionEnergy });
|
|
1478
|
+
}
|
|
1479
|
+
energyByRegion.sort((a2, b2) => b2.energy - a2.energy);
|
|
1480
|
+
const topRegions = energyByRegion.slice(0, 3);
|
|
1481
|
+
const startIdx = Math.min(...topRegions.map((r2) => r2.startIdx));
|
|
1482
|
+
const endIdx = Math.max(...topRegions.map((r2) => r2.endIdx));
|
|
1483
|
+
if (endIdx > startIdx) {
|
|
1484
|
+
for (let i3 = 0; i3 < this.barCount; i3++) {
|
|
1485
|
+
const position = startIdx + i3 / (this.barCount - 1) * (endIdx - startIdx);
|
|
1486
|
+
const index = Math.min(spectrumLength - 1, Math.floor(position));
|
|
1487
|
+
processedSpectrum[i3] = currentSpectrum[index] || 0;
|
|
1488
|
+
}
|
|
1489
|
+
} else {
|
|
1490
|
+
for (let i3 = 0; i3 < this.barCount; i3++) {
|
|
1491
|
+
const position = i3 / (this.barCount - 1) * (spectrumLength / 2);
|
|
1492
|
+
const index = Math.min(spectrumLength - 1, Math.floor(position));
|
|
1493
|
+
processedSpectrum[i3] = currentSpectrum[index] || 0;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
const maxSpectrumValue = Math.max(...processedSpectrum, 1);
|
|
1497
|
+
const amplificationFactorRoot = this.volume.speaker === "USER" ? 0.7 : 0.6;
|
|
1498
|
+
processedSpectrum = processedSpectrum.map((value, index) => {
|
|
1499
|
+
const relativeValue = value / maxSpectrumValue;
|
|
1500
|
+
const amplificationFactor = amplificationFactorRoot + index / (this.barCount - 1) * 0.3;
|
|
1501
|
+
return Math.min(1, relativeValue * amplificationFactor);
|
|
1502
|
+
});
|
|
1503
|
+
} else {
|
|
1504
|
+
if (this.volume.speaker !== "USER") {
|
|
1505
|
+
for (let i3 = 0; i3 < this.barCount; i3++) {
|
|
1506
|
+
const time = Date.now() * 2e-3;
|
|
1507
|
+
const value = 0.3 + 0.2 * Math.sin(time + i3 * 0.7);
|
|
1508
|
+
processedSpectrum[i3] = value;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
for (let i3 = 0; i3 < this.barCount; i3++) {
|
|
1513
|
+
const spectrumValue = processedSpectrum.length > 0 ? processedSpectrum[i3] !== void 0 ? processedSpectrum[i3] : currentVolume : currentVolume;
|
|
1514
|
+
if (this.volume.speaker === "USER") {
|
|
1515
|
+
ctx.fillStyle = `rgba(109, 40, 217, ${spectrumValue * 0.5 + 0.5})`;
|
|
1516
|
+
} else {
|
|
1517
|
+
ctx.fillStyle = `rgba(255, 255, 255, ${spectrumValue * 0.5 + 0.5})`;
|
|
1518
|
+
}
|
|
1519
|
+
const barHeight = Math.max(2, spectrumValue * 0.8 * barMaxHeight);
|
|
1520
|
+
const x2 = displayWidth - (this.barCount - i3) * (barWidth + gap);
|
|
1521
|
+
const radius = barWidth / 2;
|
|
1522
|
+
ctx.beginPath();
|
|
1523
|
+
ctx.moveTo(x2 + radius, displayHeight / 2 - barHeight);
|
|
1524
|
+
ctx.lineTo(x2 + barWidth - radius, displayHeight / 2 - barHeight);
|
|
1525
|
+
ctx.quadraticCurveTo(
|
|
1526
|
+
x2 + barWidth,
|
|
1527
|
+
displayHeight / 2 - barHeight,
|
|
1528
|
+
x2 + barWidth,
|
|
1529
|
+
displayHeight / 2 - barHeight + radius
|
|
1530
|
+
);
|
|
1531
|
+
ctx.lineTo(x2 + barWidth, displayHeight / 2);
|
|
1532
|
+
ctx.lineTo(x2, displayHeight / 2);
|
|
1533
|
+
ctx.lineTo(x2, displayHeight / 2 - barHeight + radius);
|
|
1534
|
+
ctx.quadraticCurveTo(
|
|
1535
|
+
x2,
|
|
1536
|
+
displayHeight / 2 - barHeight,
|
|
1537
|
+
x2 + radius,
|
|
1538
|
+
displayHeight / 2 - barHeight
|
|
1539
|
+
);
|
|
1540
|
+
ctx.fill();
|
|
1541
|
+
ctx.beginPath();
|
|
1542
|
+
ctx.moveTo(x2, displayHeight / 2);
|
|
1543
|
+
ctx.lineTo(x2 + barWidth, displayHeight / 2);
|
|
1544
|
+
ctx.lineTo(x2 + barWidth, displayHeight / 2 + barHeight - radius);
|
|
1545
|
+
ctx.quadraticCurveTo(
|
|
1546
|
+
x2 + barWidth,
|
|
1547
|
+
displayHeight / 2 + barHeight,
|
|
1548
|
+
x2 + barWidth - radius,
|
|
1549
|
+
displayHeight / 2 + barHeight
|
|
1550
|
+
);
|
|
1551
|
+
ctx.lineTo(x2 + radius, displayHeight / 2 + barHeight);
|
|
1552
|
+
ctx.quadraticCurveTo(
|
|
1553
|
+
x2,
|
|
1554
|
+
displayHeight / 2 + barHeight,
|
|
1555
|
+
x2,
|
|
1556
|
+
displayHeight / 2 + barHeight - radius
|
|
1557
|
+
);
|
|
1558
|
+
ctx.lineTo(x2, displayHeight / 2);
|
|
1559
|
+
ctx.fill();
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
render() {
|
|
1563
|
+
return x` <canvas ${n2(this.canvasRef)} width="52" height="52"></canvas> `;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
AudioEqualizer.styles = i$4`
|
|
1567
|
+
:host {
|
|
1568
|
+
display: block;
|
|
1569
|
+
width: 40px;
|
|
1570
|
+
height: 40px;
|
|
1571
|
+
margin: 4px;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
canvas {
|
|
1575
|
+
width: 100%;
|
|
1576
|
+
height: 100%;
|
|
1577
|
+
}
|
|
1578
|
+
`;
|
|
1579
|
+
__decorateClass$2([
|
|
1580
|
+
n$2({ type: Object })
|
|
1581
|
+
], AudioEqualizer.prototype, "volume", 2);
|
|
1582
|
+
__decorateClass$2([
|
|
1583
|
+
r$1()
|
|
1584
|
+
], AudioEqualizer.prototype, "canvasRef", 2);
|
|
1585
|
+
if (!customElements.get("obi-audio-equalizer")) {
|
|
1586
|
+
customElements.define("obi-audio-equalizer", AudioEqualizer);
|
|
1587
|
+
}
|
|
1588
|
+
const audioEqualizer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1589
|
+
__proto__: null,
|
|
1590
|
+
AudioEqualizer
|
|
1591
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1592
|
+
var __defProp$1 = Object.defineProperty;
|
|
1593
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
1594
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
1595
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
1596
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
1597
|
+
if (decorator = decorators[i3])
|
|
1598
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1599
|
+
if (kind && result)
|
|
1600
|
+
__defProp$1(target, key, result);
|
|
1601
|
+
return result;
|
|
1602
|
+
};
|
|
1603
|
+
class DotLoader extends i$1 {
|
|
1604
|
+
constructor() {
|
|
1605
|
+
super(...arguments);
|
|
1606
|
+
this.activeDots = Array(5).fill(false);
|
|
1607
|
+
this.numDots = 5;
|
|
1608
|
+
this.containerWidth = 32;
|
|
1609
|
+
this.dotSize = 2;
|
|
1610
|
+
this.bounceHeight = 12;
|
|
1611
|
+
this.animationDuration = 200;
|
|
1612
|
+
this.pauseDuration = 300;
|
|
1613
|
+
this.overlapFactor = 0.7;
|
|
1614
|
+
this.color = "#FFF";
|
|
1615
|
+
this.timeoutIds = [];
|
|
1616
|
+
}
|
|
1617
|
+
connectedCallback() {
|
|
1618
|
+
super.connectedCallback();
|
|
1619
|
+
this.startAnimation();
|
|
1620
|
+
this.style.setProperty("--dot-loader-width", `${this.containerWidth}px`);
|
|
1621
|
+
this.style.setProperty("--dot-size", `${this.dotSize}px`);
|
|
1622
|
+
this.style.setProperty("--dot-color", this.color);
|
|
1623
|
+
}
|
|
1624
|
+
disconnectedCallback() {
|
|
1625
|
+
super.disconnectedCallback();
|
|
1626
|
+
this.stopAnimation();
|
|
1627
|
+
}
|
|
1628
|
+
startAnimation() {
|
|
1629
|
+
this.animateSequence();
|
|
1630
|
+
}
|
|
1631
|
+
stopAnimation() {
|
|
1632
|
+
this.timeoutIds.forEach((id) => window.clearTimeout(id));
|
|
1633
|
+
this.timeoutIds = [];
|
|
1634
|
+
}
|
|
1635
|
+
animateSequence() {
|
|
1636
|
+
this.activeDots = Array(this.numDots).fill(false);
|
|
1637
|
+
for (let i3 = 0; i3 < this.numDots; i3++) {
|
|
1638
|
+
const delay = i3 * (this.animationDuration * this.overlapFactor);
|
|
1639
|
+
const bounceStartId = window.setTimeout(() => {
|
|
1640
|
+
this.activeDots = [...this.activeDots];
|
|
1641
|
+
this.activeDots[i3] = true;
|
|
1642
|
+
const bounceEndId = window.setTimeout(() => {
|
|
1643
|
+
this.activeDots = [...this.activeDots];
|
|
1644
|
+
this.activeDots[i3] = false;
|
|
1645
|
+
}, this.animationDuration);
|
|
1646
|
+
this.timeoutIds.push(bounceEndId);
|
|
1647
|
+
}, delay);
|
|
1648
|
+
this.timeoutIds.push(bounceStartId);
|
|
1649
|
+
}
|
|
1650
|
+
const nextSequenceId = window.setTimeout(
|
|
1651
|
+
() => {
|
|
1652
|
+
this.animateSequence();
|
|
1653
|
+
},
|
|
1654
|
+
this.numDots * this.animationDuration * this.overlapFactor + this.pauseDuration
|
|
1655
|
+
);
|
|
1656
|
+
this.timeoutIds.push(nextSequenceId);
|
|
1657
|
+
}
|
|
1658
|
+
render() {
|
|
1659
|
+
return x`
|
|
1660
|
+
<div class="dot-loader">
|
|
1661
|
+
${this.activeDots.map(
|
|
1662
|
+
(isActive) => x`
|
|
1663
|
+
<div
|
|
1664
|
+
class="dot"
|
|
1665
|
+
style="transform: ${isActive ? `translateY(-${this.bounceHeight}px)` : "translateY(0)"}"
|
|
1666
|
+
></div>
|
|
1667
|
+
`
|
|
1668
|
+
)}
|
|
1669
|
+
</div>
|
|
1670
|
+
`;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
DotLoader.styles = i$4`
|
|
1674
|
+
:host {
|
|
1675
|
+
display: block;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
.dot-loader {
|
|
1679
|
+
display: flex;
|
|
1680
|
+
flex-direction: row;
|
|
1681
|
+
width: var(--dot-loader-width, 32px);
|
|
1682
|
+
height: 14px;
|
|
1683
|
+
justify-content: center;
|
|
1684
|
+
align-items: center;
|
|
1685
|
+
padding: 0;
|
|
1686
|
+
margin: 0;
|
|
1687
|
+
gap: 4px;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
.dot {
|
|
1691
|
+
width: var(--dot-size, 2px);
|
|
1692
|
+
height: var(--dot-size, 2px);
|
|
1693
|
+
border-radius: 50%;
|
|
1694
|
+
background-color: var(--dot-color, #fff);
|
|
1695
|
+
margin: 0;
|
|
1696
|
+
padding: 0;
|
|
1697
|
+
transition: transform 0.2s ease-in-out;
|
|
1698
|
+
opacity: 1;
|
|
1699
|
+
}
|
|
1700
|
+
`;
|
|
1701
|
+
__decorateClass$1([
|
|
1702
|
+
r$1()
|
|
1703
|
+
], DotLoader.prototype, "activeDots", 2);
|
|
1704
|
+
if (!customElements.get("obi-dot-loader")) {
|
|
1705
|
+
customElements.define("obi-dot-loader", DotLoader);
|
|
1706
|
+
}
|
|
1707
|
+
const dotLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1708
|
+
__proto__: null,
|
|
1709
|
+
DotLoader
|
|
1710
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1711
|
+
class SearchingLoader extends i$1 {
|
|
1712
|
+
render() {
|
|
1713
|
+
return x`
|
|
1714
|
+
<obi-dot-loader loading style="margin-left: 2px"></obi-dot-loader>
|
|
1715
|
+
<span class="text">Searching the knowledge base</span>
|
|
1716
|
+
`;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
SearchingLoader.styles = i$4`
|
|
1720
|
+
:host {
|
|
1721
|
+
display: flex;
|
|
1722
|
+
align-items: center;
|
|
1723
|
+
gap: 12px;
|
|
1724
|
+
background-color: #7c3aed;
|
|
1725
|
+
border-radius: 12px;
|
|
1726
|
+
padding: 8px 12px;
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
.text {
|
|
1730
|
+
color: white;
|
|
1731
|
+
font-weight: 500;
|
|
1732
|
+
font-size: 14px;
|
|
1733
|
+
}
|
|
1734
|
+
`;
|
|
1735
|
+
if (!customElements.get("obi-searching-loader")) {
|
|
1736
|
+
customElements.define("obi-searching-loader", SearchingLoader);
|
|
1737
|
+
}
|
|
1738
|
+
const searchingLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1739
|
+
__proto__: null,
|
|
1740
|
+
SearchingLoader
|
|
1741
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1742
|
+
var __defProp = Object.defineProperty;
|
|
1743
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1744
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
1745
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
1746
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
1747
|
+
if (decorator = decorators[i3])
|
|
1748
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1749
|
+
if (kind && result)
|
|
1750
|
+
__defProp(target, key, result);
|
|
1751
|
+
return result;
|
|
1752
|
+
};
|
|
1753
|
+
class ObiWidget extends i$1 {
|
|
1754
|
+
constructor() {
|
|
1755
|
+
super();
|
|
1756
|
+
this.apiKey = "";
|
|
1757
|
+
this.isActive = true;
|
|
1758
|
+
this.position = "bottom-right";
|
|
1759
|
+
this.user = null;
|
|
1760
|
+
this.state = SDKState.READY;
|
|
1761
|
+
this.storedActiveState = void 0;
|
|
1762
|
+
this.showCourseModal = false;
|
|
1763
|
+
this.isHovering = false;
|
|
1764
|
+
this.navVisible = false;
|
|
1765
|
+
this.activeSession = null;
|
|
1766
|
+
this.volume = {
|
|
1767
|
+
speaker: "ASSISTANT",
|
|
1768
|
+
volume: 0,
|
|
1769
|
+
spectrum: []
|
|
1770
|
+
};
|
|
1771
|
+
this.sessionToken = null;
|
|
1772
|
+
this.roomToken = null;
|
|
1773
|
+
this.roomUrl = null;
|
|
1774
|
+
this.boundSaveSessionData = null;
|
|
1775
|
+
this.closeNavTimeoutRef = null;
|
|
1776
|
+
this.updateFromConfig();
|
|
1777
|
+
const handleUnload = () => {
|
|
1778
|
+
if (this.activeSession && this.sessionToken && this.roomToken && this.roomUrl) {
|
|
1779
|
+
this.saveSessionData();
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
window.addEventListener("beforeunload", handleUnload);
|
|
1783
|
+
window.addEventListener("pagehide", handleUnload);
|
|
1784
|
+
}
|
|
1785
|
+
// Method to get values from window.obiWidgetConfig
|
|
1786
|
+
updateFromConfig() {
|
|
1787
|
+
if (window.obiWidgetConfig) {
|
|
1788
|
+
this.apiKey = window.obiWidgetConfig.apiKey || this.apiKey;
|
|
1789
|
+
this.position = window.obiWidgetConfig.position || this.position;
|
|
1790
|
+
this.user = window.obiWidgetConfig.user || this.user;
|
|
1791
|
+
if (window.obiWidgetConfig.isActive !== void 0) {
|
|
1792
|
+
this.isActive = window.obiWidgetConfig.isActive;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
async connectObi(sessionToken) {
|
|
1797
|
+
if (this.activeSession) {
|
|
1798
|
+
console.log("Connection already exists");
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
try {
|
|
1802
|
+
const session = new ObiSession({
|
|
1803
|
+
sessionId: sessionToken
|
|
1804
|
+
});
|
|
1805
|
+
if (!session) {
|
|
1806
|
+
console.error("Failed to create session");
|
|
1807
|
+
this.state = SDKState.ERROR;
|
|
1808
|
+
this.activeSession = null;
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
session.on("stateChanged", (data) => {
|
|
1812
|
+
this.state = data.newState;
|
|
1813
|
+
if (data.newState !== SDKState.READY) {
|
|
1814
|
+
this.storedActiveState = data.newState;
|
|
1815
|
+
}
|
|
1816
|
+
});
|
|
1817
|
+
session.on("volume", (data) => {
|
|
1818
|
+
this.volume = data;
|
|
1819
|
+
});
|
|
1820
|
+
session.on("error", (data) => {
|
|
1821
|
+
console.error("Session error:", data.error);
|
|
1822
|
+
this.state = SDKState.ERROR;
|
|
1823
|
+
this.activeSession = null;
|
|
1824
|
+
});
|
|
1825
|
+
const connectionInfo = await session.connect();
|
|
1826
|
+
if (connectionInfo) {
|
|
1827
|
+
this.sessionToken = sessionToken;
|
|
1828
|
+
this.roomToken = connectionInfo.token;
|
|
1829
|
+
this.roomUrl = connectionInfo.url;
|
|
1830
|
+
}
|
|
1831
|
+
this.activeSession = session;
|
|
1832
|
+
} catch (error) {
|
|
1833
|
+
console.error("Failed to start session:", error);
|
|
1834
|
+
this.state = SDKState.ERROR;
|
|
1835
|
+
this.activeSession = null;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
async handleSessionStart(sessionToken) {
|
|
1839
|
+
if (this.activeSession) {
|
|
1840
|
+
console.log("Connection already in progress or active session exists");
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
this.showCourseModal = false;
|
|
1844
|
+
this.state = SDKState.LOADING;
|
|
1845
|
+
await this.connectObi(sessionToken);
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Check if there's an existing session stored in localStorage
|
|
1849
|
+
* and attempt to reconnect if a valid session is found
|
|
1850
|
+
*/
|
|
1851
|
+
async checkExistingSession() {
|
|
1852
|
+
try {
|
|
1853
|
+
const sessionData = JSON.parse(
|
|
1854
|
+
storage.getItem(STORAGE_KEYS.SESSION_DATA) || "{}"
|
|
1855
|
+
);
|
|
1856
|
+
const { sessionToken, roomToken, roomUrl, sessionExpiry, obiState } = sessionData;
|
|
1857
|
+
if (!sessionToken || !roomToken || !roomUrl) {
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
if (sessionExpiry) {
|
|
1861
|
+
const expiryDate = new Date(sessionExpiry);
|
|
1862
|
+
if (expiryDate < /* @__PURE__ */ new Date()) {
|
|
1863
|
+
this.clearSessionStorage();
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
this.state = SDKState.LOADING;
|
|
1868
|
+
const session = new ObiSession({
|
|
1869
|
+
sessionId: sessionToken
|
|
1870
|
+
});
|
|
1871
|
+
if (!session) {
|
|
1872
|
+
console.error("Failed to create session");
|
|
1873
|
+
this.state = SDKState.ERROR;
|
|
1874
|
+
this.clearSessionStorage();
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
session.on("stateChanged", (data) => {
|
|
1878
|
+
this.state = data.newState;
|
|
1879
|
+
if (data.newState !== SDKState.READY) {
|
|
1880
|
+
this.storedActiveState = data.newState;
|
|
1881
|
+
}
|
|
1882
|
+
});
|
|
1883
|
+
session.on("volume", (data) => {
|
|
1884
|
+
this.volume = data;
|
|
1885
|
+
});
|
|
1886
|
+
session.on("error", (data) => {
|
|
1887
|
+
console.error("Session error:", data.error);
|
|
1888
|
+
this.state = SDKState.ERROR;
|
|
1889
|
+
this.activeSession = null;
|
|
1890
|
+
this.clearSessionStorage();
|
|
1891
|
+
});
|
|
1892
|
+
const reconnected = await session.reconnect(roomUrl, roomToken, obiState);
|
|
1893
|
+
if (reconnected) {
|
|
1894
|
+
this.activeSession = session;
|
|
1895
|
+
this.sessionToken = sessionToken;
|
|
1896
|
+
this.roomToken = roomToken;
|
|
1897
|
+
this.roomUrl = roomUrl;
|
|
1898
|
+
this.state = obiState;
|
|
1899
|
+
this.storedActiveState = obiState;
|
|
1900
|
+
} else {
|
|
1901
|
+
this.clearSessionStorage();
|
|
1902
|
+
}
|
|
1903
|
+
} catch (error) {
|
|
1904
|
+
console.error("Error reconnecting to session:", error);
|
|
1905
|
+
this.state = SDKState.ERROR;
|
|
1906
|
+
this.clearSessionStorage();
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Clear session-related data from localStorage
|
|
1911
|
+
*/
|
|
1912
|
+
clearSessionStorage() {
|
|
1913
|
+
storage.removeItem(STORAGE_KEYS.SESSION_DATA);
|
|
1914
|
+
}
|
|
1915
|
+
connectedCallback() {
|
|
1916
|
+
super.connectedCallback();
|
|
1917
|
+
this.updateFromConfig();
|
|
1918
|
+
this.setAttribute("position", this.position);
|
|
1919
|
+
this.boundSaveSessionData = this.saveSessionData.bind(this);
|
|
1920
|
+
window.addEventListener("beforeunload", this.boundSaveSessionData);
|
|
1921
|
+
window.addEventListener("pagehide", this.boundSaveSessionData);
|
|
1922
|
+
this.checkExistingSession();
|
|
1923
|
+
}
|
|
1924
|
+
// Method to save session data
|
|
1925
|
+
saveSessionData() {
|
|
1926
|
+
if (!this.activeSession)
|
|
1927
|
+
return;
|
|
1928
|
+
if (this.sessionToken && this.roomToken && this.roomUrl) {
|
|
1929
|
+
const expiry = /* @__PURE__ */ new Date();
|
|
1930
|
+
expiry.setMinutes(expiry.getMinutes() + 5);
|
|
1931
|
+
const sessionData = {
|
|
1932
|
+
sessionToken: this.sessionToken,
|
|
1933
|
+
roomToken: this.roomToken,
|
|
1934
|
+
roomUrl: this.roomUrl,
|
|
1935
|
+
obiState: this.storedActiveState ?? this.state,
|
|
1936
|
+
sessionExpiry: expiry.toISOString()
|
|
1937
|
+
};
|
|
1938
|
+
storage.setItem(STORAGE_KEYS.SESSION_DATA, JSON.stringify(sessionData));
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
disconnectedCallback() {
|
|
1942
|
+
if (this.closeNavTimeoutRef !== null) {
|
|
1943
|
+
window.clearTimeout(this.closeNavTimeoutRef);
|
|
1944
|
+
}
|
|
1945
|
+
if (this.boundSaveSessionData) {
|
|
1946
|
+
window.removeEventListener("beforeunload", this.boundSaveSessionData);
|
|
1947
|
+
window.removeEventListener("pagehide", this.boundSaveSessionData);
|
|
1948
|
+
}
|
|
1949
|
+
super.disconnectedCallback();
|
|
1950
|
+
}
|
|
1951
|
+
handleMouseEnter() {
|
|
1952
|
+
this.isHovering = true;
|
|
1953
|
+
this.navVisible = true;
|
|
1954
|
+
}
|
|
1955
|
+
handleMouseLeave() {
|
|
1956
|
+
this.isHovering = false;
|
|
1957
|
+
if (this.closeNavTimeoutRef !== null) {
|
|
1958
|
+
window.clearTimeout(this.closeNavTimeoutRef);
|
|
1959
|
+
}
|
|
1960
|
+
this.closeNavTimeoutRef = window.setTimeout(() => {
|
|
1961
|
+
if (!this.isHovering) {
|
|
1962
|
+
this.navVisible = false;
|
|
1963
|
+
}
|
|
1964
|
+
this.closeNavTimeoutRef = null;
|
|
1965
|
+
}, 300);
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Terminate the session completely and clear storage
|
|
1969
|
+
* This is used when a user explicitly wants to end a session
|
|
1970
|
+
*/
|
|
1971
|
+
terminateSession() {
|
|
1972
|
+
this.clearSessionStorage();
|
|
1973
|
+
this.sessionToken = null;
|
|
1974
|
+
this.roomToken = null;
|
|
1975
|
+
this.roomUrl = null;
|
|
1976
|
+
if (this.activeSession) {
|
|
1977
|
+
this.activeSession.disconnect();
|
|
1978
|
+
this.activeSession = null;
|
|
1979
|
+
}
|
|
1980
|
+
this.state = SDKState.READY;
|
|
1981
|
+
}
|
|
1982
|
+
handleItemSelect(id, itemIsActive) {
|
|
1983
|
+
if (id === "experiences") {
|
|
1984
|
+
this.showCourseModal = true;
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
z$1([id, itemIsActive]).with(["pause", true], () => {
|
|
1988
|
+
this.activeSession?.pauseRecording();
|
|
1989
|
+
}).with(["pause", false], () => {
|
|
1990
|
+
this.activeSession?.resumeRecording();
|
|
1991
|
+
}).with(["activate", false], () => {
|
|
1992
|
+
this.terminateSession();
|
|
1993
|
+
}).otherwise(() => {
|
|
1994
|
+
return;
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
render() {
|
|
1998
|
+
this.updateFromConfig();
|
|
1999
|
+
if (!this.isActive)
|
|
2000
|
+
return E;
|
|
2001
|
+
const stateRender = z$1(this.state).with(SDKState.LOADING, () => x`<obi-dot-loader></obi-dot-loader>`).with(SDKState.RESEARCHING, () => x`<obi-searching-loader></obi-searching-loader>`).with(
|
|
2002
|
+
N$1.union(SDKState.USER_SPEAKING, SDKState.AGENT_SPEAKING),
|
|
2003
|
+
() => x`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`
|
|
2004
|
+
).with(SDKState.PAUSED, () => obiIcon).otherwise(() => obiIcon);
|
|
2005
|
+
return x`
|
|
2006
|
+
<div
|
|
2007
|
+
class="widget-container ${this.state === SDKState.USER_SPEAKING || this.state === SDKState.AGENT_SPEAKING ? "pulse" : ""} ${this.state !== SDKState.READY || this.navVisible ? "rounded" : ""} ${this.state === SDKState.RESEARCHING ? "researching" : ""} ${this.state === SDKState.USER_SPEAKING ? "user-speaking" : ""}"
|
|
2008
|
+
@mouseenter=${this.handleMouseEnter}
|
|
2009
|
+
@mouseleave=${this.handleMouseLeave}
|
|
2010
|
+
>
|
|
2011
|
+
${stateRender}
|
|
2012
|
+
${this.navVisible && this.state !== SDKState.RESEARCHING ? x`
|
|
2013
|
+
<obi-navigation-bar
|
|
2014
|
+
?isActive=${this.state !== SDKState.READY}
|
|
2015
|
+
.position=${this.position}
|
|
2016
|
+
data-direction="up"
|
|
2017
|
+
.currentState=${this.state}
|
|
2018
|
+
.onItemSelect=${this.handleItemSelect.bind(this)}
|
|
2019
|
+
></obi-navigation-bar>
|
|
2020
|
+
` : E}
|
|
2021
|
+
</div>
|
|
2022
|
+
${this.showCourseModal ? x`<obi-course-modal
|
|
2023
|
+
.onClose=${() => this.showCourseModal = false}
|
|
2024
|
+
.onCourseSelect=${this.handleSessionStart.bind(this)}
|
|
2025
|
+
.apiKey=${this.apiKey}
|
|
2026
|
+
></obi-course-modal>` : E}
|
|
2027
|
+
`;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
ObiWidget.styles = i$4`
|
|
2031
|
+
:host {
|
|
2032
|
+
display: block;
|
|
2033
|
+
position: fixed;
|
|
2034
|
+
z-index: 9999;
|
|
2035
|
+
font-family: Arial, sans-serif;
|
|
2036
|
+
--obi-primary: #7c3aed;
|
|
2037
|
+
--obi-danger: #ef4444;
|
|
2038
|
+
--obi-gray: #6b7280;
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
/* Position-specific styles */
|
|
2042
|
+
:host([position="bottom-right"]) {
|
|
2043
|
+
bottom: 80px;
|
|
2044
|
+
right: 80px;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
:host([position="bottom-left"]) {
|
|
2048
|
+
bottom: 80px;
|
|
2049
|
+
left: 20px;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
:host([position="bottom-center"]) {
|
|
2053
|
+
bottom: 80px;
|
|
2054
|
+
left: 50%;
|
|
2055
|
+
transform: translateX(-50%);
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
:host([position="top-right"]) {
|
|
2059
|
+
top: 20px;
|
|
2060
|
+
right: 80px;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
:host([position="top-left"]) {
|
|
2064
|
+
top: 20px;
|
|
2065
|
+
left: 20px;
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
:host([position="top-center"]) {
|
|
2069
|
+
top: 20px;
|
|
2070
|
+
left: 50%;
|
|
2071
|
+
transform: translateX(-50%);
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
:host([position="middle-left"]) {
|
|
2075
|
+
top: 50%;
|
|
2076
|
+
left: 20px;
|
|
2077
|
+
transform: translateY(-50%);
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
:host([position="middle-right"]) {
|
|
2081
|
+
top: 50%;
|
|
2082
|
+
right: 80px;
|
|
2083
|
+
transform: translateY(-50%);
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
/* Adjust position when in researching state to accommodate wider container */
|
|
2087
|
+
:host([position="bottom-right"]) .widget-container.researching {
|
|
2088
|
+
right: 20px;
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
:host([position="top-right"]) .widget-container.researching {
|
|
2092
|
+
right: 20px;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
:host([position="middle-right"]) .widget-container.researching {
|
|
2096
|
+
right: 20px;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
.widget-container {
|
|
2100
|
+
position: fixed;
|
|
2101
|
+
width: 56px;
|
|
2102
|
+
height: 56px;
|
|
2103
|
+
border-radius: 28px;
|
|
2104
|
+
border-color: transparent;
|
|
2105
|
+
background-color: var(--obi-primary);
|
|
2106
|
+
display: flex;
|
|
2107
|
+
align-items: center;
|
|
2108
|
+
justify-content: center;
|
|
2109
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
2110
|
+
transition: all 0.2s ease-out;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
.widget-container.user-speaking {
|
|
2114
|
+
background:
|
|
2115
|
+
linear-gradient(0deg, #c4b5fd, #c4b5fd),
|
|
2116
|
+
linear-gradient(195.84deg, rgba(192, 132, 252, 0) 11.05%, #c084fc 117.01%);
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
.widget-container:hover {
|
|
2120
|
+
border-radius: 12px;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
.widget-container.rounded {
|
|
2124
|
+
border-radius: 12px;
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
.widget-container.researching {
|
|
2128
|
+
width: 265px;
|
|
2129
|
+
border-radius: 12px;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
.widget-icon {
|
|
2133
|
+
width: 32px;
|
|
2134
|
+
height: 32px;
|
|
2135
|
+
transition: transform 0.5s ease-in-out;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
.widget-container.rounded .widget-icon {
|
|
2139
|
+
transform: rotate(110deg);
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
@keyframes pulse-shadow {
|
|
2143
|
+
0% {
|
|
2144
|
+
box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
|
|
2145
|
+
}
|
|
2146
|
+
70% {
|
|
2147
|
+
box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
|
|
2148
|
+
}
|
|
2149
|
+
100% {
|
|
2150
|
+
box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
.pulse {
|
|
2155
|
+
animation: pulse-shadow 2s ease-in-out infinite;
|
|
2156
|
+
}
|
|
2157
|
+
`;
|
|
2158
|
+
__decorateClass([
|
|
2159
|
+
r$1()
|
|
2160
|
+
], ObiWidget.prototype, "apiKey", 2);
|
|
2161
|
+
__decorateClass([
|
|
2162
|
+
r$1()
|
|
2163
|
+
], ObiWidget.prototype, "isActive", 2);
|
|
2164
|
+
__decorateClass([
|
|
2165
|
+
r$1()
|
|
2166
|
+
], ObiWidget.prototype, "position", 2);
|
|
2167
|
+
__decorateClass([
|
|
2168
|
+
r$1()
|
|
2169
|
+
], ObiWidget.prototype, "user", 2);
|
|
2170
|
+
__decorateClass([
|
|
2171
|
+
r$1()
|
|
2172
|
+
], ObiWidget.prototype, "state", 2);
|
|
2173
|
+
__decorateClass([
|
|
2174
|
+
r$1()
|
|
2175
|
+
], ObiWidget.prototype, "storedActiveState", 2);
|
|
2176
|
+
__decorateClass([
|
|
2177
|
+
r$1()
|
|
2178
|
+
], ObiWidget.prototype, "showCourseModal", 2);
|
|
2179
|
+
__decorateClass([
|
|
2180
|
+
r$1()
|
|
2181
|
+
], ObiWidget.prototype, "isHovering", 2);
|
|
2182
|
+
__decorateClass([
|
|
2183
|
+
r$1()
|
|
2184
|
+
], ObiWidget.prototype, "navVisible", 2);
|
|
2185
|
+
__decorateClass([
|
|
2186
|
+
r$1()
|
|
2187
|
+
], ObiWidget.prototype, "activeSession", 2);
|
|
2188
|
+
__decorateClass([
|
|
2189
|
+
r$1()
|
|
2190
|
+
], ObiWidget.prototype, "volume", 2);
|
|
2191
|
+
if (!customElements.get("obi-widget")) {
|
|
2192
|
+
customElements.define("obi-widget", ObiWidget);
|
|
2193
|
+
}
|
|
2194
|
+
const obiWidget = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2195
|
+
__proto__: null,
|
|
2196
|
+
ObiWidget
|
|
2197
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2198
|
+
export {
|
|
2199
|
+
AudioEqualizer as A,
|
|
2200
|
+
Course as C,
|
|
2201
|
+
DotLoader as D,
|
|
2202
|
+
NavIcon as N,
|
|
2203
|
+
ObiWidget as O,
|
|
2204
|
+
SearchingLoader as S,
|
|
2205
|
+
i$1 as a,
|
|
2206
|
+
NavigationBar as b,
|
|
2207
|
+
CourseList as c,
|
|
2208
|
+
CourseModal as d,
|
|
2209
|
+
navIcon as e,
|
|
2210
|
+
navigationBar as f,
|
|
2211
|
+
courses as g,
|
|
2212
|
+
courseModal as h,
|
|
2213
|
+
i$4 as i,
|
|
2214
|
+
audioEqualizer as j,
|
|
2215
|
+
dotLoader as k,
|
|
2216
|
+
n$2 as n,
|
|
2217
|
+
obiWidget as o,
|
|
2218
|
+
searchingLoader as s,
|
|
2219
|
+
x
|
|
2220
|
+
};
|
|
2221
|
+
//# sourceMappingURL=obi-widget-0970cbbe.js.map
|