obi-sdk 0.1.2 → 0.1.4

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.
@@ -1,1974 +1,11 @@
1
- import { S as SDKState, z as z$1, N as N$1 } from "./chunks/index-634e0df5.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
- var __defProp$8 = Object.defineProperty;
566
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
567
- var __decorateClass$8 = (decorators, target, key, kind) => {
568
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
569
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
570
- if (decorator = decorators[i3])
571
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
572
- if (kind && result)
573
- __defProp$8(target, key, result);
574
- return result;
575
- };
576
- class NavIcon extends i$1 {
577
- constructor() {
578
- super(...arguments);
579
- this.id = "";
580
- this.isActive = false;
581
- this.isSpecial = false;
582
- }
583
- handleClick(e2) {
584
- e2.preventDefault();
585
- e2.stopPropagation();
586
- const event = new CustomEvent("click", {
587
- detail: {
588
- id: this.id,
589
- isActive: !this.isActive
590
- },
591
- bubbles: true,
592
- composed: true
593
- });
594
- this.dispatchEvent(event);
595
- if (this.onClick) {
596
- this.onClick(this.id, !this.isActive);
597
- }
598
- }
599
- render() {
600
- return x`
601
- <button
602
- id="obi-nav-${this.id}"
603
- class=${this.isSpecial ? "special" : ""}
604
- ?active=${this.isActive}
605
- @click=${this.handleClick}
606
- aria-label="${this.id} control"
607
- >
608
- <slot></slot>
609
- </button>
610
- `;
611
- }
612
- }
613
- NavIcon.styles = i$4`
614
- :host {
615
- display: block;
616
- }
617
-
618
- button {
619
- display: flex;
620
- height: 40px;
621
- width: 40px;
622
- align-items: center;
623
- justify-content: center;
624
- border-radius: 2px;
625
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
626
- transition: all 0.2s;
627
- cursor: pointer;
628
- margin: 4px 0;
629
- padding: 0;
630
- border: none;
631
- color: black;
632
- }
633
-
634
- button.special {
635
- color: #fff;
636
- background-color: #000;
637
- }
638
-
639
- button.special svg {
640
- stroke: #fff;
641
- }
642
-
643
- button.special.active {
644
- background-color: black;
645
- color: white;
646
- }
647
-
648
- button.special.active:hover {
649
- background-color: #27272a;
650
- }
651
-
652
- button:not(.special) {
653
- background-color: white;
654
- color: black;
655
- }
656
-
657
- button:not(.special):hover {
658
- background-color: #e5e5e5;
659
- }
660
-
661
- ::slotted(*) {
662
- width: 18px;
663
- height: 18px;
664
- }
665
- `;
666
- __decorateClass$8([
667
- n$2({ type: String })
668
- ], NavIcon.prototype, "id", 2);
669
- __decorateClass$8([
670
- n$2({ type: Boolean })
671
- ], NavIcon.prototype, "isActive", 2);
672
- __decorateClass$8([
673
- n$2({ type: Boolean })
674
- ], NavIcon.prototype, "isSpecial", 2);
675
- __decorateClass$8([
676
- n$2({ type: Function })
677
- ], NavIcon.prototype, "onClick", 2);
678
- if (!customElements.get("obi-nav-icon")) {
679
- customElements.define("obi-nav-icon", NavIcon);
680
- }
681
- const navIcon = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
682
- __proto__: null,
683
- NavIcon
684
- }, Symbol.toStringTag, { value: "Module" }));
685
- const svgWrapper = (content) => x`
686
- <svg
687
- xmlns="http://www.w3.org/2000/svg"
688
- width="24"
689
- height="24"
690
- viewBox="0 0 24 24"
691
- fill="none"
692
- stroke="currentColor"
693
- stroke-width="2"
694
- stroke-linecap="round"
695
- stroke-linejoin="round"
696
- class="lucide"
697
- style="display: block;"
698
- >
699
- ${content}
700
- </svg>
701
- `;
702
- const pauseIcon = svgWrapper(b`
703
- <rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/>
704
- `);
705
- const playIcon = svgWrapper(b`<polygon points="6 3 20 12 6 21 6 3"/>`);
706
- const powerIcon = svgWrapper(b`
707
- <path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.77.04"/>
708
- `);
709
- const closeIcon = svgWrapper(b`
710
- <path d="M18 6 6 18"/><path d="m6 6 12 12"/>
711
- `);
712
- const bookOpenIcon = svgWrapper(b`
713
- <path d="M12 7v14" />
714
- <path
715
- 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"
716
- />
717
- `);
718
- const obiIcon = x`
719
- <img
720
- class="widget-icon"
721
- src="data:image/svg+xml;base64,${btoa(`<?xml version="1.0" encoding="UTF-8"?>
722
- <svg width="32" height="32" viewBox="0 0 32 34" fill="none" xmlns="http://www.w3.org/2000/svg">
723
- <g id="obi-icon">
724
- <g id="Subtract">
725
- <path d="M15.5845 9.29177L8.20527 5.00637L8.20527 13.4502L15.5845 17.7356L15.5845 9.29177Z" fill="white" />
726
- <path d="M15.5896 27.7146L8.21035 31.9994L8.21032 23.4698L15.5896 19.1843L15.5896 27.7146Z" fill="white" />
727
- <path d="M16.4104 27.7146L16.4104 19.1786L23.7897 23.4641L23.7897 32L16.4104 27.7146Z" fill="white" />
728
- <path d="M32 27.7142L24.6207 31.9996L24.6207 23.47L32 19.1846L32 27.7142Z" fill="white" />
729
- <path d="M24.2048 22.748L31.5911 18.4585L24.2845 14.2154L16.8983 18.5048L24.2048 22.748Z" fill="white" />
730
- <path d="M23.7948 5.01235L23.7948 13.4564L16.4156 17.7418L16.4156 9.29775L23.7948 5.01235Z" fill="white" />
731
- <path d="M16.0052 0L23.3865 4.2866L16.0003 8.57606L8.61897 4.28946L16.0052 0Z" fill="white" />
732
- <path d="M7.72042 14.2182L15.1017 18.5048L7.79445 22.7477L0.413699 18.4615L7.72042 14.2182Z" fill="white" />
733
- <path d="M7.37926 31.9997L7.37926 23.4638L0 19.1784L3.79636e-05 27.7143L7.37926 31.9997Z" fill="white" />
734
- </g>
735
- </g>
736
- </svg>`)}"
737
- alt="Obi Icon"
738
- />
739
- `;
740
- var __defProp$7 = Object.defineProperty;
741
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
742
- var __decorateClass$7 = (decorators, target, key, kind) => {
743
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
744
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
745
- if (decorator = decorators[i3])
746
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
747
- if (kind && result)
748
- __defProp$7(target, key, result);
749
- return result;
750
- };
751
- class NavigationBar extends i$1 {
752
- constructor() {
753
- super();
754
- this.isActive = false;
755
- this.isScreenActive = false;
756
- this.position = { top: 0, left: 0 };
757
- this.currentState = SDKState.READY;
758
- this.direction = "up";
759
- }
760
- connectedCallback() {
761
- super.connectedCallback();
762
- }
763
- handleIconClick(id, isActive) {
764
- if (this.onItemSelect) {
765
- this.onItemSelect(id, isActive);
766
- }
767
- }
768
- render() {
769
- return x`
770
- ${this.isActive ? x`
771
- <obi-nav-icon
772
- id="pause"
773
- ?isActive=${this.currentState === SDKState.PAUSED}
774
- @click=${() => this.handleIconClick("pause", this.currentState === SDKState.PAUSED ? false : true)}
775
- >
776
- ${this.currentState === SDKState.PAUSED ? playIcon : pauseIcon}
777
- </obi-nav-icon>
778
- <obi-nav-icon
779
- id="activate"
780
- ?isActive=${this.isActive}
781
- ?isSpecial=${true}
782
- @click=${() => this.handleIconClick("activate", this.isActive ? false : true)}
783
- >
784
- ${this.isActive ? closeIcon : powerIcon}
785
- </obi-nav-icon>
786
- ` : x`
787
- <obi-nav-icon
788
- id="experiences"
789
- @click=${() => this.handleIconClick("experiences", true)}
790
- >
791
- ${bookOpenIcon}
792
- </obi-nav-icon>
793
- `}
794
- `;
795
- }
796
- }
797
- NavigationBar.styles = i$4`
798
- :host {
799
- display: flex;
800
- position: absolute;
801
- z-index: 10000;
802
- width: 40px;
803
- transition: all 0.2s ease-in-out;
804
- opacity: 1;
805
- transform: scale(1);
806
- pointer-events: auto;
807
- background-color: #fff;
808
- }
809
-
810
- :host([data-direction="up"]) {
811
- bottom: 64px;
812
- top: auto;
813
- flex-direction: column-reverse;
814
- }
815
-
816
- :host([data-direction="down"]) {
817
- top: 64px;
818
- bottom: auto;
819
- flex-direction: column;
820
- }
821
- `;
822
- __decorateClass$7([
823
- n$2({ type: Boolean })
824
- ], NavigationBar.prototype, "isActive", 2);
825
- __decorateClass$7([
826
- n$2({ type: Boolean })
827
- ], NavigationBar.prototype, "isScreenActive", 2);
828
- __decorateClass$7([
829
- n$2({ type: Object })
830
- ], NavigationBar.prototype, "position", 2);
831
- __decorateClass$7([
832
- n$2({ type: String })
833
- ], NavigationBar.prototype, "currentState", 2);
834
- __decorateClass$7([
835
- n$2({ type: String })
836
- ], NavigationBar.prototype, "direction", 2);
837
- __decorateClass$7([
838
- n$2({ type: Function })
839
- ], NavigationBar.prototype, "onItemSelect", 2);
840
- if (!customElements.get("obi-navigation-bar")) {
841
- customElements.define("obi-navigation-bar", NavigationBar);
842
- }
843
- const navigationBar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
844
- __proto__: null,
845
- NavigationBar
846
- }, Symbol.toStringTag, { value: "Module" }));
847
- var __defProp$6 = Object.defineProperty;
848
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
849
- var __decorateClass$6 = (decorators, target, key, kind) => {
850
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
851
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
852
- if (decorator = decorators[i3])
853
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
854
- if (kind && result)
855
- __defProp$6(target, key, result);
856
- return result;
857
- };
858
- class Course extends i$1 {
859
- constructor() {
860
- super(...arguments);
861
- this.id = "";
862
- this.name = "";
863
- this.description = "";
864
- this.imageSrc = "";
865
- }
866
- handleClick() {
867
- if (this.onSelect) {
868
- this.onSelect(this.id);
869
- }
870
- this.dispatchEvent(
871
- new CustomEvent("course-select", {
872
- detail: { id: this.id },
873
- bubbles: true,
874
- composed: true
875
- })
876
- );
877
- }
878
- render() {
879
- return x`
880
- <div class="course-container" @click=${this.handleClick}>
881
- <img src=${this.imageSrc} alt="Course Preview" class="course-image" />
882
- <h2 class="course-title">${this.name}</h2>
883
- ${this.description ? x`<p class="course-description">${this.description}</p>` : ""}
884
- </div>
885
- `;
886
- }
887
- }
888
- Course.styles = i$4`
889
- :host {
890
- display: block;
891
- }
892
-
893
- .course-container {
894
- padding: 16px 12px;
895
- gap: 12px;
896
- border-radius: 4px;
897
- border: 1px solid #e5e7eb;
898
- cursor: pointer;
899
- transition: all 0.2s;
900
- }
901
-
902
- .course-container:hover {
903
- background-color: #f9fafb;
904
- border-color: #d1d5db;
905
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
906
- }
907
-
908
- .course-container:active {
909
- transform: scale(0.98);
910
- }
911
-
912
- .course-image {
913
- max-height: 160px;
914
- border-radius: 2px;
915
- border: 1px solid #e5e7eb;
916
- object-fit: cover;
917
- width: 100%;
918
- margin-bottom: 12px;
919
- }
920
-
921
- .course-title {
922
- font-size: 14px;
923
- font-weight: bold;
924
- margin: 0;
925
- margin-bottom: 12px;
926
- }
927
-
928
- .course-description {
929
- font-size: 14px;
930
- color: #71717a;
931
- margin: 0;
932
- }
933
- `;
934
- __decorateClass$6([
935
- n$2({ type: String })
936
- ], Course.prototype, "id", 2);
937
- __decorateClass$6([
938
- n$2({ type: String })
939
- ], Course.prototype, "name", 2);
940
- __decorateClass$6([
941
- n$2({ type: String })
942
- ], Course.prototype, "description", 2);
943
- __decorateClass$6([
944
- n$2({ type: String })
945
- ], Course.prototype, "imageSrc", 2);
946
- __decorateClass$6([
947
- n$2({ type: Function })
948
- ], Course.prototype, "onSelect", 2);
949
- class CourseList extends i$1 {
950
- constructor() {
951
- super(...arguments);
952
- this.courses = [];
953
- this.loading = false;
954
- this.error = "";
955
- }
956
- handleCourseSelect(e2) {
957
- if (this.onCourseSelect) {
958
- this.onCourseSelect(e2.detail.id);
959
- }
960
- }
961
- render() {
962
- if (this.loading) {
963
- return x`<div class="loading">Loading...</div>`;
964
- }
965
- if (this.error) {
966
- return x`<div class="error">${this.error}</div>`;
967
- }
968
- if (!this.courses || this.courses.length === 0) {
969
- return x`<div class="empty">No courses available</div>`;
970
- }
971
- const gridClass = this.courses.length === 1 ? "grid-cols-1" : this.courses.length === 2 ? "grid-cols-2" : "grid-cols-3";
972
- return x`
973
- <div class="course-grid ${gridClass}">
974
- ${this.courses.map(
975
- (course) => x`
976
- <obi-course
977
- id=${course.id}
978
- name=${course.name}
979
- description=${course.description || ""}
980
- imageSrc=${course.imageSrc}
981
- @course-select=${this.handleCourseSelect}
982
- ></obi-course>
983
- `
984
- )}
985
- </div>
986
- `;
987
- }
988
- }
989
- CourseList.styles = i$4`
990
- :host {
991
- display: block;
992
- }
993
-
994
- .course-grid {
995
- display: grid;
996
- gap: 12px;
997
- margin-top: 24px;
998
- }
999
-
1000
- .course-grid.grid-cols-1 {
1001
- grid-template-columns: 1fr;
1002
- }
1003
-
1004
- .course-grid.grid-cols-2 {
1005
- grid-template-columns: 1fr 1fr;
1006
- }
1007
-
1008
- .course-grid.grid-cols-3 {
1009
- grid-template-columns: 1fr 1fr 1fr;
1010
- }
1011
-
1012
- .loading,
1013
- .error,
1014
- .empty {
1015
- display: flex;
1016
- justify-content: center;
1017
- align-items: center;
1018
- margin-top: 16px;
1019
- }
1020
-
1021
- .error {
1022
- color: #ef4444;
1023
- }
1024
- `;
1025
- __decorateClass$6([
1026
- n$2({ type: Array })
1027
- ], CourseList.prototype, "courses", 2);
1028
- __decorateClass$6([
1029
- n$2({ type: Boolean })
1030
- ], CourseList.prototype, "loading", 2);
1031
- __decorateClass$6([
1032
- n$2({ type: String })
1033
- ], CourseList.prototype, "error", 2);
1034
- __decorateClass$6([
1035
- n$2({ type: Function })
1036
- ], CourseList.prototype, "onCourseSelect", 2);
1037
- if (!customElements.get("obi-course")) {
1038
- customElements.define("obi-course", Course);
1039
- }
1040
- if (!customElements.get("obi-course-list")) {
1041
- customElements.define("obi-course-list", CourseList);
1042
- }
1043
- const courses = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1044
- __proto__: null,
1045
- Course,
1046
- CourseList
1047
- }, Symbol.toStringTag, { value: "Module" }));
1048
- var __defProp$5 = Object.defineProperty;
1049
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1050
- var __decorateClass$5 = (decorators, target, key, kind) => {
1051
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
1052
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1053
- if (decorator = decorators[i3])
1054
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1055
- if (kind && result)
1056
- __defProp$5(target, key, result);
1057
- return result;
1058
- };
1059
- class CourseModal extends i$1 {
1060
- constructor() {
1061
- super(...arguments);
1062
- this.courses = [];
1063
- this.loading = true;
1064
- this.error = "";
1065
- this.apiBaseUrl = "";
1066
- this.apiKey = "";
1067
- }
1068
- handleCourseSelect(e2) {
1069
- if (this.onCourseSelect) {
1070
- this.onCourseSelect(e2.detail.id);
1071
- }
1072
- }
1073
- handleClose() {
1074
- if (this.onClose) {
1075
- this.onClose();
1076
- }
1077
- }
1078
- async fetchCourses() {
1079
- try {
1080
- this.loading = true;
1081
- const raw_response = await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`);
1082
- const response = await raw_response.json();
1083
- const mappedCourses = response.map((session) => ({
1084
- id: session.uuid,
1085
- name: session.onboarding_plan.name,
1086
- description: session.onboarding_plan.description,
1087
- imageSrc: session.onboarding_plan.screen_url || "https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"
1088
- }));
1089
- const filteredCourses = mappedCourses.filter((course) => !!course.name);
1090
- this.courses = [...filteredCourses];
1091
- this.requestUpdate();
1092
- } catch (err) {
1093
- console.error("Fetch error:", err);
1094
- this.error = "Failed to fetch courses";
1095
- } finally {
1096
- this.loading = false;
1097
- this.requestUpdate();
1098
- }
1099
- }
1100
- connectedCallback() {
1101
- super.connectedCallback();
1102
- if (window.obiWidgetConfig?.apiKey) {
1103
- this.apiKey = window.obiWidgetConfig.apiKey;
1104
- }
1105
- if (window.obiWidgetConfig?.apiBaseUrl) {
1106
- this.apiBaseUrl = window.obiWidgetConfig.apiBaseUrl;
1107
- }
1108
- if (this.apiBaseUrl && this.apiKey) {
1109
- this.fetchCourses();
1110
- } else {
1111
- this.loading = false;
1112
- this.error = "API base URL or API key is missing";
1113
- }
1114
- }
1115
- render() {
1116
- return x`
1117
- <div class="backdrop" @click=${this.handleClose}></div>
1118
- <div class="container">
1119
- <button class="close-button" @click=${this.handleClose}>×</button>
1120
- <div class="header">
1121
- <h1>Give Obi a try!</h1>
1122
- <p class="subtitle">Pick a tour, share your screen, and Obi will take it from there.</p>
1123
- </div>
1124
-
1125
- <obi-course-list
1126
- .courses=${this.courses}
1127
- .loading=${this.loading}
1128
- .error=${this.error}
1129
- @course-select=${this.handleCourseSelect}
1130
- ></obi-course-list>
1131
- </div>
1132
- `;
1133
- }
1134
- }
1135
- CourseModal.styles = i$4`
1136
- :host {
1137
- display: block;
1138
- font-family: "Syne", sans-serif;
1139
- }
1140
-
1141
- .backdrop {
1142
- position: fixed;
1143
- top: 0;
1144
- right: 0;
1145
- bottom: 0;
1146
- left: 0;
1147
- background-color: black;
1148
- opacity: 0.7;
1149
- z-index: 40;
1150
- }
1151
-
1152
- .container {
1153
- position: fixed;
1154
- background-color: white;
1155
- color: black;
1156
- border: 1px solid #e5e7eb;
1157
- width: 640px;
1158
- max-height: 80vh;
1159
- overflow-y: auto;
1160
- padding: 48px;
1161
- gap: 12px;
1162
- top: 50%;
1163
- left: 50%;
1164
- transform: translate(-50%, -50%);
1165
- border-radius: 4px;
1166
- z-index: 50;
1167
- display: flex;
1168
- flex-direction: column;
1169
- text-align: center;
1170
- }
1171
-
1172
- .container:hover {
1173
- cursor: auto;
1174
- }
1175
-
1176
- .container::-webkit-scrollbar {
1177
- width: 0.5rem;
1178
- }
1179
-
1180
- .container::-webkit-scrollbar-track {
1181
- background-color: #f3f4f6;
1182
- border-radius: 9999px;
1183
- }
1184
-
1185
- .container::-webkit-scrollbar-thumb {
1186
- background-color: #d1d5db;
1187
- border-radius: 9999px;
1188
- }
1189
-
1190
- .header {
1191
- margin-bottom: 24px;
1192
- text-align: center;
1193
- }
1194
-
1195
- h1 {
1196
- font-size: 32px;
1197
- font-weight: 700;
1198
- margin: 0;
1199
- margin-bottom: 8px;
1200
- }
1201
-
1202
- .subtitle {
1203
- font-size: 20px;
1204
- color: rgb(113 113 122 / 1);
1205
- margin: 0;
1206
- }
1207
-
1208
- .close-button {
1209
- position: absolute;
1210
- top: 16px;
1211
- right: 16px;
1212
- background: none;
1213
- border: none;
1214
- cursor: pointer;
1215
- font-size: 24px;
1216
- color: #6b7280;
1217
- }
1218
- `;
1219
- __decorateClass$5([
1220
- n$2({ type: Array })
1221
- ], CourseModal.prototype, "courses", 2);
1222
- __decorateClass$5([
1223
- n$2({ type: Boolean })
1224
- ], CourseModal.prototype, "loading", 2);
1225
- __decorateClass$5([
1226
- n$2({ type: String })
1227
- ], CourseModal.prototype, "error", 2);
1228
- __decorateClass$5([
1229
- n$2({ type: String })
1230
- ], CourseModal.prototype, "apiBaseUrl", 2);
1231
- __decorateClass$5([
1232
- n$2({ type: String })
1233
- ], CourseModal.prototype, "apiKey", 2);
1234
- __decorateClass$5([
1235
- n$2({ type: Function })
1236
- ], CourseModal.prototype, "onCourseSelect", 2);
1237
- __decorateClass$5([
1238
- n$2({ type: Function })
1239
- ], CourseModal.prototype, "onClose", 2);
1240
- if (!customElements.get("obi-course-modal")) {
1241
- customElements.define("obi-course-modal", CourseModal);
1242
- }
1243
- const courseModal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1244
- __proto__: null,
1245
- CourseModal
1246
- }, Symbol.toStringTag, { value: "Module" }));
1247
- const f$1 = (o2) => void 0 === o2.strings;
1248
- const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e$1 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
1249
- class i2 {
1250
- constructor(t2) {
1251
- }
1252
- get _$AU() {
1253
- return this._$AM._$AU;
1254
- }
1255
- _$AT(t2, e2, i3) {
1256
- this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
1257
- }
1258
- _$AS(t2, e2) {
1259
- return this.update(t2, e2);
1260
- }
1261
- update(t2, e2) {
1262
- return this.render(...e2);
1263
- }
1264
- }
1265
- const s = (i3, t2) => {
1266
- const e2 = i3._$AN;
1267
- if (void 0 === e2)
1268
- return false;
1269
- for (const i4 of e2)
1270
- i4._$AO?.(t2, false), s(i4, t2);
1271
- return true;
1272
- }, o$1 = (i3) => {
1273
- let t2, e2;
1274
- do {
1275
- if (void 0 === (t2 = i3._$AM))
1276
- break;
1277
- e2 = t2._$AN, e2.delete(i3), i3 = t2;
1278
- } while (0 === e2?.size);
1279
- }, r = (i3) => {
1280
- for (let t2; t2 = i3._$AM; i3 = t2) {
1281
- let e2 = t2._$AN;
1282
- if (void 0 === e2)
1283
- t2._$AN = e2 = /* @__PURE__ */ new Set();
1284
- else if (e2.has(i3))
1285
- break;
1286
- e2.add(i3), c(t2);
1287
- }
1288
- };
1289
- function h$1(i3) {
1290
- void 0 !== this._$AN ? (o$1(this), this._$AM = i3, r(this)) : this._$AM = i3;
1291
- }
1292
- function n$1(i3, t2 = false, e2 = 0) {
1293
- const r2 = this._$AH, h2 = this._$AN;
1294
- if (void 0 !== h2 && 0 !== h2.size)
1295
- if (t2)
1296
- if (Array.isArray(r2))
1297
- for (let i4 = e2; i4 < r2.length; i4++)
1298
- s(r2[i4], false), o$1(r2[i4]);
1299
- else
1300
- null != r2 && (s(r2, false), o$1(r2));
1301
- else
1302
- s(this, i3);
1303
- }
1304
- const c = (i3) => {
1305
- i3.type == t.CHILD && (i3._$AP ?? (i3._$AP = n$1), i3._$AQ ?? (i3._$AQ = h$1));
1306
- };
1307
- class f extends i2 {
1308
- constructor() {
1309
- super(...arguments), this._$AN = void 0;
1310
- }
1311
- _$AT(i3, t2, e2) {
1312
- super._$AT(i3, t2, e2), r(this), this.isConnected = i3._$AU;
1313
- }
1314
- _$AO(i3, t2 = true) {
1315
- i3 !== this.isConnected && (this.isConnected = i3, i3 ? this.reconnected?.() : this.disconnected?.()), t2 && (s(this, i3), o$1(this));
1316
- }
1317
- setValue(t2) {
1318
- if (f$1(this._$Ct))
1319
- this._$Ct._$AI(t2, this);
1320
- else {
1321
- const i3 = [...this._$Ct._$AH];
1322
- i3[this._$Ci] = t2, this._$Ct._$AI(i3, this, 0);
1323
- }
1324
- }
1325
- disconnected() {
1326
- }
1327
- reconnected() {
1328
- }
1329
- }
1330
- const e = () => new h();
1331
- class h {
1332
- }
1333
- const o = /* @__PURE__ */ new WeakMap(), n2 = e$1(class extends f {
1334
- render(i3) {
1335
- return E;
1336
- }
1337
- update(i3, [s2]) {
1338
- const e2 = s2 !== this.G;
1339
- 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;
1340
- }
1341
- rt(t2) {
1342
- if (this.isConnected || (t2 = void 0), "function" == typeof this.G) {
1343
- const i3 = this.ht ?? globalThis;
1344
- let s2 = o.get(i3);
1345
- 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);
1346
- } else
1347
- this.G.value = t2;
1348
- }
1349
- get lt() {
1350
- return "function" == typeof this.G ? o.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
1351
- }
1352
- disconnected() {
1353
- this.lt === this.ct && this.rt(void 0);
1354
- }
1355
- reconnected() {
1356
- this.rt(this.ct);
1357
- }
1358
- });
1359
- var __defProp$4 = Object.defineProperty;
1360
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1361
- var __decorateClass$4 = (decorators, target, key, kind) => {
1362
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
1363
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1364
- if (decorator = decorators[i3])
1365
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1366
- if (kind && result)
1367
- __defProp$4(target, key, result);
1368
- return result;
1369
- };
1370
- class AudioEqualizer extends i$1 {
1371
- constructor() {
1372
- super(...arguments);
1373
- this.volume = { speaker: "ASSISTANT", volume: 0, spectrum: [] };
1374
- this.canvasRef = e();
1375
- this.barCount = 8;
1376
- this.animationFrame = null;
1377
- }
1378
- connectedCallback() {
1379
- super.connectedCallback();
1380
- this.startAnimation();
1381
- }
1382
- disconnectedCallback() {
1383
- super.disconnectedCallback();
1384
- this.stopAnimation();
1385
- }
1386
- startAnimation() {
1387
- const animate = () => {
1388
- this.drawEqualizer();
1389
- this.animationFrame = requestAnimationFrame(animate);
1390
- };
1391
- this.animationFrame = requestAnimationFrame(animate);
1392
- }
1393
- stopAnimation() {
1394
- if (this.animationFrame) {
1395
- cancelAnimationFrame(this.animationFrame);
1396
- this.animationFrame = null;
1397
- }
1398
- }
1399
- drawEqualizer() {
1400
- const canvas = this.canvasRef.value;
1401
- if (!canvas)
1402
- return;
1403
- const ctx = canvas.getContext("2d");
1404
- if (!ctx)
1405
- return;
1406
- const dpr = window.devicePixelRatio || 1;
1407
- const displayWidth = canvas.clientWidth;
1408
- const displayHeight = canvas.clientHeight;
1409
- canvas.width = displayWidth * dpr;
1410
- canvas.height = displayHeight * dpr;
1411
- ctx.scale(dpr, dpr);
1412
- ctx.clearRect(0, 0, displayWidth, displayHeight);
1413
- const gap = 3;
1414
- const barWidth = Math.max(1, (displayWidth - (this.barCount - 1) * gap) / this.barCount);
1415
- const barMaxHeight = displayHeight / 2;
1416
- const currentVolume = this.volume.speaker === "USER" ? this.volume.volume : this.volume.volume;
1417
- const currentSpectrum = this.volume.speaker === "USER" ? this.volume.spectrum : this.volume.spectrum;
1418
- if (currentVolume === 0)
1419
- return;
1420
- let processedSpectrum = [];
1421
- if (currentSpectrum && currentSpectrum.length > 0) {
1422
- const spectrumLength = currentSpectrum.length;
1423
- const regionSize = Math.ceil(spectrumLength / 10);
1424
- let energyByRegion = [];
1425
- for (let i3 = 0; i3 < 10; i3++) {
1426
- const start = i3 * regionSize;
1427
- const end = Math.min((i3 + 1) * regionSize, spectrumLength);
1428
- let regionEnergy = 0;
1429
- for (let j2 = start; j2 < end; j2++) {
1430
- regionEnergy += currentSpectrum[j2] || 0;
1431
- }
1432
- energyByRegion.push({ region: i3, startIdx: start, endIdx: end, energy: regionEnergy });
1433
- }
1434
- energyByRegion.sort((a2, b2) => b2.energy - a2.energy);
1435
- const topRegions = energyByRegion.slice(0, 3);
1436
- const startIdx = Math.min(...topRegions.map((r2) => r2.startIdx));
1437
- const endIdx = Math.max(...topRegions.map((r2) => r2.endIdx));
1438
- if (endIdx > startIdx) {
1439
- for (let i3 = 0; i3 < this.barCount; i3++) {
1440
- const position = startIdx + i3 / (this.barCount - 1) * (endIdx - startIdx);
1441
- const index = Math.min(spectrumLength - 1, Math.floor(position));
1442
- processedSpectrum[i3] = currentSpectrum[index] || 0;
1443
- }
1444
- } else {
1445
- for (let i3 = 0; i3 < this.barCount; i3++) {
1446
- const position = i3 / (this.barCount - 1) * (spectrumLength / 2);
1447
- const index = Math.min(spectrumLength - 1, Math.floor(position));
1448
- processedSpectrum[i3] = currentSpectrum[index] || 0;
1449
- }
1450
- }
1451
- const maxSpectrumValue = Math.max(...processedSpectrum, 1);
1452
- const amplificationFactorRoot = this.volume.speaker === "USER" ? 0.7 : 0.6;
1453
- processedSpectrum = processedSpectrum.map((value, index) => {
1454
- const relativeValue = value / maxSpectrumValue;
1455
- const amplificationFactor = amplificationFactorRoot + index / (this.barCount - 1) * 0.3;
1456
- return Math.min(1, relativeValue * amplificationFactor);
1457
- });
1458
- } else {
1459
- if (this.volume.speaker !== "USER") {
1460
- for (let i3 = 0; i3 < this.barCount; i3++) {
1461
- const time = Date.now() * 2e-3;
1462
- const value = 0.3 + 0.2 * Math.sin(time + i3 * 0.7);
1463
- processedSpectrum[i3] = value;
1464
- }
1465
- }
1466
- }
1467
- for (let i3 = 0; i3 < this.barCount; i3++) {
1468
- const spectrumValue = processedSpectrum.length > 0 ? processedSpectrum[i3] !== void 0 ? processedSpectrum[i3] : currentVolume : currentVolume;
1469
- if (this.volume.speaker === "USER") {
1470
- ctx.fillStyle = `rgba(109, 40, 217, ${spectrumValue * 0.5 + 0.5})`;
1471
- } else {
1472
- ctx.fillStyle = `rgba(255, 255, 255, ${spectrumValue * 0.5 + 0.5})`;
1473
- }
1474
- const barHeight = Math.max(2, spectrumValue * 0.8 * barMaxHeight);
1475
- const x2 = displayWidth - (this.barCount - i3) * (barWidth + gap);
1476
- const radius = barWidth / 2;
1477
- ctx.beginPath();
1478
- ctx.moveTo(x2 + radius, displayHeight / 2 - barHeight);
1479
- ctx.lineTo(x2 + barWidth - radius, displayHeight / 2 - barHeight);
1480
- ctx.quadraticCurveTo(
1481
- x2 + barWidth,
1482
- displayHeight / 2 - barHeight,
1483
- x2 + barWidth,
1484
- displayHeight / 2 - barHeight + radius
1485
- );
1486
- ctx.lineTo(x2 + barWidth, displayHeight / 2);
1487
- ctx.lineTo(x2, displayHeight / 2);
1488
- ctx.lineTo(x2, displayHeight / 2 - barHeight + radius);
1489
- ctx.quadraticCurveTo(
1490
- x2,
1491
- displayHeight / 2 - barHeight,
1492
- x2 + radius,
1493
- displayHeight / 2 - barHeight
1494
- );
1495
- ctx.fill();
1496
- ctx.beginPath();
1497
- ctx.moveTo(x2, displayHeight / 2);
1498
- ctx.lineTo(x2 + barWidth, displayHeight / 2);
1499
- ctx.lineTo(x2 + barWidth, displayHeight / 2 + barHeight - radius);
1500
- ctx.quadraticCurveTo(
1501
- x2 + barWidth,
1502
- displayHeight / 2 + barHeight,
1503
- x2 + barWidth - radius,
1504
- displayHeight / 2 + barHeight
1505
- );
1506
- ctx.lineTo(x2 + radius, displayHeight / 2 + barHeight);
1507
- ctx.quadraticCurveTo(
1508
- x2,
1509
- displayHeight / 2 + barHeight,
1510
- x2,
1511
- displayHeight / 2 + barHeight - radius
1512
- );
1513
- ctx.lineTo(x2, displayHeight / 2);
1514
- ctx.fill();
1515
- }
1516
- }
1517
- render() {
1518
- return x` <canvas ${n2(this.canvasRef)} width="52" height="52"></canvas> `;
1519
- }
1520
- }
1521
- AudioEqualizer.styles = i$4`
1522
- :host {
1523
- display: block;
1524
- width: 40px;
1525
- height: 40px;
1526
- margin: 4px;
1527
- }
1528
-
1529
- canvas {
1530
- width: 100%;
1531
- height: 100%;
1532
- }
1533
- `;
1534
- __decorateClass$4([
1535
- n$2({ type: Object })
1536
- ], AudioEqualizer.prototype, "volume", 2);
1537
- __decorateClass$4([
1538
- r$1()
1539
- ], AudioEqualizer.prototype, "canvasRef", 2);
1540
- if (!customElements.get("obi-audio-equalizer")) {
1541
- customElements.define("obi-audio-equalizer", AudioEqualizer);
1542
- }
1543
- const audioEqualizer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1544
- __proto__: null,
1545
- AudioEqualizer
1546
- }, Symbol.toStringTag, { value: "Module" }));
1547
- var __defProp$3 = Object.defineProperty;
1548
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
1549
- var __decorateClass$3 = (decorators, target, key, kind) => {
1550
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
1551
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1552
- if (decorator = decorators[i3])
1553
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1554
- if (kind && result)
1555
- __defProp$3(target, key, result);
1556
- return result;
1557
- };
1558
- class DotLoader extends i$1 {
1559
- constructor() {
1560
- super(...arguments);
1561
- this.activeDots = Array(5).fill(false);
1562
- this.numDots = 5;
1563
- this.containerWidth = 32;
1564
- this.dotSize = 2;
1565
- this.bounceHeight = 12;
1566
- this.animationDuration = 200;
1567
- this.pauseDuration = 300;
1568
- this.overlapFactor = 0.7;
1569
- this.color = "#FFF";
1570
- this.timeoutIds = [];
1571
- }
1572
- connectedCallback() {
1573
- super.connectedCallback();
1574
- this.startAnimation();
1575
- this.style.setProperty("--dot-loader-width", `${this.containerWidth}px`);
1576
- this.style.setProperty("--dot-size", `${this.dotSize}px`);
1577
- this.style.setProperty("--dot-color", this.color);
1578
- }
1579
- disconnectedCallback() {
1580
- super.disconnectedCallback();
1581
- this.stopAnimation();
1582
- }
1583
- startAnimation() {
1584
- this.animateSequence();
1585
- }
1586
- stopAnimation() {
1587
- this.timeoutIds.forEach((id) => window.clearTimeout(id));
1588
- this.timeoutIds = [];
1589
- }
1590
- animateSequence() {
1591
- this.activeDots = Array(this.numDots).fill(false);
1592
- for (let i3 = 0; i3 < this.numDots; i3++) {
1593
- const delay = i3 * (this.animationDuration * this.overlapFactor);
1594
- const bounceStartId = window.setTimeout(() => {
1595
- this.activeDots = [...this.activeDots];
1596
- this.activeDots[i3] = true;
1597
- const bounceEndId = window.setTimeout(() => {
1598
- this.activeDots = [...this.activeDots];
1599
- this.activeDots[i3] = false;
1600
- }, this.animationDuration);
1601
- this.timeoutIds.push(bounceEndId);
1602
- }, delay);
1603
- this.timeoutIds.push(bounceStartId);
1604
- }
1605
- const nextSequenceId = window.setTimeout(
1606
- () => {
1607
- this.animateSequence();
1608
- },
1609
- this.numDots * this.animationDuration * this.overlapFactor + this.pauseDuration
1610
- );
1611
- this.timeoutIds.push(nextSequenceId);
1612
- }
1613
- render() {
1614
- return x`
1615
- <div class="dot-loader">
1616
- ${this.activeDots.map(
1617
- (isActive) => x`
1618
- <div
1619
- class="dot"
1620
- style="transform: ${isActive ? `translateY(-${this.bounceHeight}px)` : "translateY(0)"}"
1621
- ></div>
1622
- `
1623
- )}
1624
- </div>
1625
- `;
1626
- }
1627
- }
1628
- DotLoader.styles = i$4`
1629
- :host {
1630
- display: block;
1631
- }
1632
-
1633
- .dot-loader {
1634
- display: flex;
1635
- flex-direction: row;
1636
- width: var(--dot-loader-width, 32px);
1637
- height: 14px;
1638
- justify-content: center;
1639
- align-items: center;
1640
- padding: 0;
1641
- margin: 0;
1642
- gap: 4px;
1643
- }
1644
-
1645
- .dot {
1646
- width: var(--dot-size, 2px);
1647
- height: var(--dot-size, 2px);
1648
- border-radius: 50%;
1649
- background-color: var(--dot-color, #fff);
1650
- margin: 0;
1651
- padding: 0;
1652
- transition: transform 0.2s ease-in-out;
1653
- opacity: 1;
1654
- }
1655
- `;
1656
- __decorateClass$3([
1657
- r$1()
1658
- ], DotLoader.prototype, "activeDots", 2);
1659
- if (!customElements.get("obi-dot-loader")) {
1660
- customElements.define("obi-dot-loader", DotLoader);
1661
- }
1662
- const dotLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1663
- __proto__: null,
1664
- DotLoader
1665
- }, Symbol.toStringTag, { value: "Module" }));
1666
- class SearchingLoader extends i$1 {
1667
- render() {
1668
- return x`
1669
- <obi-dot-loader loading style="margin-left: 2px"></obi-dot-loader>
1670
- <span class="text">Searching the knowledge base</span>
1671
- `;
1672
- }
1673
- }
1674
- SearchingLoader.styles = i$4`
1675
- :host {
1676
- display: flex;
1677
- align-items: center;
1678
- gap: 12px;
1679
- background-color: #7c3aed;
1680
- border-radius: 12px;
1681
- padding: 8px 12px;
1682
- }
1683
-
1684
- .text {
1685
- color: white;
1686
- font-weight: 500;
1687
- font-size: 14px;
1688
- }
1689
- `;
1690
- if (!customElements.get("obi-searching-loader")) {
1691
- customElements.define("obi-searching-loader", SearchingLoader);
1692
- }
1693
- const searchingLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1694
- __proto__: null,
1695
- SearchingLoader
1696
- }, Symbol.toStringTag, { value: "Module" }));
1697
- var __defProp$2 = Object.defineProperty;
1698
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
1699
- var __decorateClass$2 = (decorators, target, key, kind) => {
1700
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
1701
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1702
- if (decorator = decorators[i3])
1703
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1704
- if (kind && result)
1705
- __defProp$2(target, key, result);
1706
- return result;
1707
- };
1708
- const API_BASE_URL = "https://iamobi.ai/api";
1709
- class ObiWidget extends i$1 {
1710
- constructor() {
1711
- super();
1712
- this.apiBaseUrl = API_BASE_URL;
1713
- this.apiKey = "";
1714
- this.position = "bottom-right";
1715
- this.state = SDKState.READY;
1716
- this.showCourseModal = false;
1717
- this.isHovering = false;
1718
- this.navVisible = false;
1719
- this.activeSession = null;
1720
- this.volume = {
1721
- speaker: "ASSISTANT",
1722
- volume: 0,
1723
- spectrum: []
1724
- };
1725
- this.screenPosition = this.calculateScreenPosition();
1726
- this.closeNavTimeoutRef = null;
1727
- this.handleResize = () => {
1728
- this.screenPosition = this.calculateScreenPosition();
1729
- };
1730
- if (window.obiWidgetConfig) {
1731
- if (window.obiWidgetConfig.apiKey) {
1732
- this.apiKey = window.obiWidgetConfig.apiKey;
1733
- }
1734
- if (window.obiWidgetConfig.apiBaseUrl) {
1735
- this.apiBaseUrl = window.obiWidgetConfig.apiBaseUrl;
1736
- }
1737
- if (window.obiWidgetConfig.position) {
1738
- this.position = window.obiWidgetConfig.position;
1739
- }
1740
- }
1741
- }
1742
- calculateScreenPosition() {
1743
- return z$1(this.position).with("top-right", () => ({ top: 20, left: window.innerWidth - 100 })).with("bottom-right", () => ({
1744
- top: window.innerHeight - 100,
1745
- left: window.innerWidth - 100
1746
- })).with("top-left", () => ({ top: 20, left: 20 })).with("bottom-left", () => ({ top: window.innerHeight - 100, left: 20 })).otherwise(() => ({ top: window.innerHeight - 100, left: window.innerWidth - 100 }));
1747
- }
1748
- connectedCallback() {
1749
- super.connectedCallback();
1750
- window.addEventListener("resize", this.handleResize);
1751
- if (!window.obiWidgetConfig) {
1752
- window.obiWidgetConfig = {};
1753
- }
1754
- window.obiWidgetConfig.apiBaseUrl = this.apiBaseUrl;
1755
- if (this.apiKey) {
1756
- window.obiWidgetConfig.apiKey = this.apiKey;
1757
- }
1758
- }
1759
- disconnectedCallback() {
1760
- super.disconnectedCallback();
1761
- window.removeEventListener("resize", this.handleResize);
1762
- if (this.closeNavTimeoutRef !== null) {
1763
- window.clearTimeout(this.closeNavTimeoutRef);
1764
- }
1765
- if (this.activeSession) {
1766
- this.activeSession.disconnect();
1767
- this.activeSession = null;
1768
- }
1769
- }
1770
- handleMouseEnter() {
1771
- this.isHovering = true;
1772
- this.navVisible = true;
1773
- }
1774
- handleMouseLeave() {
1775
- this.isHovering = false;
1776
- if (this.closeNavTimeoutRef !== null) {
1777
- window.clearTimeout(this.closeNavTimeoutRef);
1778
- }
1779
- this.closeNavTimeoutRef = window.setTimeout(() => {
1780
- if (!this.isHovering) {
1781
- this.navVisible = false;
1782
- }
1783
- this.closeNavTimeoutRef = null;
1784
- }, 300);
1785
- }
1786
- handleItemSelect(id, itemIsActive) {
1787
- if (id === "experiences") {
1788
- this.showCourseModal = true;
1789
- return;
1790
- }
1791
- z$1([id, itemIsActive]).with(["pause", true], () => {
1792
- this.activeSession?.pauseRecording();
1793
- }).with(["pause", false], () => {
1794
- this.activeSession?.resumeRecording();
1795
- }).with(["activate", false], () => {
1796
- this.activeSession?.disconnect();
1797
- }).otherwise(() => {
1798
- return;
1799
- });
1800
- }
1801
- async handleSessionStart(sessionToken) {
1802
- this.showCourseModal = false;
1803
- this.state = SDKState.LOADING;
1804
- try {
1805
- const { ObiSession } = await import("./chunks/session-e208b5bb.js").then((n3) => n3.s);
1806
- const session = new ObiSession({ token: sessionToken, apiBaseUrl: this.apiBaseUrl });
1807
- session.on("stateChanged", (data) => {
1808
- this.state = data.newState;
1809
- });
1810
- session.on("volume", (data) => {
1811
- this.volume = data;
1812
- });
1813
- session.on("error", (data) => {
1814
- console.error("Session error:", data.error);
1815
- this.state = SDKState.ERROR;
1816
- this.activeSession = null;
1817
- });
1818
- await session.connect();
1819
- this.activeSession = session;
1820
- } catch (error) {
1821
- console.error("Failed to connect to session:", error);
1822
- this.state = SDKState.ERROR;
1823
- }
1824
- }
1825
- render() {
1826
- const { top, left } = this.screenPosition;
1827
- const actualLeft = this.state === SDKState.RESEARCHING ? left - 265 + 56 : left;
1828
- 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(
1829
- N$1.union(SDKState.USER_SPEAKING, SDKState.AGENT_SPEAKING),
1830
- () => x`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`
1831
- ).with(SDKState.PAUSED, () => obiIcon).otherwise(() => obiIcon);
1832
- return x`
1833
- <div
1834
- 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" : ""}"
1835
- style="top: ${top}px; left: ${actualLeft}px;"
1836
- @mouseenter=${this.handleMouseEnter}
1837
- @mouseleave=${this.handleMouseLeave}
1838
- >
1839
- ${stateRender}
1840
- ${this.navVisible && this.state !== SDKState.RESEARCHING ? x`
1841
- <obi-navigation-bar
1842
- ?isActive=${this.state !== SDKState.READY}
1843
- .position=${{ top, left: actualLeft }}
1844
- data-direction="up"
1845
- .currentState=${this.state}
1846
- .onItemSelect=${this.handleItemSelect.bind(this)}
1847
- ></obi-navigation-bar>
1848
- ` : E}
1849
- </div>
1850
- ${this.showCourseModal ? x`<obi-course-modal
1851
- .onClose=${() => this.showCourseModal = false}
1852
- .onCourseSelect=${this.handleSessionStart.bind(this)}
1853
- .apiBaseUrl=${this.apiBaseUrl}
1854
- .apiKey=${this.apiKey}
1855
- ></obi-course-modal>` : E}
1856
- `;
1857
- }
1858
- }
1859
- ObiWidget.styles = i$4`
1860
- :host {
1861
- display: block;
1862
- position: fixed;
1863
- z-index: 9999;
1864
- font-family: Arial, sans-serif;
1865
- --obi-primary: #7c3aed;
1866
- --obi-danger: #ef4444;
1867
- --obi-gray: #6b7280;
1868
- }
1869
-
1870
- .widget-container {
1871
- position: fixed;
1872
- width: 56px;
1873
- height: 56px;
1874
- border-radius: 28px;
1875
- border-color: transparent;
1876
- background-color: var(--obi-primary);
1877
- display: flex;
1878
- align-items: center;
1879
- justify-content: center;
1880
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
1881
- transition: all 0.2s ease-out;
1882
- }
1883
-
1884
- .widget-container.user-speaking {
1885
- background:
1886
- linear-gradient(0deg, #c4b5fd, #c4b5fd),
1887
- linear-gradient(195.84deg, rgba(192, 132, 252, 0) 11.05%, #c084fc 117.01%);
1888
- }
1889
-
1890
- .widget-container:hover {
1891
- border-radius: 12px;
1892
- }
1893
-
1894
- .widget-container.rounded {
1895
- border-radius: 12px;
1896
- }
1897
-
1898
- .widget-container.researching {
1899
- width: 265px;
1900
- border-radius: 12px;
1901
- }
1902
-
1903
- .widget-icon {
1904
- width: 32px;
1905
- height: 32px;
1906
- transition: transform 0.5s ease-in-out;
1907
- }
1908
-
1909
- .widget-container.rounded .widget-icon {
1910
- transform: rotate(110deg);
1911
- }
1912
-
1913
- @keyframes pulse-shadow {
1914
- 0% {
1915
- box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
1916
- }
1917
- 70% {
1918
- box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
1919
- }
1920
- 100% {
1921
- box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
1922
- }
1923
- }
1924
-
1925
- .pulse {
1926
- animation: pulse-shadow 2s ease-in-out infinite;
1927
- }
1928
- `;
1929
- __decorateClass$2([
1930
- n$2({ type: String })
1931
- ], ObiWidget.prototype, "apiBaseUrl", 2);
1932
- __decorateClass$2([
1933
- n$2({ type: String })
1934
- ], ObiWidget.prototype, "apiKey", 2);
1935
- __decorateClass$2([
1936
- n$2({ type: String })
1937
- ], ObiWidget.prototype, "position", 2);
1938
- __decorateClass$2([
1939
- r$1()
1940
- ], ObiWidget.prototype, "state", 2);
1941
- __decorateClass$2([
1942
- r$1()
1943
- ], ObiWidget.prototype, "showCourseModal", 2);
1944
- __decorateClass$2([
1945
- r$1()
1946
- ], ObiWidget.prototype, "isHovering", 2);
1947
- __decorateClass$2([
1948
- r$1()
1949
- ], ObiWidget.prototype, "navVisible", 2);
1950
- __decorateClass$2([
1951
- r$1()
1952
- ], ObiWidget.prototype, "activeSession", 2);
1953
- __decorateClass$2([
1954
- r$1()
1955
- ], ObiWidget.prototype, "volume", 2);
1956
- __decorateClass$2([
1957
- r$1()
1958
- ], ObiWidget.prototype, "screenPosition", 2);
1959
- if (!customElements.get("obi-widget")) {
1960
- customElements.define("obi-widget", ObiWidget);
1961
- }
1962
- const obiWidget = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1963
- __proto__: null,
1964
- ObiWidget
1965
- }, Symbol.toStringTag, { value: "Module" }));
1
+ import { i, n, b as i$1, S as SDKState, x } from "./chunks/obi-widget-0d63936f.js";
2
+ import { c, C, f, g, D, N, d, a, e } from "./chunks/obi-widget-0d63936f.js";
1966
3
  var __defProp$1 = Object.defineProperty;
1967
4
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
1968
5
  var __decorateClass$1 = (decorators, target, key, kind) => {
1969
6
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
1970
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1971
- if (decorator = decorators[i3])
7
+ for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
8
+ if (decorator = decorators[i2])
1972
9
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1973
10
  if (kind && result)
1974
11
  __defProp$1(target, key, result);
@@ -1998,7 +35,7 @@ class ObiStatusWidget extends i$1 {
1998
35
  }
1999
36
  }
2000
37
  }
2001
- ObiStatusWidget.styles = i$4`
38
+ ObiStatusWidget.styles = i`
2002
39
  :host {
2003
40
  display: inline-block;
2004
41
  font-family: Arial, sans-serif;
@@ -2039,7 +76,7 @@ ObiStatusWidget.styles = i$4`
2039
76
  }
2040
77
  `;
2041
78
  __decorateClass$1([
2042
- n$2({ type: String })
79
+ n({ type: String })
2043
80
  ], ObiStatusWidget.prototype, "state", 2);
2044
81
  if (!customElements.get("obi-status-widget")) {
2045
82
  customElements.define("obi-status-widget", ObiStatusWidget);
@@ -2052,8 +89,8 @@ var __defProp = Object.defineProperty;
2052
89
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2053
90
  var __decorateClass = (decorators, target, key, kind) => {
2054
91
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
2055
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
2056
- if (decorator = decorators[i3])
92
+ for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
93
+ if (decorator = decorators[i2])
2057
94
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2058
95
  if (kind && result)
2059
96
  __defProp(target, key, result);
@@ -2106,7 +143,7 @@ class ObiControlPanel extends i$1 {
2106
143
  this.dispatchEvent(new CustomEvent("stop"));
2107
144
  }
2108
145
  }
2109
- ObiControlPanel.styles = i$4`
146
+ ObiControlPanel.styles = i`
2110
147
  :host {
2111
148
  display: block;
2112
149
  font-family: Arial, sans-serif;
@@ -2171,13 +208,13 @@ ObiControlPanel.styles = i$4`
2171
208
  }
2172
209
  `;
2173
210
  __decorateClass([
2174
- n$2({ type: String })
211
+ n({ type: String })
2175
212
  ], ObiControlPanel.prototype, "state", 2);
2176
213
  __decorateClass([
2177
- n$2({ type: Boolean })
214
+ n({ type: Boolean })
2178
215
  ], ObiControlPanel.prototype, "voiceEnabled", 2);
2179
216
  __decorateClass([
2180
- n$2({ type: Boolean })
217
+ n({ type: Boolean })
2181
218
  ], ObiControlPanel.prototype, "screenEnabled", 2);
2182
219
  if (!customElements.get("obi-control-panel")) {
2183
220
  customElements.define("obi-control-panel", ObiControlPanel);
@@ -2189,27 +226,27 @@ const controlPanel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
2189
226
  function defineCustomElements() {
2190
227
  Promise.resolve().then(() => statusWidget);
2191
228
  Promise.resolve().then(() => controlPanel);
2192
- Promise.resolve().then(() => obiWidget);
2193
- Promise.resolve().then(() => audioEqualizer);
2194
- Promise.resolve().then(() => dotLoader);
2195
- Promise.resolve().then(() => navIcon);
2196
- Promise.resolve().then(() => navigationBar);
2197
- Promise.resolve().then(() => searchingLoader);
2198
- Promise.resolve().then(() => courses);
2199
- Promise.resolve().then(() => courseModal);
229
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.p);
230
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.m);
231
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.o);
232
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.h);
233
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.j);
234
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.s);
235
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.k);
236
+ import("./chunks/obi-widget-0d63936f.js").then((n2) => n2.l);
2200
237
  }
2201
238
  export {
2202
- AudioEqualizer,
2203
- Course,
2204
- CourseList,
2205
- CourseModal,
2206
- DotLoader,
2207
- NavIcon,
2208
- NavigationBar,
239
+ c as AudioEqualizer,
240
+ C as Course,
241
+ f as CourseList,
242
+ g as CourseModal,
243
+ D as DotLoader,
244
+ N as NavIcon,
245
+ d as NavigationBar,
2209
246
  ObiControlPanel,
2210
247
  ObiStatusWidget,
2211
- ObiWidget,
2212
- SearchingLoader,
248
+ a as ObiWidget,
249
+ e as SearchingLoader,
2213
250
  defineCustomElements
2214
251
  };
2215
252
  //# sourceMappingURL=ui.js.map