bariweb-widget 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/AdminUI-CGKuDZdZ.js +66 -0
- package/dist/Watcher-CrSaF4Ov.js +226 -0
- package/dist/bariweb.iife.js +1346 -0
- package/dist/bariweb.js +3195 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/package.json +31 -0
package/dist/bariweb.js
ADDED
|
@@ -0,0 +1,3195 @@
|
|
|
1
|
+
import { r as e, t } from "./Watcher-CrSaF4Ov.js";
|
|
2
|
+
//#region src/lib/api/core/bodySerializer.gen.ts
|
|
3
|
+
var n = { bodySerializer: (e) => JSON.stringify(e, (e, t) => typeof t == "bigint" ? t.toString() : t) };
|
|
4
|
+
Object.entries({
|
|
5
|
+
$body_: "body",
|
|
6
|
+
$headers_: "headers",
|
|
7
|
+
$path_: "path",
|
|
8
|
+
$query_: "query"
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/lib/api/core/serverSentEvents.gen.ts
|
|
12
|
+
var r = ({ onRequest: e, onSseError: t, onSseEvent: n, responseTransformer: r, responseValidator: i, sseDefaultRetryDelay: a, sseMaxRetryAttempts: o, sseMaxRetryDelay: s, sseSleepFn: c, url: l, ...u }) => {
|
|
13
|
+
let d, f = c ?? ((e) => new Promise((t) => setTimeout(t, e)));
|
|
14
|
+
return { stream: async function* () {
|
|
15
|
+
let c = a ?? 3e3, p = 0, m = u.signal ?? new AbortController().signal;
|
|
16
|
+
for (; !m.aborted;) {
|
|
17
|
+
p++;
|
|
18
|
+
let a = u.headers instanceof Headers ? u.headers : new Headers(u.headers);
|
|
19
|
+
d !== void 0 && a.set("Last-Event-ID", d);
|
|
20
|
+
try {
|
|
21
|
+
let t = {
|
|
22
|
+
redirect: "follow",
|
|
23
|
+
...u,
|
|
24
|
+
body: u.serializedBody,
|
|
25
|
+
headers: a,
|
|
26
|
+
signal: m
|
|
27
|
+
}, o = new Request(l, t);
|
|
28
|
+
e && (o = await e(l, t));
|
|
29
|
+
let s = await (u.fetch ?? globalThis.fetch)(o);
|
|
30
|
+
if (!s.ok) throw Error(`SSE failed: ${s.status} ${s.statusText}`);
|
|
31
|
+
if (!s.body) throw Error("No body in SSE response");
|
|
32
|
+
let f = s.body.pipeThrough(new TextDecoderStream()).getReader(), p = "", h = () => {
|
|
33
|
+
try {
|
|
34
|
+
f.cancel();
|
|
35
|
+
} catch {}
|
|
36
|
+
};
|
|
37
|
+
m.addEventListener("abort", h);
|
|
38
|
+
try {
|
|
39
|
+
for (;;) {
|
|
40
|
+
let { done: e, value: t } = await f.read();
|
|
41
|
+
if (e) break;
|
|
42
|
+
p += t, p = p.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
43
|
+
let a = p.split("\n\n");
|
|
44
|
+
p = a.pop() ?? "";
|
|
45
|
+
for (let e of a) {
|
|
46
|
+
let t = e.split("\n"), a = [], o;
|
|
47
|
+
for (let e of t) if (e.startsWith("data:")) a.push(e.replace(/^data:\s*/, ""));
|
|
48
|
+
else if (e.startsWith("event:")) o = e.replace(/^event:\s*/, "");
|
|
49
|
+
else if (e.startsWith("id:")) d = e.replace(/^id:\s*/, "");
|
|
50
|
+
else if (e.startsWith("retry:")) {
|
|
51
|
+
let t = Number.parseInt(e.replace(/^retry:\s*/, ""), 10);
|
|
52
|
+
Number.isNaN(t) || (c = t);
|
|
53
|
+
}
|
|
54
|
+
let s, l = !1;
|
|
55
|
+
if (a.length) {
|
|
56
|
+
let e = a.join("\n");
|
|
57
|
+
try {
|
|
58
|
+
s = JSON.parse(e), l = !0;
|
|
59
|
+
} catch {
|
|
60
|
+
s = e;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
l && (i && await i(s), r && (s = await r(s))), n?.({
|
|
64
|
+
data: s,
|
|
65
|
+
event: o,
|
|
66
|
+
id: d,
|
|
67
|
+
retry: c
|
|
68
|
+
}), a.length && (yield s);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} finally {
|
|
72
|
+
m.removeEventListener("abort", h), f.releaseLock();
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
if (t?.(e), o !== void 0 && p >= o) break;
|
|
77
|
+
await f(Math.min(c * 2 ** (p - 1), s ?? 3e4));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}() };
|
|
81
|
+
}, i = (e) => {
|
|
82
|
+
switch (e) {
|
|
83
|
+
case "label": return ".";
|
|
84
|
+
case "matrix": return ";";
|
|
85
|
+
case "simple": return ",";
|
|
86
|
+
default: return "&";
|
|
87
|
+
}
|
|
88
|
+
}, a = (e) => {
|
|
89
|
+
switch (e) {
|
|
90
|
+
case "form": return ",";
|
|
91
|
+
case "pipeDelimited": return "|";
|
|
92
|
+
case "spaceDelimited": return "%20";
|
|
93
|
+
default: return ",";
|
|
94
|
+
}
|
|
95
|
+
}, o = (e) => {
|
|
96
|
+
switch (e) {
|
|
97
|
+
case "label": return ".";
|
|
98
|
+
case "matrix": return ";";
|
|
99
|
+
case "simple": return ",";
|
|
100
|
+
default: return "&";
|
|
101
|
+
}
|
|
102
|
+
}, s = ({ allowReserved: e, explode: t, name: n, style: r, value: o }) => {
|
|
103
|
+
if (!t) {
|
|
104
|
+
let t = (e ? o : o.map((e) => encodeURIComponent(e))).join(a(r));
|
|
105
|
+
switch (r) {
|
|
106
|
+
case "label": return `.${t}`;
|
|
107
|
+
case "matrix": return `;${n}=${t}`;
|
|
108
|
+
case "simple": return t;
|
|
109
|
+
default: return `${n}=${t}`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
let s = i(r), l = o.map((t) => r === "label" || r === "simple" ? e ? t : encodeURIComponent(t) : c({
|
|
113
|
+
allowReserved: e,
|
|
114
|
+
name: n,
|
|
115
|
+
value: t
|
|
116
|
+
})).join(s);
|
|
117
|
+
return r === "label" || r === "matrix" ? s + l : l;
|
|
118
|
+
}, c = ({ allowReserved: e, name: t, value: n }) => {
|
|
119
|
+
if (n == null) return "";
|
|
120
|
+
if (typeof n == "object") throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
|
|
121
|
+
return `${t}=${e ? n : encodeURIComponent(n)}`;
|
|
122
|
+
}, l = ({ allowReserved: e, explode: t, name: n, style: r, value: i, valueOnly: a }) => {
|
|
123
|
+
if (i instanceof Date) return a ? i.toISOString() : `${n}=${i.toISOString()}`;
|
|
124
|
+
if (r !== "deepObject" && !t) {
|
|
125
|
+
let t = [];
|
|
126
|
+
Object.entries(i).forEach(([n, r]) => {
|
|
127
|
+
t = [
|
|
128
|
+
...t,
|
|
129
|
+
n,
|
|
130
|
+
e ? r : encodeURIComponent(r)
|
|
131
|
+
];
|
|
132
|
+
});
|
|
133
|
+
let a = t.join(",");
|
|
134
|
+
switch (r) {
|
|
135
|
+
case "form": return `${n}=${a}`;
|
|
136
|
+
case "label": return `.${a}`;
|
|
137
|
+
case "matrix": return `;${n}=${a}`;
|
|
138
|
+
default: return a;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
let s = o(r), l = Object.entries(i).map(([t, i]) => c({
|
|
142
|
+
allowReserved: e,
|
|
143
|
+
name: r === "deepObject" ? `${n}[${t}]` : t,
|
|
144
|
+
value: i
|
|
145
|
+
})).join(s);
|
|
146
|
+
return r === "label" || r === "matrix" ? s + l : l;
|
|
147
|
+
}, u = /\{[^{}]+\}/g, d = ({ path: e, url: t }) => {
|
|
148
|
+
let n = t, r = t.match(u);
|
|
149
|
+
if (r) for (let t of r) {
|
|
150
|
+
let r = !1, i = t.substring(1, t.length - 1), a = "simple";
|
|
151
|
+
i.endsWith("*") && (r = !0, i = i.substring(0, i.length - 1)), i.startsWith(".") ? (i = i.substring(1), a = "label") : i.startsWith(";") && (i = i.substring(1), a = "matrix");
|
|
152
|
+
let o = e[i];
|
|
153
|
+
if (o == null) continue;
|
|
154
|
+
if (Array.isArray(o)) {
|
|
155
|
+
n = n.replace(t, s({
|
|
156
|
+
explode: r,
|
|
157
|
+
name: i,
|
|
158
|
+
style: a,
|
|
159
|
+
value: o
|
|
160
|
+
}));
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (typeof o == "object") {
|
|
164
|
+
n = n.replace(t, l({
|
|
165
|
+
explode: r,
|
|
166
|
+
name: i,
|
|
167
|
+
style: a,
|
|
168
|
+
value: o,
|
|
169
|
+
valueOnly: !0
|
|
170
|
+
}));
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (a === "matrix") {
|
|
174
|
+
n = n.replace(t, `;${c({
|
|
175
|
+
name: i,
|
|
176
|
+
value: o
|
|
177
|
+
})}`);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
let u = encodeURIComponent(a === "label" ? `.${o}` : o);
|
|
181
|
+
n = n.replace(t, u);
|
|
182
|
+
}
|
|
183
|
+
return n;
|
|
184
|
+
}, f = ({ baseUrl: e, path: t, query: n, querySerializer: r, url: i }) => {
|
|
185
|
+
let a = i.startsWith("/") ? i : `/${i}`, o = (e ?? "") + a;
|
|
186
|
+
t && (o = d({
|
|
187
|
+
path: t,
|
|
188
|
+
url: o
|
|
189
|
+
}));
|
|
190
|
+
let s = n ? r(n) : "";
|
|
191
|
+
return s.startsWith("?") && (s = s.substring(1)), s && (o += `?${s}`), o;
|
|
192
|
+
};
|
|
193
|
+
function p(e) {
|
|
194
|
+
let t = e.body !== void 0;
|
|
195
|
+
if (t && e.bodySerializer) return "serializedBody" in e ? e.serializedBody !== void 0 && e.serializedBody !== "" ? e.serializedBody : null : e.body === "" ? null : e.body;
|
|
196
|
+
if (t) return e.body;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/lib/api/core/auth.gen.ts
|
|
200
|
+
var m = async (e, t) => {
|
|
201
|
+
let n = typeof t == "function" ? await t(e) : t;
|
|
202
|
+
if (n) return e.scheme === "bearer" ? `Bearer ${n}` : e.scheme === "basic" ? `Basic ${btoa(n)}` : n;
|
|
203
|
+
}, h = ({ parameters: e = {}, ...t } = {}) => (n) => {
|
|
204
|
+
let r = [];
|
|
205
|
+
if (n && typeof n == "object") for (let i in n) {
|
|
206
|
+
let a = n[i];
|
|
207
|
+
if (a == null) continue;
|
|
208
|
+
let o = e[i] || t;
|
|
209
|
+
if (Array.isArray(a)) {
|
|
210
|
+
let e = s({
|
|
211
|
+
allowReserved: o.allowReserved,
|
|
212
|
+
explode: !0,
|
|
213
|
+
name: i,
|
|
214
|
+
style: "form",
|
|
215
|
+
value: a,
|
|
216
|
+
...o.array
|
|
217
|
+
});
|
|
218
|
+
e && r.push(e);
|
|
219
|
+
} else if (typeof a == "object") {
|
|
220
|
+
let e = l({
|
|
221
|
+
allowReserved: o.allowReserved,
|
|
222
|
+
explode: !0,
|
|
223
|
+
name: i,
|
|
224
|
+
style: "deepObject",
|
|
225
|
+
value: a,
|
|
226
|
+
...o.object
|
|
227
|
+
});
|
|
228
|
+
e && r.push(e);
|
|
229
|
+
} else {
|
|
230
|
+
let e = c({
|
|
231
|
+
allowReserved: o.allowReserved,
|
|
232
|
+
name: i,
|
|
233
|
+
value: a
|
|
234
|
+
});
|
|
235
|
+
e && r.push(e);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return r.join("&");
|
|
239
|
+
}, ee = (e) => {
|
|
240
|
+
if (!e) return "stream";
|
|
241
|
+
let t = e.split(";")[0]?.trim();
|
|
242
|
+
if (t) {
|
|
243
|
+
if (t.startsWith("application/json") || t.endsWith("+json")) return "json";
|
|
244
|
+
if (t === "multipart/form-data") return "formData";
|
|
245
|
+
if ([
|
|
246
|
+
"application/",
|
|
247
|
+
"audio/",
|
|
248
|
+
"image/",
|
|
249
|
+
"video/"
|
|
250
|
+
].some((e) => t.startsWith(e))) return "blob";
|
|
251
|
+
if (t.startsWith("text/")) return "text";
|
|
252
|
+
}
|
|
253
|
+
}, te = (e, t) => t ? !!(e.headers.has(t) || e.query?.[t] || e.headers.get("Cookie")?.includes(`${t}=`)) : !1, ne = async ({ security: e, ...t }) => {
|
|
254
|
+
for (let n of e) {
|
|
255
|
+
if (te(t, n.name)) continue;
|
|
256
|
+
let e = await m(n, t.auth);
|
|
257
|
+
if (!e) continue;
|
|
258
|
+
let r = n.name ?? "Authorization";
|
|
259
|
+
switch (n.in) {
|
|
260
|
+
case "query":
|
|
261
|
+
t.query ||= {}, t.query[r] = e;
|
|
262
|
+
break;
|
|
263
|
+
case "cookie":
|
|
264
|
+
t.headers.append("Cookie", `${r}=${e}`);
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
t.headers.set(r, e);
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, re = (e) => f({
|
|
272
|
+
baseUrl: e.baseUrl,
|
|
273
|
+
path: e.path,
|
|
274
|
+
query: e.query,
|
|
275
|
+
querySerializer: typeof e.querySerializer == "function" ? e.querySerializer : h(e.querySerializer),
|
|
276
|
+
url: e.url
|
|
277
|
+
}), ie = (e, t) => {
|
|
278
|
+
let n = {
|
|
279
|
+
...e,
|
|
280
|
+
...t
|
|
281
|
+
};
|
|
282
|
+
return n.baseUrl?.endsWith("/") && (n.baseUrl = n.baseUrl.substring(0, n.baseUrl.length - 1)), n.headers = oe(e.headers, t.headers), n;
|
|
283
|
+
}, ae = (e) => {
|
|
284
|
+
let t = [];
|
|
285
|
+
return e.forEach((e, n) => {
|
|
286
|
+
t.push([n, e]);
|
|
287
|
+
}), t;
|
|
288
|
+
}, oe = (...e) => {
|
|
289
|
+
let t = new Headers();
|
|
290
|
+
for (let n of e) {
|
|
291
|
+
if (!n) continue;
|
|
292
|
+
let e = n instanceof Headers ? ae(n) : Object.entries(n);
|
|
293
|
+
for (let [n, r] of e) if (r === null) t.delete(n);
|
|
294
|
+
else if (Array.isArray(r)) for (let e of r) t.append(n, e);
|
|
295
|
+
else r !== void 0 && t.set(n, typeof r == "object" ? JSON.stringify(r) : r);
|
|
296
|
+
}
|
|
297
|
+
return t;
|
|
298
|
+
}, g = class {
|
|
299
|
+
constructor() {
|
|
300
|
+
this.fns = [];
|
|
301
|
+
}
|
|
302
|
+
clear() {
|
|
303
|
+
this.fns = [];
|
|
304
|
+
}
|
|
305
|
+
eject(e) {
|
|
306
|
+
let t = this.getInterceptorIndex(e);
|
|
307
|
+
this.fns[t] && (this.fns[t] = null);
|
|
308
|
+
}
|
|
309
|
+
exists(e) {
|
|
310
|
+
let t = this.getInterceptorIndex(e);
|
|
311
|
+
return !!this.fns[t];
|
|
312
|
+
}
|
|
313
|
+
getInterceptorIndex(e) {
|
|
314
|
+
return typeof e == "number" ? this.fns[e] ? e : -1 : this.fns.indexOf(e);
|
|
315
|
+
}
|
|
316
|
+
update(e, t) {
|
|
317
|
+
let n = this.getInterceptorIndex(e);
|
|
318
|
+
return this.fns[n] ? (this.fns[n] = t, e) : !1;
|
|
319
|
+
}
|
|
320
|
+
use(e) {
|
|
321
|
+
return this.fns.push(e), this.fns.length - 1;
|
|
322
|
+
}
|
|
323
|
+
}, se = () => ({
|
|
324
|
+
error: new g(),
|
|
325
|
+
request: new g(),
|
|
326
|
+
response: new g()
|
|
327
|
+
}), ce = h({
|
|
328
|
+
allowReserved: !1,
|
|
329
|
+
array: {
|
|
330
|
+
explode: !0,
|
|
331
|
+
style: "form"
|
|
332
|
+
},
|
|
333
|
+
object: {
|
|
334
|
+
explode: !0,
|
|
335
|
+
style: "deepObject"
|
|
336
|
+
}
|
|
337
|
+
}), le = { "Content-Type": "application/json" }, ue = (e = {}) => ({
|
|
338
|
+
...n,
|
|
339
|
+
headers: le,
|
|
340
|
+
parseAs: "auto",
|
|
341
|
+
querySerializer: ce,
|
|
342
|
+
...e
|
|
343
|
+
}), de = ((e = {}) => {
|
|
344
|
+
let t = ie(ue(), e), n = () => ({ ...t }), i = (e) => (t = ie(t, e), n()), a = se(), o = async (e) => {
|
|
345
|
+
let n = {
|
|
346
|
+
...t,
|
|
347
|
+
...e,
|
|
348
|
+
fetch: e.fetch ?? t.fetch ?? globalThis.fetch,
|
|
349
|
+
headers: oe(t.headers, e.headers),
|
|
350
|
+
serializedBody: void 0
|
|
351
|
+
};
|
|
352
|
+
return n.security && await ne({
|
|
353
|
+
...n,
|
|
354
|
+
security: n.security
|
|
355
|
+
}), n.requestValidator && await n.requestValidator(n), n.body !== void 0 && n.bodySerializer && (n.serializedBody = n.bodySerializer(n.body)), (n.body === void 0 || n.serializedBody === "") && n.headers.delete("Content-Type"), {
|
|
356
|
+
opts: n,
|
|
357
|
+
url: re(n)
|
|
358
|
+
};
|
|
359
|
+
}, s = async (e) => {
|
|
360
|
+
let { opts: t, url: n } = await o(e), r = {
|
|
361
|
+
redirect: "follow",
|
|
362
|
+
...t,
|
|
363
|
+
body: p(t)
|
|
364
|
+
}, i = new Request(n, r);
|
|
365
|
+
for (let e of a.request.fns) e && (i = await e(i, t));
|
|
366
|
+
let s = t.fetch, c;
|
|
367
|
+
try {
|
|
368
|
+
c = await s(i);
|
|
369
|
+
} catch (e) {
|
|
370
|
+
let n = e;
|
|
371
|
+
for (let r of a.error.fns) r && (n = await r(e, void 0, i, t));
|
|
372
|
+
if (n ||= {}, t.throwOnError) throw n;
|
|
373
|
+
return t.responseStyle === "data" ? void 0 : {
|
|
374
|
+
error: n,
|
|
375
|
+
request: i,
|
|
376
|
+
response: void 0
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
for (let e of a.response.fns) e && (c = await e(c, i, t));
|
|
380
|
+
let l = {
|
|
381
|
+
request: i,
|
|
382
|
+
response: c
|
|
383
|
+
};
|
|
384
|
+
if (c.ok) {
|
|
385
|
+
let e = (t.parseAs === "auto" ? ee(c.headers.get("Content-Type")) : t.parseAs) ?? "json";
|
|
386
|
+
if (c.status === 204 || c.headers.get("Content-Length") === "0") {
|
|
387
|
+
let n;
|
|
388
|
+
switch (e) {
|
|
389
|
+
case "arrayBuffer":
|
|
390
|
+
case "blob":
|
|
391
|
+
case "text":
|
|
392
|
+
n = await c[e]();
|
|
393
|
+
break;
|
|
394
|
+
case "formData":
|
|
395
|
+
n = new FormData();
|
|
396
|
+
break;
|
|
397
|
+
case "stream":
|
|
398
|
+
n = c.body;
|
|
399
|
+
break;
|
|
400
|
+
default:
|
|
401
|
+
n = {};
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
return t.responseStyle === "data" ? n : {
|
|
405
|
+
data: n,
|
|
406
|
+
...l
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
let n;
|
|
410
|
+
switch (e) {
|
|
411
|
+
case "arrayBuffer":
|
|
412
|
+
case "blob":
|
|
413
|
+
case "formData":
|
|
414
|
+
case "text":
|
|
415
|
+
n = await c[e]();
|
|
416
|
+
break;
|
|
417
|
+
case "json": {
|
|
418
|
+
let e = await c.text();
|
|
419
|
+
n = e ? JSON.parse(e) : {};
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
case "stream": return t.responseStyle === "data" ? c.body : {
|
|
423
|
+
data: c.body,
|
|
424
|
+
...l
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
return e === "json" && (t.responseValidator && await t.responseValidator(n), t.responseTransformer && (n = await t.responseTransformer(n))), t.responseStyle === "data" ? n : {
|
|
428
|
+
data: n,
|
|
429
|
+
...l
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
let u = await c.text(), d;
|
|
433
|
+
try {
|
|
434
|
+
d = JSON.parse(u);
|
|
435
|
+
} catch {}
|
|
436
|
+
let f = d ?? u, m = f;
|
|
437
|
+
for (let e of a.error.fns) e && (m = await e(f, c, i, t));
|
|
438
|
+
if (m ||= {}, t.throwOnError) throw m;
|
|
439
|
+
return t.responseStyle === "data" ? void 0 : {
|
|
440
|
+
error: m,
|
|
441
|
+
...l
|
|
442
|
+
};
|
|
443
|
+
}, c = (e) => (t) => s({
|
|
444
|
+
...t,
|
|
445
|
+
method: e
|
|
446
|
+
}), l = (e) => async (t) => {
|
|
447
|
+
let { opts: n, url: i } = await o(t);
|
|
448
|
+
return r({
|
|
449
|
+
...n,
|
|
450
|
+
body: n.body,
|
|
451
|
+
headers: n.headers,
|
|
452
|
+
method: e,
|
|
453
|
+
onRequest: async (e, t) => {
|
|
454
|
+
let r = new Request(e, t);
|
|
455
|
+
for (let e of a.request.fns) e && (r = await e(r, n));
|
|
456
|
+
return r;
|
|
457
|
+
},
|
|
458
|
+
serializedBody: p(n),
|
|
459
|
+
url: i
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
return {
|
|
463
|
+
buildUrl: (e) => re({
|
|
464
|
+
...t,
|
|
465
|
+
...e
|
|
466
|
+
}),
|
|
467
|
+
connect: c("CONNECT"),
|
|
468
|
+
delete: c("DELETE"),
|
|
469
|
+
get: c("GET"),
|
|
470
|
+
getConfig: n,
|
|
471
|
+
head: c("HEAD"),
|
|
472
|
+
interceptors: a,
|
|
473
|
+
options: c("OPTIONS"),
|
|
474
|
+
patch: c("PATCH"),
|
|
475
|
+
post: c("POST"),
|
|
476
|
+
put: c("PUT"),
|
|
477
|
+
request: s,
|
|
478
|
+
setConfig: i,
|
|
479
|
+
sse: {
|
|
480
|
+
connect: l("CONNECT"),
|
|
481
|
+
delete: l("DELETE"),
|
|
482
|
+
get: l("GET"),
|
|
483
|
+
head: l("HEAD"),
|
|
484
|
+
options: l("OPTIONS"),
|
|
485
|
+
patch: l("PATCH"),
|
|
486
|
+
post: l("POST"),
|
|
487
|
+
put: l("PUT"),
|
|
488
|
+
trace: l("TRACE")
|
|
489
|
+
},
|
|
490
|
+
trace: c("TRACE")
|
|
491
|
+
};
|
|
492
|
+
})(ue({ baseUrl: "http://localhost:8000" })), _ = globalThis, v = _.ShadowRoot && (_.ShadyCSS === void 0 || _.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, y = Symbol(), fe = /* @__PURE__ */ new WeakMap(), pe = class {
|
|
493
|
+
constructor(e, t, n) {
|
|
494
|
+
if (this._$cssResult$ = !0, n !== y) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
495
|
+
this.cssText = e, this.t = t;
|
|
496
|
+
}
|
|
497
|
+
get styleSheet() {
|
|
498
|
+
let e = this.o, t = this.t;
|
|
499
|
+
if (v && e === void 0) {
|
|
500
|
+
let n = t !== void 0 && t.length === 1;
|
|
501
|
+
n && (e = fe.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && fe.set(t, e));
|
|
502
|
+
}
|
|
503
|
+
return e;
|
|
504
|
+
}
|
|
505
|
+
toString() {
|
|
506
|
+
return this.cssText;
|
|
507
|
+
}
|
|
508
|
+
}, me = (e) => new pe(typeof e == "string" ? e : e + "", void 0, y), he = (e, ...t) => new pe(e.length === 1 ? e[0] : t.reduce((t, n, r) => t + ((e) => {
|
|
509
|
+
if (!0 === e._$cssResult$) return e.cssText;
|
|
510
|
+
if (typeof e == "number") return e;
|
|
511
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
512
|
+
})(n) + e[r + 1], e[0]), e, y), ge = (e, t) => {
|
|
513
|
+
if (v) e.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
514
|
+
else for (let n of t) {
|
|
515
|
+
let t = document.createElement("style"), r = _.litNonce;
|
|
516
|
+
r !== void 0 && t.setAttribute("nonce", r), t.textContent = n.cssText, e.appendChild(t);
|
|
517
|
+
}
|
|
518
|
+
}, _e = v ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
|
|
519
|
+
let t = "";
|
|
520
|
+
for (let n of e.cssRules) t += n.cssText;
|
|
521
|
+
return me(t);
|
|
522
|
+
})(e) : e, { is: ve, defineProperty: ye, getOwnPropertyDescriptor: be, getOwnPropertyNames: xe, getOwnPropertySymbols: Se, getPrototypeOf: Ce } = Object, b = globalThis, we = b.trustedTypes, Te = we ? we.emptyScript : "", Ee = b.reactiveElementPolyfillSupport, x = (e, t) => e, S = {
|
|
523
|
+
toAttribute(e, t) {
|
|
524
|
+
switch (t) {
|
|
525
|
+
case Boolean:
|
|
526
|
+
e = e ? Te : null;
|
|
527
|
+
break;
|
|
528
|
+
case Object:
|
|
529
|
+
case Array: e = e == null ? e : JSON.stringify(e);
|
|
530
|
+
}
|
|
531
|
+
return e;
|
|
532
|
+
},
|
|
533
|
+
fromAttribute(e, t) {
|
|
534
|
+
let n = e;
|
|
535
|
+
switch (t) {
|
|
536
|
+
case Boolean:
|
|
537
|
+
n = e !== null;
|
|
538
|
+
break;
|
|
539
|
+
case Number:
|
|
540
|
+
n = e === null ? null : Number(e);
|
|
541
|
+
break;
|
|
542
|
+
case Object:
|
|
543
|
+
case Array: try {
|
|
544
|
+
n = JSON.parse(e);
|
|
545
|
+
} catch {
|
|
546
|
+
n = null;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return n;
|
|
550
|
+
}
|
|
551
|
+
}, C = (e, t) => !ve(e, t), De = {
|
|
552
|
+
attribute: !0,
|
|
553
|
+
type: String,
|
|
554
|
+
converter: S,
|
|
555
|
+
reflect: !1,
|
|
556
|
+
useDefault: !1,
|
|
557
|
+
hasChanged: C
|
|
558
|
+
};
|
|
559
|
+
Symbol.metadata ??= Symbol("metadata"), b.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
560
|
+
var w = class extends HTMLElement {
|
|
561
|
+
static addInitializer(e) {
|
|
562
|
+
this._$Ei(), (this.l ??= []).push(e);
|
|
563
|
+
}
|
|
564
|
+
static get observedAttributes() {
|
|
565
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
566
|
+
}
|
|
567
|
+
static createProperty(e, t = De) {
|
|
568
|
+
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
569
|
+
let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
|
|
570
|
+
r !== void 0 && ye(this.prototype, e, r);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
static getPropertyDescriptor(e, t, n) {
|
|
574
|
+
let { get: r, set: i } = be(this.prototype, e) ?? {
|
|
575
|
+
get() {
|
|
576
|
+
return this[t];
|
|
577
|
+
},
|
|
578
|
+
set(e) {
|
|
579
|
+
this[t] = e;
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
return {
|
|
583
|
+
get: r,
|
|
584
|
+
set(t) {
|
|
585
|
+
let a = r?.call(this);
|
|
586
|
+
i?.call(this, t), this.requestUpdate(e, a, n);
|
|
587
|
+
},
|
|
588
|
+
configurable: !0,
|
|
589
|
+
enumerable: !0
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
static getPropertyOptions(e) {
|
|
593
|
+
return this.elementProperties.get(e) ?? De;
|
|
594
|
+
}
|
|
595
|
+
static _$Ei() {
|
|
596
|
+
if (this.hasOwnProperty(x("elementProperties"))) return;
|
|
597
|
+
let e = Ce(this);
|
|
598
|
+
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
599
|
+
}
|
|
600
|
+
static finalize() {
|
|
601
|
+
if (this.hasOwnProperty(x("finalized"))) return;
|
|
602
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(x("properties"))) {
|
|
603
|
+
let e = this.properties, t = [...xe(e), ...Se(e)];
|
|
604
|
+
for (let n of t) this.createProperty(n, e[n]);
|
|
605
|
+
}
|
|
606
|
+
let e = this[Symbol.metadata];
|
|
607
|
+
if (e !== null) {
|
|
608
|
+
let t = litPropertyMetadata.get(e);
|
|
609
|
+
if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
|
|
610
|
+
}
|
|
611
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
612
|
+
for (let [e, t] of this.elementProperties) {
|
|
613
|
+
let n = this._$Eu(e, t);
|
|
614
|
+
n !== void 0 && this._$Eh.set(n, e);
|
|
615
|
+
}
|
|
616
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
617
|
+
}
|
|
618
|
+
static finalizeStyles(e) {
|
|
619
|
+
let t = [];
|
|
620
|
+
if (Array.isArray(e)) {
|
|
621
|
+
let n = new Set(e.flat(Infinity).reverse());
|
|
622
|
+
for (let e of n) t.unshift(_e(e));
|
|
623
|
+
} else e !== void 0 && t.push(_e(e));
|
|
624
|
+
return t;
|
|
625
|
+
}
|
|
626
|
+
static _$Eu(e, t) {
|
|
627
|
+
let n = t.attribute;
|
|
628
|
+
return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
629
|
+
}
|
|
630
|
+
constructor() {
|
|
631
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
632
|
+
}
|
|
633
|
+
_$Ev() {
|
|
634
|
+
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
|
|
635
|
+
}
|
|
636
|
+
addController(e) {
|
|
637
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
638
|
+
}
|
|
639
|
+
removeController(e) {
|
|
640
|
+
this._$EO?.delete(e);
|
|
641
|
+
}
|
|
642
|
+
_$E_() {
|
|
643
|
+
let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
644
|
+
for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
|
|
645
|
+
e.size > 0 && (this._$Ep = e);
|
|
646
|
+
}
|
|
647
|
+
createRenderRoot() {
|
|
648
|
+
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
649
|
+
return ge(e, this.constructor.elementStyles), e;
|
|
650
|
+
}
|
|
651
|
+
connectedCallback() {
|
|
652
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
653
|
+
}
|
|
654
|
+
enableUpdating(e) {}
|
|
655
|
+
disconnectedCallback() {
|
|
656
|
+
this._$EO?.forEach((e) => e.hostDisconnected?.());
|
|
657
|
+
}
|
|
658
|
+
attributeChangedCallback(e, t, n) {
|
|
659
|
+
this._$AK(e, n);
|
|
660
|
+
}
|
|
661
|
+
_$ET(e, t) {
|
|
662
|
+
let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
|
|
663
|
+
if (r !== void 0 && !0 === n.reflect) {
|
|
664
|
+
let i = (n.converter?.toAttribute === void 0 ? S : n.converter).toAttribute(t, n.type);
|
|
665
|
+
this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
_$AK(e, t) {
|
|
669
|
+
let n = this.constructor, r = n._$Eh.get(e);
|
|
670
|
+
if (r !== void 0 && this._$Em !== r) {
|
|
671
|
+
let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? S : e.converter;
|
|
672
|
+
this._$Em = r;
|
|
673
|
+
let a = i.fromAttribute(t, e.type);
|
|
674
|
+
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
requestUpdate(e, t, n, r = !1, i) {
|
|
678
|
+
if (e !== void 0) {
|
|
679
|
+
let a = this.constructor;
|
|
680
|
+
if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? C)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
|
|
681
|
+
this.C(e, t, n);
|
|
682
|
+
}
|
|
683
|
+
!1 === this.isUpdatePending && (this._$ES = this._$EP());
|
|
684
|
+
}
|
|
685
|
+
C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
|
|
686
|
+
n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
687
|
+
}
|
|
688
|
+
async _$EP() {
|
|
689
|
+
this.isUpdatePending = !0;
|
|
690
|
+
try {
|
|
691
|
+
await this._$ES;
|
|
692
|
+
} catch (e) {
|
|
693
|
+
Promise.reject(e);
|
|
694
|
+
}
|
|
695
|
+
let e = this.scheduleUpdate();
|
|
696
|
+
return e != null && await e, !this.isUpdatePending;
|
|
697
|
+
}
|
|
698
|
+
scheduleUpdate() {
|
|
699
|
+
return this.performUpdate();
|
|
700
|
+
}
|
|
701
|
+
performUpdate() {
|
|
702
|
+
if (!this.isUpdatePending) return;
|
|
703
|
+
if (!this.hasUpdated) {
|
|
704
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
705
|
+
for (let [e, t] of this._$Ep) this[e] = t;
|
|
706
|
+
this._$Ep = void 0;
|
|
707
|
+
}
|
|
708
|
+
let e = this.constructor.elementProperties;
|
|
709
|
+
if (e.size > 0) for (let [t, n] of e) {
|
|
710
|
+
let { wrapped: e } = n, r = this[t];
|
|
711
|
+
!0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
let e = !1, t = this._$AL;
|
|
715
|
+
try {
|
|
716
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM();
|
|
717
|
+
} catch (t) {
|
|
718
|
+
throw e = !1, this._$EM(), t;
|
|
719
|
+
}
|
|
720
|
+
e && this._$AE(t);
|
|
721
|
+
}
|
|
722
|
+
willUpdate(e) {}
|
|
723
|
+
_$AE(e) {
|
|
724
|
+
this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
725
|
+
}
|
|
726
|
+
_$EM() {
|
|
727
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
728
|
+
}
|
|
729
|
+
get updateComplete() {
|
|
730
|
+
return this.getUpdateComplete();
|
|
731
|
+
}
|
|
732
|
+
getUpdateComplete() {
|
|
733
|
+
return this._$ES;
|
|
734
|
+
}
|
|
735
|
+
shouldUpdate(e) {
|
|
736
|
+
return !0;
|
|
737
|
+
}
|
|
738
|
+
update(e) {
|
|
739
|
+
this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
|
|
740
|
+
}
|
|
741
|
+
updated(e) {}
|
|
742
|
+
firstUpdated(e) {}
|
|
743
|
+
};
|
|
744
|
+
w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, w[x("elementProperties")] = /* @__PURE__ */ new Map(), w[x("finalized")] = /* @__PURE__ */ new Map(), Ee?.({ ReactiveElement: w }), (b.reactiveElementVersions ??= []).push("2.1.2");
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region node_modules/lit-html/lit-html.js
|
|
747
|
+
var T = globalThis, Oe = (e) => e, E = T.trustedTypes, ke = E ? E.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, Ae = "$lit$", D = `lit$${Math.random().toFixed(9).slice(2)}$`, je = "?" + D, Me = `<${je}>`, O = document, k = () => O.createComment(""), A = (e) => e === null || typeof e != "object" && typeof e != "function", j = Array.isArray, Ne = (e) => j(e) || typeof e?.[Symbol.iterator] == "function", M = "[ \n\f\r]", N = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Pe = /-->/g, Fe = />/g, P = RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), Ie = /'/g, Le = /"/g, Re = /^(?:script|style|textarea|title)$/i, F = ((e) => (t, ...n) => ({
|
|
748
|
+
_$litType$: e,
|
|
749
|
+
strings: t,
|
|
750
|
+
values: n
|
|
751
|
+
}))(1), I = Symbol.for("lit-noChange"), L = Symbol.for("lit-nothing"), ze = /* @__PURE__ */ new WeakMap(), R = O.createTreeWalker(O, 129);
|
|
752
|
+
function Be(e, t) {
|
|
753
|
+
if (!j(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
754
|
+
return ke === void 0 ? t : ke.createHTML(t);
|
|
755
|
+
}
|
|
756
|
+
var Ve = (e, t) => {
|
|
757
|
+
let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = N;
|
|
758
|
+
for (let t = 0; t < n; t++) {
|
|
759
|
+
let n = e[t], s, c, l = -1, u = 0;
|
|
760
|
+
for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === N ? c[1] === "!--" ? o = Pe : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = P) : (Re.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = P) : o = Fe : o === P ? c[0] === ">" ? (o = i ?? N, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? P : c[3] === "\"" ? Le : Ie) : o === Le || o === Ie ? o = P : o === Pe || o === Fe ? o = N : (o = P, i = void 0);
|
|
761
|
+
let d = o === P && e[t + 1].startsWith("/>") ? " " : "";
|
|
762
|
+
a += o === N ? n + Me : l >= 0 ? (r.push(s), n.slice(0, l) + Ae + n.slice(l) + D + d) : n + D + (l === -2 ? t : d);
|
|
763
|
+
}
|
|
764
|
+
return [Be(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
765
|
+
}, z = class e {
|
|
766
|
+
constructor({ strings: t, _$litType$: n }, r) {
|
|
767
|
+
let i;
|
|
768
|
+
this.parts = [];
|
|
769
|
+
let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = Ve(t, n);
|
|
770
|
+
if (this.el = e.createElement(l, r), R.currentNode = this.el.content, n === 2 || n === 3) {
|
|
771
|
+
let e = this.el.content.firstChild;
|
|
772
|
+
e.replaceWith(...e.childNodes);
|
|
773
|
+
}
|
|
774
|
+
for (; (i = R.nextNode()) !== null && c.length < s;) {
|
|
775
|
+
if (i.nodeType === 1) {
|
|
776
|
+
if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(Ae)) {
|
|
777
|
+
let t = u[o++], n = i.getAttribute(e).split(D), r = /([.?@])?(.*)/.exec(t);
|
|
778
|
+
c.push({
|
|
779
|
+
type: 1,
|
|
780
|
+
index: a,
|
|
781
|
+
name: r[2],
|
|
782
|
+
strings: n,
|
|
783
|
+
ctor: r[1] === "." ? Ue : r[1] === "?" ? We : r[1] === "@" ? Ge : H
|
|
784
|
+
}), i.removeAttribute(e);
|
|
785
|
+
} else e.startsWith(D) && (c.push({
|
|
786
|
+
type: 6,
|
|
787
|
+
index: a
|
|
788
|
+
}), i.removeAttribute(e));
|
|
789
|
+
if (Re.test(i.tagName)) {
|
|
790
|
+
let e = i.textContent.split(D), t = e.length - 1;
|
|
791
|
+
if (t > 0) {
|
|
792
|
+
i.textContent = E ? E.emptyScript : "";
|
|
793
|
+
for (let n = 0; n < t; n++) i.append(e[n], k()), R.nextNode(), c.push({
|
|
794
|
+
type: 2,
|
|
795
|
+
index: ++a
|
|
796
|
+
});
|
|
797
|
+
i.append(e[t], k());
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
} else if (i.nodeType === 8) if (i.data === je) c.push({
|
|
801
|
+
type: 2,
|
|
802
|
+
index: a
|
|
803
|
+
});
|
|
804
|
+
else {
|
|
805
|
+
let e = -1;
|
|
806
|
+
for (; (e = i.data.indexOf(D, e + 1)) !== -1;) c.push({
|
|
807
|
+
type: 7,
|
|
808
|
+
index: a
|
|
809
|
+
}), e += D.length - 1;
|
|
810
|
+
}
|
|
811
|
+
a++;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
static createElement(e, t) {
|
|
815
|
+
let n = O.createElement("template");
|
|
816
|
+
return n.innerHTML = e, n;
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
function B(e, t, n = e, r) {
|
|
820
|
+
if (t === I) return t;
|
|
821
|
+
let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = A(t) ? void 0 : t._$litDirective$;
|
|
822
|
+
return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = B(e, i._$AS(e, t.values), i, r)), t;
|
|
823
|
+
}
|
|
824
|
+
var He = class {
|
|
825
|
+
constructor(e, t) {
|
|
826
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
827
|
+
}
|
|
828
|
+
get parentNode() {
|
|
829
|
+
return this._$AM.parentNode;
|
|
830
|
+
}
|
|
831
|
+
get _$AU() {
|
|
832
|
+
return this._$AM._$AU;
|
|
833
|
+
}
|
|
834
|
+
u(e) {
|
|
835
|
+
let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? O).importNode(t, !0);
|
|
836
|
+
R.currentNode = r;
|
|
837
|
+
let i = R.nextNode(), a = 0, o = 0, s = n[0];
|
|
838
|
+
for (; s !== void 0;) {
|
|
839
|
+
if (a === s.index) {
|
|
840
|
+
let t;
|
|
841
|
+
s.type === 2 ? t = new V(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new Ke(i, this, e)), this._$AV.push(t), s = n[++o];
|
|
842
|
+
}
|
|
843
|
+
a !== s?.index && (i = R.nextNode(), a++);
|
|
844
|
+
}
|
|
845
|
+
return R.currentNode = O, r;
|
|
846
|
+
}
|
|
847
|
+
p(e) {
|
|
848
|
+
let t = 0;
|
|
849
|
+
for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
|
|
850
|
+
}
|
|
851
|
+
}, V = class e {
|
|
852
|
+
get _$AU() {
|
|
853
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
854
|
+
}
|
|
855
|
+
constructor(e, t, n, r) {
|
|
856
|
+
this.type = 2, this._$AH = L, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
|
|
857
|
+
}
|
|
858
|
+
get parentNode() {
|
|
859
|
+
let e = this._$AA.parentNode, t = this._$AM;
|
|
860
|
+
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
861
|
+
}
|
|
862
|
+
get startNode() {
|
|
863
|
+
return this._$AA;
|
|
864
|
+
}
|
|
865
|
+
get endNode() {
|
|
866
|
+
return this._$AB;
|
|
867
|
+
}
|
|
868
|
+
_$AI(e, t = this) {
|
|
869
|
+
e = B(this, e, t), A(e) ? e === L || e == null || e === "" ? (this._$AH !== L && this._$AR(), this._$AH = L) : e !== this._$AH && e !== I && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? Ne(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
|
|
870
|
+
}
|
|
871
|
+
O(e) {
|
|
872
|
+
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
873
|
+
}
|
|
874
|
+
T(e) {
|
|
875
|
+
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
876
|
+
}
|
|
877
|
+
_(e) {
|
|
878
|
+
this._$AH !== L && A(this._$AH) ? this._$AA.nextSibling.data = e : this.T(O.createTextNode(e)), this._$AH = e;
|
|
879
|
+
}
|
|
880
|
+
$(e) {
|
|
881
|
+
let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = z.createElement(Be(n.h, n.h[0]), this.options)), n);
|
|
882
|
+
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
883
|
+
else {
|
|
884
|
+
let e = new He(r, this), n = e.u(this.options);
|
|
885
|
+
e.p(t), this.T(n), this._$AH = e;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
_$AC(e) {
|
|
889
|
+
let t = ze.get(e.strings);
|
|
890
|
+
return t === void 0 && ze.set(e.strings, t = new z(e)), t;
|
|
891
|
+
}
|
|
892
|
+
k(t) {
|
|
893
|
+
j(this._$AH) || (this._$AH = [], this._$AR());
|
|
894
|
+
let n = this._$AH, r, i = 0;
|
|
895
|
+
for (let a of t) i === n.length ? n.push(r = new e(this.O(k()), this.O(k()), this, this.options)) : r = n[i], r._$AI(a), i++;
|
|
896
|
+
i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
|
|
897
|
+
}
|
|
898
|
+
_$AR(e = this._$AA.nextSibling, t) {
|
|
899
|
+
for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
|
|
900
|
+
let t = Oe(e).nextSibling;
|
|
901
|
+
Oe(e).remove(), e = t;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
setConnected(e) {
|
|
905
|
+
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
906
|
+
}
|
|
907
|
+
}, H = class {
|
|
908
|
+
get tagName() {
|
|
909
|
+
return this.element.tagName;
|
|
910
|
+
}
|
|
911
|
+
get _$AU() {
|
|
912
|
+
return this._$AM._$AU;
|
|
913
|
+
}
|
|
914
|
+
constructor(e, t, n, r, i) {
|
|
915
|
+
this.type = 1, this._$AH = L, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = L;
|
|
916
|
+
}
|
|
917
|
+
_$AI(e, t = this, n, r) {
|
|
918
|
+
let i = this.strings, a = !1;
|
|
919
|
+
if (i === void 0) e = B(this, e, t, 0), a = !A(e) || e !== this._$AH && e !== I, a && (this._$AH = e);
|
|
920
|
+
else {
|
|
921
|
+
let r = e, o, s;
|
|
922
|
+
for (e = i[0], o = 0; o < i.length - 1; o++) s = B(this, r[n + o], t, o), s === I && (s = this._$AH[o]), a ||= !A(s) || s !== this._$AH[o], s === L ? e = L : e !== L && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
|
|
923
|
+
}
|
|
924
|
+
a && !r && this.j(e);
|
|
925
|
+
}
|
|
926
|
+
j(e) {
|
|
927
|
+
e === L ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
928
|
+
}
|
|
929
|
+
}, Ue = class extends H {
|
|
930
|
+
constructor() {
|
|
931
|
+
super(...arguments), this.type = 3;
|
|
932
|
+
}
|
|
933
|
+
j(e) {
|
|
934
|
+
this.element[this.name] = e === L ? void 0 : e;
|
|
935
|
+
}
|
|
936
|
+
}, We = class extends H {
|
|
937
|
+
constructor() {
|
|
938
|
+
super(...arguments), this.type = 4;
|
|
939
|
+
}
|
|
940
|
+
j(e) {
|
|
941
|
+
this.element.toggleAttribute(this.name, !!e && e !== L);
|
|
942
|
+
}
|
|
943
|
+
}, Ge = class extends H {
|
|
944
|
+
constructor(e, t, n, r, i) {
|
|
945
|
+
super(e, t, n, r, i), this.type = 5;
|
|
946
|
+
}
|
|
947
|
+
_$AI(e, t = this) {
|
|
948
|
+
if ((e = B(this, e, t, 0) ?? L) === I) return;
|
|
949
|
+
let n = this._$AH, r = e === L && n !== L || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== L && (n === L || r);
|
|
950
|
+
r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
951
|
+
}
|
|
952
|
+
handleEvent(e) {
|
|
953
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
954
|
+
}
|
|
955
|
+
}, Ke = class {
|
|
956
|
+
constructor(e, t, n) {
|
|
957
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
|
|
958
|
+
}
|
|
959
|
+
get _$AU() {
|
|
960
|
+
return this._$AM._$AU;
|
|
961
|
+
}
|
|
962
|
+
_$AI(e) {
|
|
963
|
+
B(this, e);
|
|
964
|
+
}
|
|
965
|
+
}, qe = T.litHtmlPolyfillSupport;
|
|
966
|
+
qe?.(z, V), (T.litHtmlVersions ??= []).push("3.3.2");
|
|
967
|
+
var Je = (e, t, n) => {
|
|
968
|
+
let r = n?.renderBefore ?? t, i = r._$litPart$;
|
|
969
|
+
if (i === void 0) {
|
|
970
|
+
let e = n?.renderBefore ?? null;
|
|
971
|
+
r._$litPart$ = i = new V(t.insertBefore(k(), e), e, void 0, n ?? {});
|
|
972
|
+
}
|
|
973
|
+
return i._$AI(e), i;
|
|
974
|
+
}, U = globalThis, W = class extends w {
|
|
975
|
+
constructor() {
|
|
976
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
977
|
+
}
|
|
978
|
+
createRenderRoot() {
|
|
979
|
+
let e = super.createRenderRoot();
|
|
980
|
+
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
981
|
+
}
|
|
982
|
+
update(e) {
|
|
983
|
+
let t = this.render();
|
|
984
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Je(t, this.renderRoot, this.renderOptions);
|
|
985
|
+
}
|
|
986
|
+
connectedCallback() {
|
|
987
|
+
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
988
|
+
}
|
|
989
|
+
disconnectedCallback() {
|
|
990
|
+
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
991
|
+
}
|
|
992
|
+
render() {
|
|
993
|
+
return I;
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
W._$litElement$ = !0, W.finalized = !0, U.litElementHydrateSupport?.({ LitElement: W });
|
|
997
|
+
var Ye = U.litElementPolyfillSupport;
|
|
998
|
+
Ye?.({ LitElement: W }), (U.litElementVersions ??= []).push("4.2.2");
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region node_modules/@lit/reactive-element/decorators/custom-element.js
|
|
1001
|
+
var Xe = (e) => (t, n) => {
|
|
1002
|
+
n === void 0 ? customElements.define(e, t) : n.addInitializer(() => {
|
|
1003
|
+
customElements.define(e, t);
|
|
1004
|
+
});
|
|
1005
|
+
}, Ze = {
|
|
1006
|
+
attribute: !0,
|
|
1007
|
+
type: String,
|
|
1008
|
+
converter: S,
|
|
1009
|
+
reflect: !1,
|
|
1010
|
+
hasChanged: C
|
|
1011
|
+
}, Qe = (e = Ze, t, n) => {
|
|
1012
|
+
let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
|
|
1013
|
+
if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
|
|
1014
|
+
let { name: r } = n;
|
|
1015
|
+
return {
|
|
1016
|
+
set(n) {
|
|
1017
|
+
let i = t.get.call(this);
|
|
1018
|
+
t.set.call(this, n), this.requestUpdate(r, i, e, !0, n);
|
|
1019
|
+
},
|
|
1020
|
+
init(t) {
|
|
1021
|
+
return t !== void 0 && this.C(r, void 0, e, t), t;
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
if (r === "setter") {
|
|
1026
|
+
let { name: r } = n;
|
|
1027
|
+
return function(n) {
|
|
1028
|
+
let i = this[r];
|
|
1029
|
+
t.call(this, n), this.requestUpdate(r, i, e, !0, n);
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
throw Error("Unsupported decorator location: " + r);
|
|
1033
|
+
};
|
|
1034
|
+
function $e(e) {
|
|
1035
|
+
return (t, n) => typeof n == "object" ? Qe(e, t, n) : ((e, t, n) => {
|
|
1036
|
+
let r = t.hasOwnProperty(n);
|
|
1037
|
+
return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0;
|
|
1038
|
+
})(e, t, n);
|
|
1039
|
+
}
|
|
1040
|
+
//#endregion
|
|
1041
|
+
//#region node_modules/@lit/reactive-element/decorators/state.js
|
|
1042
|
+
function G(e) {
|
|
1043
|
+
return $e({
|
|
1044
|
+
...e,
|
|
1045
|
+
state: !0,
|
|
1046
|
+
attribute: !1
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region node_modules/@lit/reactive-element/decorators/base.js
|
|
1051
|
+
var et = (e, t, n) => (n.configurable = !0, n.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(e, t, n), n);
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region node_modules/@lit/reactive-element/decorators/query.js
|
|
1054
|
+
function tt(e, t) {
|
|
1055
|
+
return (n, r, i) => {
|
|
1056
|
+
let a = (t) => t.renderRoot?.querySelector(e) ?? null;
|
|
1057
|
+
if (t) {
|
|
1058
|
+
let { get: e, set: t } = typeof r == "object" ? n : i ?? (() => {
|
|
1059
|
+
let e = Symbol();
|
|
1060
|
+
return {
|
|
1061
|
+
get() {
|
|
1062
|
+
return this[e];
|
|
1063
|
+
},
|
|
1064
|
+
set(t) {
|
|
1065
|
+
this[e] = t;
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
})();
|
|
1069
|
+
return et(n, r, { get() {
|
|
1070
|
+
let n = e.call(this);
|
|
1071
|
+
return n === void 0 && (n = a(this), (n !== null || this.hasUpdated) && t.call(this, n)), n;
|
|
1072
|
+
} });
|
|
1073
|
+
}
|
|
1074
|
+
return et(n, r, { get() {
|
|
1075
|
+
return a(this);
|
|
1076
|
+
} });
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
//#endregion
|
|
1080
|
+
//#region node_modules/lit-html/directive.js
|
|
1081
|
+
var nt = {
|
|
1082
|
+
ATTRIBUTE: 1,
|
|
1083
|
+
CHILD: 2,
|
|
1084
|
+
PROPERTY: 3,
|
|
1085
|
+
BOOLEAN_ATTRIBUTE: 4,
|
|
1086
|
+
EVENT: 5,
|
|
1087
|
+
ELEMENT: 6
|
|
1088
|
+
}, rt = (e) => (...t) => ({
|
|
1089
|
+
_$litDirective$: e,
|
|
1090
|
+
values: t
|
|
1091
|
+
}), it = class {
|
|
1092
|
+
constructor(e) {}
|
|
1093
|
+
get _$AU() {
|
|
1094
|
+
return this._$AM._$AU;
|
|
1095
|
+
}
|
|
1096
|
+
_$AT(e, t, n) {
|
|
1097
|
+
this._$Ct = e, this._$AM = t, this._$Ci = n;
|
|
1098
|
+
}
|
|
1099
|
+
_$AS(e, t) {
|
|
1100
|
+
return this.update(e, t);
|
|
1101
|
+
}
|
|
1102
|
+
update(e, t) {
|
|
1103
|
+
return this.render(...t);
|
|
1104
|
+
}
|
|
1105
|
+
}, K = class extends it {
|
|
1106
|
+
constructor(e) {
|
|
1107
|
+
if (super(e), this.it = L, e.type !== nt.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
1108
|
+
}
|
|
1109
|
+
render(e) {
|
|
1110
|
+
if (e === L || e == null) return this._t = void 0, this.it = e;
|
|
1111
|
+
if (e === I) return e;
|
|
1112
|
+
if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
1113
|
+
if (e === this.it) return this._t;
|
|
1114
|
+
this.it = e;
|
|
1115
|
+
let t = [e];
|
|
1116
|
+
return t.raw = t, this._t = {
|
|
1117
|
+
_$litType$: this.constructor.resultType,
|
|
1118
|
+
strings: t,
|
|
1119
|
+
values: []
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
K.directiveName = "unsafeHTML", K.resultType = 1;
|
|
1124
|
+
var at = rt(K), q = (e) => F`${at(`
|
|
1125
|
+
<svg
|
|
1126
|
+
viewBox="0 0 24 24"
|
|
1127
|
+
fill="none"
|
|
1128
|
+
stroke="currentColor"
|
|
1129
|
+
stroke-width="2"
|
|
1130
|
+
stroke-linecap="round"
|
|
1131
|
+
stroke-linejoin="round"
|
|
1132
|
+
>
|
|
1133
|
+
${e}
|
|
1134
|
+
</svg>
|
|
1135
|
+
`)}`, J = {
|
|
1136
|
+
accessibility: q("<circle cx=\"12\" cy=\"12\" r=\"10\" stroke-width=\"1.5\" stroke-dasharray=\"3 3\" stroke-linecap=\"butt\"/><circle cx=\"12\" cy=\"5\" r=\"1.5\"/><path d=\"M12 7v5\"/><path d=\"M6 8h12\"/><path d=\"M12 12l-3 5\"/><path d=\"M12 12l3 5\"/>"),
|
|
1137
|
+
mic: q("<path d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"/><path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/><line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"23\"/><line x1=\"8\" y1=\"23\" x2=\"16\" y2=\"23\"/>"),
|
|
1138
|
+
close: q("<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>"),
|
|
1139
|
+
languages: q("<path d=\"m5 8 6 6\"/><path d=\"m4 14 6-6 2-3\"/><path d=\"M2 5h12\"/><path d=\"M7 2h1\"/><path d=\"m22 22-5-10-5 10\"/><path d=\"M14 18h6\"/>"),
|
|
1140
|
+
profiles: q("<path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\"/><circle cx=\"12\" cy=\"7\" r=\"4\"/>"),
|
|
1141
|
+
textSize: q("<polyline points=\"4 7 4 4 20 4 20 7\"/><line x1=\"9\" y1=\"20\" x2=\"15\" y2=\"20\"/><line x1=\"12\" y1=\"4\" x2=\"12\" y2=\"20\"/>"),
|
|
1142
|
+
contrast: q("<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 18a6 6 0 0 0 0-12v12z\"/>"),
|
|
1143
|
+
grayscale: q("<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 2v20\"/><path d=\"M12 18a6 6 0 0 0 0-12\"/><path d=\"M12 14a2 2 0 0 0 0-4\"/>"),
|
|
1144
|
+
cursor: q("<path d=\"M4 4l11.73 4.58a0.5 0 0 1 0 0.94l-4.47 1.35 1.35 4.47a0.5 0 0 1-0.94 0L6.7 9.61 4 4z\"/>"),
|
|
1145
|
+
screenReader: q("<polygon points=\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"/><path d=\"M15.54 8.46a5 5 0 0 1 0 7.07\"/><path d=\"M19.07 4.93a10 10 0 0 1 0 14.14\"/>"),
|
|
1146
|
+
visualImpair: q("<path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>"),
|
|
1147
|
+
seizureSafe: q("<path d=\"M13 2L3 14h9l-1 8 10-12h-9l1-8z\"/>"),
|
|
1148
|
+
cognitive: q("<path d=\"M9.5 2A2.5 2.5 0 0 1 12 4.5v15a2.5 2.5 0 0 1-4.96.44 2.5 2.5 0 0 1-2.96-3.08 3 3 0 0 1-.34-5.58 2.5 2.5 0 0 1 1.32-4.24 2.5 2.5 0 0 1 4.44-2.54z\"/><path d=\"M14.5 2A2.5 2.5 0 0 0 12 4.5v15a2.5 2.5 0 0 0 4.96.44 2.5 2.5 0 0 0 2.96-3.08 3 3 0 0 0 .34-5.58 2.5 2.5 0 0 0-1.32-4.24 2.5 2.5 0 0 0-4.44-2.54z\"/>"),
|
|
1149
|
+
info: q("<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 16v-4\"/><path d=\"M12 8h.01\"/>"),
|
|
1150
|
+
check: q("<path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"/><polyline points=\"22 4 12 14.01 9 11.01\"/>"),
|
|
1151
|
+
chevronDown: q("<path d=\"m6 9 6 6 6-6\"/>"),
|
|
1152
|
+
sun: q("<circle cx=\"12\" cy=\"12\" r=\"4\"/><path d=\"M12 2v2\"/><path d=\"M12 20v2\"/><path d=\"m4.93 4.93 1.41 1.41\"/><path d=\"m17.66 17.66 1.41 1.41\"/><path d=\"M2 12h2\"/><path d=\"M20 12h2\"/><path d=\"m6.34 17.66-1.41 1.41\"/><path d=\"m19.07 4.93-1.41 1.41\"/>"),
|
|
1153
|
+
moon: q("<path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z\"/>"),
|
|
1154
|
+
droplet: q("<path d=\"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5s-3 3.5-3 5.5a7 7 0 0 0 7 7z\"/>"),
|
|
1155
|
+
refresh: q("<path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/><path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\"/><path d=\"M3 21v-5h5\"/>"),
|
|
1156
|
+
send: q("<line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"13\"/><polygon points=\"22 2 15 22 11 13 2 9 22 2\"/>")
|
|
1157
|
+
}, ot = he`
|
|
1158
|
+
:host {
|
|
1159
|
+
display: block;
|
|
1160
|
+
pointer-events: none;
|
|
1161
|
+
user-select: none;
|
|
1162
|
+
|
|
1163
|
+
--bw-primary: #6d28d9;
|
|
1164
|
+
--bw-primary-light: #7c3aed;
|
|
1165
|
+
--bw-primary-fg: #ffffff;
|
|
1166
|
+
--bw-bg: #ffffff;
|
|
1167
|
+
--bw-fg: #0f172a;
|
|
1168
|
+
--bw-fg-muted: #64748b;
|
|
1169
|
+
--bw-border: #e2e8f0;
|
|
1170
|
+
--bw-bg-hover: #f8fafc;
|
|
1171
|
+
--bw-bg-subtle: #f1f5f9;
|
|
1172
|
+
--bw-radius: 14px;
|
|
1173
|
+
--bw-radius-sm: 8px;
|
|
1174
|
+
--bw-shadow-panel: 0 20px 60px -10px rgba(0,0,0,0.18), 0 8px 24px -4px rgba(0,0,0,0.1);
|
|
1175
|
+
|
|
1176
|
+
font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
1177
|
+
font-size: 15px;
|
|
1178
|
+
line-height: 1.5;
|
|
1179
|
+
-webkit-font-smoothing: antialiased;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/* ─── Accessibility themes ─── */
|
|
1183
|
+
:host([data-contrast="high"]) { --bw-bg: #000; --bw-fg: #ff0; --bw-primary: #fff; --bw-border: #fff; --bw-bg-hover: #111; --bw-primary-fg: #000; }
|
|
1184
|
+
:host([data-contrast="light"]) { --bw-bg: #f8fafc; --bw-fg: #64748b; --bw-border: #e2e8f0; }
|
|
1185
|
+
:host([data-text-spacing]) { line-height: var(--bw-line-height) !important; letter-spacing: var(--bw-letter-spacing) !important; }
|
|
1186
|
+
:host([data-dyslexic]) { font-family: "Comic Sans MS", "Comic Neue", sans-serif !important; }
|
|
1187
|
+
:host([data-focus-visualizer]) *:focus-visible { outline: 4px solid #f59e0b !important; outline-offset: 2px !important; }
|
|
1188
|
+
:host([data-cursor-magnifier]) { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z'/%3E%3C/svg%3E"), auto !important; }
|
|
1189
|
+
:host([data-no-animations]) *, :host([data-no-animations]) { transition: none !important; animation: none !important; }
|
|
1190
|
+
:host([data-link-highlight]) a { text-decoration: underline !important; background-color: #fef08a !important; color: #000 !important; padding: 0 2px !important; border-radius: 2px !important; }
|
|
1191
|
+
|
|
1192
|
+
/* ─── Widget container ─── */
|
|
1193
|
+
.widget-container {
|
|
1194
|
+
display: block;
|
|
1195
|
+
pointer-events: none;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/* ─── FAB Trigger ─── */
|
|
1199
|
+
.trigger {
|
|
1200
|
+
position: fixed;
|
|
1201
|
+
bottom: 24px;
|
|
1202
|
+
left: 24px;
|
|
1203
|
+
width: 60px;
|
|
1204
|
+
height: 60px;
|
|
1205
|
+
pointer-events: auto;
|
|
1206
|
+
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
|
|
1207
|
+
z-index: 2147483646;
|
|
1208
|
+
}
|
|
1209
|
+
.trigger:hover { transform: scale(1.08); }
|
|
1210
|
+
|
|
1211
|
+
/* ─── Main Panel ─── */
|
|
1212
|
+
.bw-panel {
|
|
1213
|
+
position: fixed;
|
|
1214
|
+
top: 0;
|
|
1215
|
+
left: 0;
|
|
1216
|
+
width: 360px;
|
|
1217
|
+
max-width: 100vw;
|
|
1218
|
+
height: 100dvh;
|
|
1219
|
+
height: 100vh;
|
|
1220
|
+
background: var(--bw-bg);
|
|
1221
|
+
border-right: 1px solid var(--bw-border);
|
|
1222
|
+
box-shadow: var(--bw-shadow-panel);
|
|
1223
|
+
display: flex;
|
|
1224
|
+
flex-direction: column;
|
|
1225
|
+
pointer-events: auto;
|
|
1226
|
+
z-index: 2147483647;
|
|
1227
|
+
transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
|
|
1228
|
+
will-change: transform, opacity;
|
|
1229
|
+
overflow: hidden;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
.bw-panel.panel-hidden {
|
|
1233
|
+
transform: translateX(-100%);
|
|
1234
|
+
opacity: 0;
|
|
1235
|
+
pointer-events: none;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
.bw-panel.panel-visible ~ .trigger {
|
|
1239
|
+
transform: scale(0);
|
|
1240
|
+
opacity: 0;
|
|
1241
|
+
pointer-events: none;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
/* ─── Header ─── */
|
|
1245
|
+
.bw-header {
|
|
1246
|
+
display: flex;
|
|
1247
|
+
align-items: center;
|
|
1248
|
+
justify-content: space-between;
|
|
1249
|
+
padding: 16px 20px;
|
|
1250
|
+
border-bottom: 1px solid var(--bw-border);
|
|
1251
|
+
flex-shrink: 0;
|
|
1252
|
+
background: var(--bw-bg);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
.header-branding {
|
|
1256
|
+
display: flex;
|
|
1257
|
+
align-items: center;
|
|
1258
|
+
gap: 10px;
|
|
1259
|
+
cursor: pointer;
|
|
1260
|
+
user-select: none;
|
|
1261
|
+
padding: 4px;
|
|
1262
|
+
border-radius: var(--bw-radius-sm);
|
|
1263
|
+
transition: background 0.15s;
|
|
1264
|
+
}
|
|
1265
|
+
.header-branding:active { background: var(--bw-bg-hover); }
|
|
1266
|
+
.header-branding svg { width: 22px; height: 22px; color: var(--bw-primary); }
|
|
1267
|
+
.header-branding-text { display: flex; flex-direction: column; }
|
|
1268
|
+
.header-brand-name { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; color: var(--bw-fg); line-height: 1.1; }
|
|
1269
|
+
.header-brand-sub { font-size: 11px; color: var(--bw-fg-muted); line-height: 1; }
|
|
1270
|
+
|
|
1271
|
+
.close-btn {
|
|
1272
|
+
width: 36px;
|
|
1273
|
+
height: 36px;
|
|
1274
|
+
border: none;
|
|
1275
|
+
background: var(--bw-bg-hover);
|
|
1276
|
+
cursor: pointer;
|
|
1277
|
+
display: flex;
|
|
1278
|
+
align-items: center;
|
|
1279
|
+
justify-content: center;
|
|
1280
|
+
border-radius: 50%;
|
|
1281
|
+
transition: all 0.2s;
|
|
1282
|
+
color: var(--bw-fg-muted);
|
|
1283
|
+
}
|
|
1284
|
+
.close-btn:hover { background: #fee2e2; color: #ef4444; transform: rotate(90deg); }
|
|
1285
|
+
.close-btn svg { width: 18px; height: 18px; }
|
|
1286
|
+
|
|
1287
|
+
/* ─── Segmented Tab Control ─── */
|
|
1288
|
+
.bw-tabs {
|
|
1289
|
+
display: flex;
|
|
1290
|
+
padding: 12px 16px;
|
|
1291
|
+
gap: 6px;
|
|
1292
|
+
flex-shrink: 0;
|
|
1293
|
+
background: var(--bw-bg);
|
|
1294
|
+
border-bottom: 1px solid var(--bw-border);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
.bw-tab {
|
|
1298
|
+
flex: 1;
|
|
1299
|
+
display: flex;
|
|
1300
|
+
align-items: center;
|
|
1301
|
+
justify-content: center;
|
|
1302
|
+
gap: 6px;
|
|
1303
|
+
padding: 10px 8px;
|
|
1304
|
+
border: none;
|
|
1305
|
+
border-radius: var(--bw-radius-sm);
|
|
1306
|
+
background: var(--bw-bg-subtle);
|
|
1307
|
+
color: var(--bw-fg-muted);
|
|
1308
|
+
font-size: 13px;
|
|
1309
|
+
font-weight: 600;
|
|
1310
|
+
cursor: pointer;
|
|
1311
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
1312
|
+
min-height: 40px;
|
|
1313
|
+
white-space: nowrap;
|
|
1314
|
+
}
|
|
1315
|
+
.bw-tab:hover { background: var(--bw-bg-hover); color: var(--bw-fg); }
|
|
1316
|
+
.bw-tab[active] {
|
|
1317
|
+
background: var(--bw-primary);
|
|
1318
|
+
color: white;
|
|
1319
|
+
box-shadow: 0 2px 8px rgba(109, 40, 217, 0.3);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
/* ─── Content area ─── */
|
|
1323
|
+
.bw-content {
|
|
1324
|
+
flex: 1;
|
|
1325
|
+
min-height: 0;
|
|
1326
|
+
display: flex;
|
|
1327
|
+
flex-direction: column;
|
|
1328
|
+
position: relative;
|
|
1329
|
+
overflow: hidden;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
.tab-panel {
|
|
1333
|
+
display: none;
|
|
1334
|
+
flex-direction: column;
|
|
1335
|
+
flex: 1;
|
|
1336
|
+
min-height: 0;
|
|
1337
|
+
overflow: hidden;
|
|
1338
|
+
}
|
|
1339
|
+
.tab-panel[active] { display: flex; }
|
|
1340
|
+
|
|
1341
|
+
/* ─── Footer ─── */
|
|
1342
|
+
.bw-footer {
|
|
1343
|
+
display: flex;
|
|
1344
|
+
align-items: center;
|
|
1345
|
+
justify-content: space-between;
|
|
1346
|
+
padding: 10px 20px;
|
|
1347
|
+
border-top: 1px solid var(--bw-border);
|
|
1348
|
+
flex-shrink: 0;
|
|
1349
|
+
background: var(--bw-bg);
|
|
1350
|
+
}
|
|
1351
|
+
.footer-brand {
|
|
1352
|
+
display: flex;
|
|
1353
|
+
align-items: center;
|
|
1354
|
+
gap: 6px;
|
|
1355
|
+
font-size: 12px;
|
|
1356
|
+
font-weight: 700;
|
|
1357
|
+
color: var(--bw-primary);
|
|
1358
|
+
cursor: pointer;
|
|
1359
|
+
user-select: none;
|
|
1360
|
+
}
|
|
1361
|
+
.footer-brand svg { width: 14px; height: 14px; }
|
|
1362
|
+
.bw-footer span { font-size: 11px; color: var(--bw-fg-muted); }
|
|
1363
|
+
|
|
1364
|
+
/* ════════════════════════════════ */
|
|
1365
|
+
/* CHAT TAB */
|
|
1366
|
+
/* ════════════════════════════════ */
|
|
1367
|
+
|
|
1368
|
+
.chat-messages {
|
|
1369
|
+
flex: 1;
|
|
1370
|
+
overflow-y: auto;
|
|
1371
|
+
padding: 16px;
|
|
1372
|
+
display: flex;
|
|
1373
|
+
flex-direction: column;
|
|
1374
|
+
gap: 10px;
|
|
1375
|
+
min-height: 0;
|
|
1376
|
+
scroll-behavior: smooth;
|
|
1377
|
+
overscroll-behavior-y: contain;
|
|
1378
|
+
scrollbar-width: thin;
|
|
1379
|
+
scrollbar-color: var(--bw-border) transparent;
|
|
1380
|
+
}
|
|
1381
|
+
.chat-messages::-webkit-scrollbar { width: 4px; }
|
|
1382
|
+
.chat-messages::-webkit-scrollbar-thumb { background: var(--bw-border); border-radius: 4px; }
|
|
1383
|
+
|
|
1384
|
+
.chat-empty {
|
|
1385
|
+
flex: 1;
|
|
1386
|
+
display: flex;
|
|
1387
|
+
flex-direction: column;
|
|
1388
|
+
align-items: center;
|
|
1389
|
+
justify-content: center;
|
|
1390
|
+
gap: 12px;
|
|
1391
|
+
padding: 2rem;
|
|
1392
|
+
text-align: center;
|
|
1393
|
+
color: var(--bw-fg-muted);
|
|
1394
|
+
}
|
|
1395
|
+
.chat-empty svg { width: 44px; height: 44px; opacity: 0.35; }
|
|
1396
|
+
.chat-empty-title { font-size: 15px; font-weight: 600; color: var(--bw-fg); margin: 0; }
|
|
1397
|
+
.chat-empty-sub { font-size: 13px; color: var(--bw-fg-muted); margin: 0; line-height: 1.5; }
|
|
1398
|
+
|
|
1399
|
+
.chat-bubble {
|
|
1400
|
+
max-width: 82%;
|
|
1401
|
+
padding: 10px 14px;
|
|
1402
|
+
border-radius: 18px;
|
|
1403
|
+
font-size: 14px;
|
|
1404
|
+
line-height: 1.5;
|
|
1405
|
+
white-space: pre-wrap;
|
|
1406
|
+
word-break: break-word;
|
|
1407
|
+
animation: bubblePop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
1408
|
+
}
|
|
1409
|
+
@keyframes bubblePop { from { opacity: 0; transform: scale(0.9) translateY(4px); } to { opacity: 1; transform: none; } }
|
|
1410
|
+
|
|
1411
|
+
.chat-bubble.user {
|
|
1412
|
+
align-self: flex-end;
|
|
1413
|
+
background: var(--bw-primary);
|
|
1414
|
+
color: white;
|
|
1415
|
+
border-bottom-right-radius: 4px;
|
|
1416
|
+
}
|
|
1417
|
+
.chat-bubble.assistant {
|
|
1418
|
+
align-self: flex-start;
|
|
1419
|
+
background: var(--bw-bg-subtle);
|
|
1420
|
+
color: var(--bw-fg);
|
|
1421
|
+
border-bottom-left-radius: 4px;
|
|
1422
|
+
border: 1px solid var(--bw-border);
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
.screen-label-badge {
|
|
1426
|
+
background: rgba(16, 185, 129, 0.08);
|
|
1427
|
+
border: 1px solid rgba(16, 185, 129, 0.2);
|
|
1428
|
+
border-radius: var(--bw-radius-sm);
|
|
1429
|
+
padding: 6px 12px;
|
|
1430
|
+
font-size: 12px;
|
|
1431
|
+
color: #059669;
|
|
1432
|
+
display: flex;
|
|
1433
|
+
align-items: center;
|
|
1434
|
+
gap: 6px;
|
|
1435
|
+
flex-shrink: 0;
|
|
1436
|
+
}
|
|
1437
|
+
.screen-label-badge svg { width: 12px; height: 12px; flex-shrink: 0; }
|
|
1438
|
+
|
|
1439
|
+
/* System log details */
|
|
1440
|
+
.system-log {
|
|
1441
|
+
background: var(--bw-bg-subtle);
|
|
1442
|
+
border: 1px solid var(--bw-border);
|
|
1443
|
+
border-radius: var(--bw-radius-sm);
|
|
1444
|
+
font-size: 12px;
|
|
1445
|
+
color: var(--bw-fg-muted);
|
|
1446
|
+
overflow: hidden;
|
|
1447
|
+
}
|
|
1448
|
+
.system-log-header {
|
|
1449
|
+
padding: 8px 12px;
|
|
1450
|
+
cursor: pointer;
|
|
1451
|
+
user-select: none;
|
|
1452
|
+
list-style: none;
|
|
1453
|
+
display: flex;
|
|
1454
|
+
align-items: center;
|
|
1455
|
+
gap: 8px;
|
|
1456
|
+
}
|
|
1457
|
+
.system-log-header::-webkit-details-marker { display: none; }
|
|
1458
|
+
.system-log-details { padding: 8px 12px; border-top: 1px solid var(--bw-border); white-space: pre-wrap; word-break: break-all; }
|
|
1459
|
+
|
|
1460
|
+
/* Typing indicator */
|
|
1461
|
+
.typing-indicator {
|
|
1462
|
+
display: flex;
|
|
1463
|
+
align-self: flex-start;
|
|
1464
|
+
gap: 4px;
|
|
1465
|
+
padding: 12px 16px;
|
|
1466
|
+
background: var(--bw-bg-subtle);
|
|
1467
|
+
border: 1px solid var(--bw-border);
|
|
1468
|
+
border-radius: 18px;
|
|
1469
|
+
border-bottom-left-radius: 4px;
|
|
1470
|
+
}
|
|
1471
|
+
.typing-dot {
|
|
1472
|
+
width: 7px;
|
|
1473
|
+
height: 7px;
|
|
1474
|
+
background: var(--bw-fg-muted);
|
|
1475
|
+
border-radius: 50%;
|
|
1476
|
+
animation: typingBounce 1.2s infinite ease-in-out;
|
|
1477
|
+
}
|
|
1478
|
+
.typing-dot:nth-child(1) { animation-delay: 0s; }
|
|
1479
|
+
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
|
|
1480
|
+
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
|
|
1481
|
+
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }
|
|
1482
|
+
|
|
1483
|
+
/* Confirm panel */
|
|
1484
|
+
.confirm-panel {
|
|
1485
|
+
padding: 14px 16px;
|
|
1486
|
+
border-top: 1px solid var(--bw-border);
|
|
1487
|
+
display: flex;
|
|
1488
|
+
flex-direction: column;
|
|
1489
|
+
gap: 8px;
|
|
1490
|
+
flex-shrink: 0;
|
|
1491
|
+
background: var(--bw-bg);
|
|
1492
|
+
}
|
|
1493
|
+
.btn-confirm {
|
|
1494
|
+
width: 100%; min-height: 46px; border-radius: var(--bw-radius-sm);
|
|
1495
|
+
background: var(--bw-primary); color: white; border: none;
|
|
1496
|
+
font-weight: 700; font-size: 14px; cursor: pointer;
|
|
1497
|
+
transition: all 0.2s; box-shadow: 0 4px 12px rgba(109, 40, 217, 0.25);
|
|
1498
|
+
}
|
|
1499
|
+
.btn-confirm:hover { filter: brightness(1.1); transform: translateY(-1px); }
|
|
1500
|
+
.btn-cancel {
|
|
1501
|
+
width: 100%; min-height: 44px; border-radius: var(--bw-radius-sm);
|
|
1502
|
+
background: transparent; color: #ef4444; border: 1px solid #fecaca;
|
|
1503
|
+
font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.2s;
|
|
1504
|
+
}
|
|
1505
|
+
.btn-cancel:hover { background: #fef2f2; }
|
|
1506
|
+
|
|
1507
|
+
/* Chat input area */
|
|
1508
|
+
.chat-input-area {
|
|
1509
|
+
border-top: 1px solid var(--bw-border);
|
|
1510
|
+
display: flex;
|
|
1511
|
+
flex-direction: column;
|
|
1512
|
+
gap: 8px;
|
|
1513
|
+
padding: 12px 14px;
|
|
1514
|
+
flex-shrink: 0;
|
|
1515
|
+
background: var(--bw-bg);
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
.stt-banner {
|
|
1519
|
+
display: flex;
|
|
1520
|
+
align-items: center;
|
|
1521
|
+
gap: 8px;
|
|
1522
|
+
font-size: 12px;
|
|
1523
|
+
padding: 6px 10px;
|
|
1524
|
+
border-radius: var(--bw-radius-sm);
|
|
1525
|
+
}
|
|
1526
|
+
.stt-banner.recording { color: #dc2626; background: rgba(220,38,38,0.08); }
|
|
1527
|
+
.stt-banner.processing { color: #2563eb; background: rgba(37,99,235,0.08); }
|
|
1528
|
+
.stt-banner.error { color: #dc2626; background: rgba(220,38,38,0.06); }
|
|
1529
|
+
|
|
1530
|
+
.chat-input-row {
|
|
1531
|
+
display: flex;
|
|
1532
|
+
align-items: center;
|
|
1533
|
+
gap: 8px;
|
|
1534
|
+
}
|
|
1535
|
+
.chat-input {
|
|
1536
|
+
flex: 1;
|
|
1537
|
+
min-width: 0;
|
|
1538
|
+
height: 38px;
|
|
1539
|
+
padding: 0 14px;
|
|
1540
|
+
border: 1px solid var(--bw-border);
|
|
1541
|
+
border-radius: 999px;
|
|
1542
|
+
font-size: 14px;
|
|
1543
|
+
font-family: inherit;
|
|
1544
|
+
background: var(--bw-bg-subtle);
|
|
1545
|
+
color: var(--bw-fg);
|
|
1546
|
+
outline: none;
|
|
1547
|
+
transition: border-color 0.2s;
|
|
1548
|
+
}
|
|
1549
|
+
.chat-input:focus { border-color: var(--bw-primary); background: var(--bw-bg); }
|
|
1550
|
+
.chat-input:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
1551
|
+
.chat-input::placeholder { color: var(--bw-fg-muted); }
|
|
1552
|
+
|
|
1553
|
+
.chat-icon-btn {
|
|
1554
|
+
flex-shrink: 0;
|
|
1555
|
+
width: 44px;
|
|
1556
|
+
height: 44px;
|
|
1557
|
+
border-radius: 50%;
|
|
1558
|
+
border: 1px solid var(--bw-border);
|
|
1559
|
+
background: var(--bw-bg-subtle);
|
|
1560
|
+
color: var(--bw-fg-muted);
|
|
1561
|
+
cursor: pointer;
|
|
1562
|
+
display: flex;
|
|
1563
|
+
align-items: center;
|
|
1564
|
+
justify-content: center;
|
|
1565
|
+
transition: all 0.18s;
|
|
1566
|
+
font-size: 16px;
|
|
1567
|
+
line-height: 1;
|
|
1568
|
+
}
|
|
1569
|
+
.chat-icon-btn:hover:not(:disabled) { border-color: var(--bw-primary); color: var(--bw-primary); background: var(--bw-bg-hover); }
|
|
1570
|
+
.chat-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
1571
|
+
.chat-icon-btn svg { width: 17px; height: 17px; }
|
|
1572
|
+
|
|
1573
|
+
/* Specialized Mic Button (Accessibility Target) */
|
|
1574
|
+
#bw-voice-btn {
|
|
1575
|
+
width: 56px;
|
|
1576
|
+
height: 56px;
|
|
1577
|
+
background: var(--bw-bg-subtle);
|
|
1578
|
+
border: 2px solid var(--bw-primary);
|
|
1579
|
+
color: var(--bw-primary);
|
|
1580
|
+
margin-right: 12px; /* Physical buffer from send button */
|
|
1581
|
+
}
|
|
1582
|
+
#bw-voice-btn:hover { background: rgba(109, 40, 217, 0.08); transform: scale(1.05); }
|
|
1583
|
+
#bw-voice-btn.recording {
|
|
1584
|
+
background: #fef2f2;
|
|
1585
|
+
border-color: #dc2626;
|
|
1586
|
+
color: #dc2626;
|
|
1587
|
+
animation: micPulse 1.5s infinite;
|
|
1588
|
+
}
|
|
1589
|
+
@keyframes micPulse {
|
|
1590
|
+
0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); transform: scale(1.05); }
|
|
1591
|
+
100% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); transform: scale(1.05); }
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
.chat-icon-btn.tts-on { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.4); color: #059669; }
|
|
1595
|
+
|
|
1596
|
+
.chat-send-btn {
|
|
1597
|
+
flex-shrink: 0;
|
|
1598
|
+
width: 44px;
|
|
1599
|
+
height: 44px;
|
|
1600
|
+
border-radius: 50%;
|
|
1601
|
+
border: none;
|
|
1602
|
+
background: var(--bw-primary);
|
|
1603
|
+
color: white;
|
|
1604
|
+
cursor: pointer;
|
|
1605
|
+
display: flex;
|
|
1606
|
+
align-items: center;
|
|
1607
|
+
justify-content: center;
|
|
1608
|
+
transition: all 0.2s;
|
|
1609
|
+
box-shadow: 0 2px 8px rgba(109,40,217,0.3);
|
|
1610
|
+
margin-left: 6px;
|
|
1611
|
+
}
|
|
1612
|
+
.chat-send-btn:hover:not(:disabled) { transform: scale(1.08); filter: brightness(1.1); }
|
|
1613
|
+
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
|
|
1614
|
+
.chat-send-btn svg { width: 18px; height: 18px; }
|
|
1615
|
+
|
|
1616
|
+
/* ════════════════════════════════ */
|
|
1617
|
+
/* SETTINGS (A11Y) TAB */
|
|
1618
|
+
/* ════════════════════════════════ */
|
|
1619
|
+
|
|
1620
|
+
.a11y-scroller {
|
|
1621
|
+
flex: 1;
|
|
1622
|
+
overflow-y: auto;
|
|
1623
|
+
overscroll-behavior-y: contain;
|
|
1624
|
+
scrollbar-width: thin;
|
|
1625
|
+
scrollbar-color: var(--bw-border) transparent;
|
|
1626
|
+
display: flex;
|
|
1627
|
+
flex-direction: column;
|
|
1628
|
+
gap: 0;
|
|
1629
|
+
min-height: 0;
|
|
1630
|
+
}
|
|
1631
|
+
.a11y-scroller::-webkit-scrollbar { width: 4px; }
|
|
1632
|
+
.a11y-scroller::-webkit-scrollbar-thumb { background: var(--bw-border); border-radius: 4px; }
|
|
1633
|
+
|
|
1634
|
+
/* Settings grid */
|
|
1635
|
+
.settings-grid {
|
|
1636
|
+
display: grid;
|
|
1637
|
+
grid-template-columns: 1fr 1fr;
|
|
1638
|
+
gap: 10px;
|
|
1639
|
+
padding: 14px 14px 0;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
.settings-card {
|
|
1643
|
+
background: var(--bw-bg-subtle);
|
|
1644
|
+
border: 1.5px solid var(--bw-border);
|
|
1645
|
+
border-radius: var(--bw-radius);
|
|
1646
|
+
padding: 0;
|
|
1647
|
+
display: flex;
|
|
1648
|
+
flex-direction: column;
|
|
1649
|
+
align-items: center;
|
|
1650
|
+
justify-content: center;
|
|
1651
|
+
gap: 8px;
|
|
1652
|
+
cursor: pointer;
|
|
1653
|
+
transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
|
|
1654
|
+
position: relative;
|
|
1655
|
+
text-align: center;
|
|
1656
|
+
min-height: 90px;
|
|
1657
|
+
user-select: none;
|
|
1658
|
+
overflow: hidden;
|
|
1659
|
+
}
|
|
1660
|
+
.settings-card:hover { border-color: var(--bw-primary); background: var(--bw-bg); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.07); }
|
|
1661
|
+
.settings-card[active] {
|
|
1662
|
+
border-color: var(--bw-primary);
|
|
1663
|
+
background: rgba(109, 40, 217, 0.06);
|
|
1664
|
+
box-shadow: 0 0 0 1px var(--bw-primary);
|
|
1665
|
+
}
|
|
1666
|
+
.settings-card[active] svg { color: var(--bw-primary); }
|
|
1667
|
+
.settings-card svg { width: 22px; height: 22px; color: var(--bw-fg-muted); transition: color 0.18s; }
|
|
1668
|
+
.settings-card-label { font-size: 12px; font-weight: 600; color: var(--bw-fg); }
|
|
1669
|
+
.settings-card[active] .settings-card-label { color: var(--bw-primary); }
|
|
1670
|
+
.settings-card-value { font-size: 11px; color: var(--bw-fg-muted); font-weight: 500; }
|
|
1671
|
+
|
|
1672
|
+
.active-badge {
|
|
1673
|
+
position: absolute;
|
|
1674
|
+
top: 6px;
|
|
1675
|
+
right: 6px;
|
|
1676
|
+
width: 18px;
|
|
1677
|
+
height: 18px;
|
|
1678
|
+
background: var(--bw-primary);
|
|
1679
|
+
border-radius: 50%;
|
|
1680
|
+
display: flex;
|
|
1681
|
+
align-items: center;
|
|
1682
|
+
justify-content: center;
|
|
1683
|
+
}
|
|
1684
|
+
.active-badge svg { width: 10px; height: 10px; color: white; stroke-width: 3; }
|
|
1685
|
+
|
|
1686
|
+
/* Color section */
|
|
1687
|
+
.color-section {
|
|
1688
|
+
margin: 12px 14px 0;
|
|
1689
|
+
padding: 14px;
|
|
1690
|
+
border: 1.5px solid var(--bw-border);
|
|
1691
|
+
border-radius: var(--bw-radius);
|
|
1692
|
+
background: var(--bw-bg-subtle);
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
.color-section-header {
|
|
1696
|
+
display: flex;
|
|
1697
|
+
align-items: center;
|
|
1698
|
+
gap: 8px;
|
|
1699
|
+
margin-bottom: 12px;
|
|
1700
|
+
}
|
|
1701
|
+
.color-section-header svg { width: 16px; height: 16px; color: var(--bw-primary); }
|
|
1702
|
+
.color-section-title { font-size: 13px; font-weight: 700; color: var(--bw-fg); margin: 0; }
|
|
1703
|
+
|
|
1704
|
+
.color-tabs {
|
|
1705
|
+
display: flex;
|
|
1706
|
+
gap: 6px;
|
|
1707
|
+
margin-bottom: 12px;
|
|
1708
|
+
}
|
|
1709
|
+
.color-tab {
|
|
1710
|
+
flex: 1;
|
|
1711
|
+
border: 1px solid var(--bw-border);
|
|
1712
|
+
border-radius: 6px;
|
|
1713
|
+
padding: 6px 4px;
|
|
1714
|
+
font-size: 11px;
|
|
1715
|
+
font-weight: 600;
|
|
1716
|
+
text-align: center;
|
|
1717
|
+
cursor: pointer;
|
|
1718
|
+
background: var(--bw-bg);
|
|
1719
|
+
color: var(--bw-fg-muted);
|
|
1720
|
+
transition: all 0.15s;
|
|
1721
|
+
}
|
|
1722
|
+
.color-tab[active] { background: var(--bw-primary); color: white; border-color: var(--bw-primary); }
|
|
1723
|
+
|
|
1724
|
+
.hue-row {
|
|
1725
|
+
display: flex;
|
|
1726
|
+
align-items: center;
|
|
1727
|
+
gap: 10px;
|
|
1728
|
+
}
|
|
1729
|
+
.hue-step-btn {
|
|
1730
|
+
width: 32px; height: 32px; border: 1px solid var(--bw-border);
|
|
1731
|
+
border-radius: 50%; background: var(--bw-bg); cursor: pointer;
|
|
1732
|
+
display: flex; align-items: center; justify-content: center;
|
|
1733
|
+
font-size: 18px; font-weight: 700; color: var(--bw-fg); flex-shrink: 0;
|
|
1734
|
+
transition: all 0.15s;
|
|
1735
|
+
}
|
|
1736
|
+
.hue-step-btn:hover { border-color: var(--bw-primary); color: var(--bw-primary); }
|
|
1737
|
+
.hue-slider {
|
|
1738
|
+
flex: 1; height: 8px; border-radius: 4px; -webkit-appearance: none;
|
|
1739
|
+
background: linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red);
|
|
1740
|
+
cursor: pointer; outline: none; border: none;
|
|
1741
|
+
}
|
|
1742
|
+
.hue-slider::-webkit-slider-thumb {
|
|
1743
|
+
-webkit-appearance: none; width: 20px; height: 20px;
|
|
1744
|
+
background: white; border: 2.5px solid var(--bw-primary);
|
|
1745
|
+
border-radius: 50%; cursor: pointer;
|
|
1746
|
+
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
/* AI Tools section */
|
|
1750
|
+
.ai-tools-section {
|
|
1751
|
+
margin: 12px 14px 14px;
|
|
1752
|
+
display: flex;
|
|
1753
|
+
flex-direction: column;
|
|
1754
|
+
gap: 8px;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
.trigger svg {
|
|
1758
|
+
width: 28px;
|
|
1759
|
+
height: 28px;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
.ai-tool-btn {
|
|
1763
|
+
width: 100%;
|
|
1764
|
+
padding: 12px 16px;
|
|
1765
|
+
border-radius: var(--bw-radius-sm);
|
|
1766
|
+
border: 1.5px solid var(--bw-border);
|
|
1767
|
+
background: var(--bw-bg);
|
|
1768
|
+
color: var(--bw-fg);
|
|
1769
|
+
font-size: 13px;
|
|
1770
|
+
font-weight: 600;
|
|
1771
|
+
cursor: pointer;
|
|
1772
|
+
display: flex;
|
|
1773
|
+
align-items: center;
|
|
1774
|
+
gap: 10px;
|
|
1775
|
+
transition: all 0.18s;
|
|
1776
|
+
text-align: left;
|
|
1777
|
+
min-height: 46px;
|
|
1778
|
+
}
|
|
1779
|
+
.ai-tool-btn:hover { border-color: var(--bw-primary); color: var(--bw-primary); background: rgba(109,40,217,0.04); }
|
|
1780
|
+
.ai-tool-btn.active { background: rgba(109,40,217,0.08); border-color: var(--bw-primary); color: var(--bw-primary); }
|
|
1781
|
+
.ai-tool-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
|
|
1782
|
+
.ai-tool-btn-label { flex: 1; }
|
|
1783
|
+
.ai-tool-badge { font-size: 10px; background: var(--bw-primary); color: white; padding: 2px 7px; border-radius: 99px; font-weight: 700; }
|
|
1784
|
+
.ai-tool-badge.on { background: #059669; }
|
|
1785
|
+
|
|
1786
|
+
/* ════════════════════════════════ */
|
|
1787
|
+
/* ADMIN PANEL */
|
|
1788
|
+
/* ════════════════════════════════ */
|
|
1789
|
+
.admin-overlay {
|
|
1790
|
+
position: absolute;
|
|
1791
|
+
inset: 0;
|
|
1792
|
+
background: var(--bw-bg);
|
|
1793
|
+
z-index: 50;
|
|
1794
|
+
display: flex;
|
|
1795
|
+
flex-direction: column;
|
|
1796
|
+
align-items: center;
|
|
1797
|
+
justify-content: center;
|
|
1798
|
+
padding: 32px 24px;
|
|
1799
|
+
text-align: center;
|
|
1800
|
+
animation: adminFadeIn 0.25s ease;
|
|
1801
|
+
}
|
|
1802
|
+
@keyframes adminFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
|
|
1803
|
+
|
|
1804
|
+
.admin-overlay .admin-icon { font-size: 32px; margin-bottom: 12px; }
|
|
1805
|
+
.admin-overlay h4 { font-size: 17px; font-weight: 700; margin: 0 0 6px; color: var(--bw-fg); }
|
|
1806
|
+
.admin-overlay p { font-size: 13px; color: var(--bw-fg-muted); margin: 0 0 20px; }
|
|
1807
|
+
.admin-overlay input {
|
|
1808
|
+
width: 100%; padding: 12px 14px; border-radius: var(--bw-radius-sm);
|
|
1809
|
+
border: 1.5px solid var(--bw-border); background: var(--bw-bg-subtle);
|
|
1810
|
+
color: var(--bw-fg); font-size: 14px; outline: none; margin-bottom: 10px;
|
|
1811
|
+
transition: border-color 0.2s;
|
|
1812
|
+
}
|
|
1813
|
+
.admin-overlay input:focus { border-color: var(--bw-primary); }
|
|
1814
|
+
.admin-login-btn {
|
|
1815
|
+
width: 100%; padding: 12px; border-radius: var(--bw-radius-sm);
|
|
1816
|
+
background: var(--bw-primary); color: white; border: none;
|
|
1817
|
+
font-weight: 700; font-size: 14px; cursor: pointer; margin-bottom: 8px;
|
|
1818
|
+
transition: all 0.2s;
|
|
1819
|
+
}
|
|
1820
|
+
.admin-login-btn:hover { filter: brightness(1.1); }
|
|
1821
|
+
.admin-logout-btn {
|
|
1822
|
+
width: 100%; padding: 12px; border-radius: var(--bw-radius-sm);
|
|
1823
|
+
background: #fef2f2; color: #ef4444; border: 1px solid #fecaca;
|
|
1824
|
+
font-weight: 600; font-size: 14px; cursor: pointer; margin-bottom: 8px;
|
|
1825
|
+
transition: all 0.2s;
|
|
1826
|
+
}
|
|
1827
|
+
.admin-logout-btn:hover { background: #fee2e2; }
|
|
1828
|
+
.admin-close-btn {
|
|
1829
|
+
background: none; border: none; color: var(--bw-fg-muted);
|
|
1830
|
+
font-size: 13px; cursor: pointer; padding: 6px; text-decoration: underline;
|
|
1831
|
+
margin-top: 4px;
|
|
1832
|
+
}
|
|
1833
|
+
.auth-error { color: #ef4444; font-size: 12px; margin: 0 0 12px; }
|
|
1834
|
+
.admin-status { color: #059669; font-size: 14px; font-weight: 600; margin: 0 0 16px; }
|
|
1835
|
+
`, st = "bw-a11y-settings-v2", Y = {
|
|
1836
|
+
monochrome: !1,
|
|
1837
|
+
darkHighContrast: !1,
|
|
1838
|
+
brightHighContrast: !1,
|
|
1839
|
+
lowSaturation: !1,
|
|
1840
|
+
highSaturation: !1,
|
|
1841
|
+
contrastMode: !1,
|
|
1842
|
+
customBgHue: null,
|
|
1843
|
+
customHeaderHue: null,
|
|
1844
|
+
customContentHue: null,
|
|
1845
|
+
activeColorTab: "background",
|
|
1846
|
+
textScale: 1,
|
|
1847
|
+
highlightHeaders: !1,
|
|
1848
|
+
enlargeButtons: !1,
|
|
1849
|
+
textSpacing: !1,
|
|
1850
|
+
dyslexicFont: !1,
|
|
1851
|
+
focusVisualizer: !1,
|
|
1852
|
+
cursorMagnifier: !1,
|
|
1853
|
+
animationsDisabled: !1,
|
|
1854
|
+
linkHighlight: !1
|
|
1855
|
+
}, ct = class {
|
|
1856
|
+
constructor(e) {
|
|
1857
|
+
this.settings = { ...Y }, (this.host = e).addController(this), this._loadSettings();
|
|
1858
|
+
}
|
|
1859
|
+
hostConnected() {
|
|
1860
|
+
this._applySettings();
|
|
1861
|
+
}
|
|
1862
|
+
_loadSettings() {
|
|
1863
|
+
let e = localStorage.getItem(st);
|
|
1864
|
+
if (e) try {
|
|
1865
|
+
let t = JSON.parse(e);
|
|
1866
|
+
this.settings = {
|
|
1867
|
+
...Y,
|
|
1868
|
+
...t
|
|
1869
|
+
};
|
|
1870
|
+
} catch (e) {
|
|
1871
|
+
console.error("BariWeb: Failed to parse a11y settings", e);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
_saveSettings() {
|
|
1875
|
+
localStorage.setItem(st, JSON.stringify(this.settings)), this._applySettings(), this.host.requestUpdate();
|
|
1876
|
+
}
|
|
1877
|
+
_ensureGlobalStyles() {
|
|
1878
|
+
let e = "bw-global-a11y-styles", t = document.getElementById(e);
|
|
1879
|
+
t || (t = document.createElement("style"), t.id = e, document.head.appendChild(t)), t.textContent = "\n /* Global Filters */\n html {\n filter: \n grayscale(var(--bw-grayscale, 0%)) \n saturate(var(--bw-saturation, 1)) !important;\n transition: filter 0.3s ease;\n }\n\n /* Text Spacing */\n html[data-bw-text-spacing], html[data-bw-text-spacing] * {\n line-height: 1.8 !important;\n letter-spacing: 0.12em !important;\n word-spacing: 0.16em !important;\n }\n\n /* Dyslexic Font */\n html[data-bw-dyslexic], html[data-bw-dyslexic] * {\n font-family: \"OpenDyslexic\", \"Comic Sans MS\", \"Chalkboard SE\", sans-serif !important;\n }\n\n /* Focus Visualizer (Read Focus) - More distinctive */\n html[data-bw-focus-visualizer] *:focus,\n html[data-bw-focus-visualizer] *:focus-visible {\n outline: 8px solid #3b82f6 !important;\n outline-offset: 4px !important;\n box-shadow: 0 0 0 12px rgba(59, 130, 246, 0.4) !important;\n z-index: 99999 !important;\n position: relative;\n }\n html[data-bw-focus-visualizer] *:hover {\n outline: 2px solid rgba(59, 130, 246, 0.3) !important;\n outline-offset: 2px !important;\n }\n\n /* Cursor Magnifier - Standing out */\n html[data-bw-cursor-magnifier], html[data-bw-cursor-magnifier] * {\n cursor: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 24 24' fill='%233b82f6' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z'%3E%3C/path%3E%3Cpath d='M13 13l6 6'%3E%3C/path%3E%3C/svg%3E\") 0 0, auto !important;\n }\n\n /* Link Highlight */\n html[data-bw-link-highlight] a {\n text-decoration: underline !important;\n text-decoration-thickness: 3px !important;\n background-color: #fef08a !important;\n color: #000000 !important;\n padding: 0 4px !important;\n border-radius: 4px !important;\n font-weight: bold !important;\n }\n\n /* Highlight Headers */\n html[data-bw-highlight-headers] h1,\n html[data-bw-highlight-headers] h2,\n html[data-bw-highlight-headers] h3,\n html[data-bw-highlight-headers] h4,\n html[data-bw-highlight-headers] h5,\n html[data-bw-highlight-headers] h6 {\n background-color: #3b82f6 !important;\n color: #ffffff !important;\n padding: 4px 8px !important;\n border-radius: 4px !important;\n display: inline-block !important;\n }\n\n /* Enlarge Buttons */\n html[data-bw-enlarge-buttons] button,\n html[data-bw-enlarge-buttons] [role=\"button\"],\n html[data-bw-enlarge-buttons] input[type=\"button\"],\n html[data-bw-enlarge-buttons] input[type=\"submit\"] {\n transform: scale(1.2) !important;\n margin: 10px !important;\n }\n\n /* Stop Animations */\n html[data-bw-no-animations], html[data-bw-no-animations] * {\n transition: none !important;\n animation: none !important;\n scroll-behavior: auto !important;\n }\n\n /* --- High Contrast Modes --- */\n \n /* Dark High Contrast */\n html[data-bw-dark-high-contrast], \n html[data-bw-dark-high-contrast] body,\n html[data-bw-dark-high-contrast] *:not(bw-widget):not(bw-widget *) {\n background-color: #000000 !important;\n color: #00ff00 !important; /* High-Visibility Green on Black */\n border-color: #00ff00 !important;\n background-image: none !important;\n }\n html[data-bw-dark-high-contrast] a { color: #ffff00 !important; }\n\n /* Bright High Contrast */\n html[data-bw-bright-high-contrast], \n html[data-bw-bright-high-contrast] body,\n html[data-bw-bright-high-contrast] *:not(bw-widget):not(bw-widget *) {\n background-color: #ffffff !important;\n color: #000000 !important;\n border-color: #000000 !important;\n background-image: none !important;\n }\n html[data-bw-bright-high-contrast] a { color: #0000ff !important; font-weight: bold !important; }\n\n /* Contrast Mode (Classic) */\n html[data-bw-contrast-mode], \n html[data-bw-contrast-mode] body,\n html[data-bw-contrast-mode] *:not(bw-widget):not(bw-widget *) {\n background-color: #000 !important;\n color: #fff !important;\n border-color: #fff !important;\n }\n\n /* --- Custom Colors --- */\n html[data-bw-has-custom-bg] body,\n html[data-bw-has-custom-bg] *:not(bw-widget):not(bw-widget *) {\n background-color: var(--bw-custom-bg) !important;\n background-image: none !important;\n }\n html[data-bw-has-custom-header] h1,\n html[data-bw-has-custom-header] h2,\n html[data-bw-has-custom-header] h3 {\n color: var(--bw-custom-header) !important;\n }\n html[data-bw-has-custom-content] p,\n html[data-bw-has-custom-content] span,\n html[data-bw-has-custom-content] div:not(bw-widget *) {\n color: var(--bw-custom-content) !important;\n }\n ";
|
|
1880
|
+
}
|
|
1881
|
+
_applySettings() {
|
|
1882
|
+
let e = document.documentElement;
|
|
1883
|
+
this._ensureGlobalStyles(), e.style.setProperty("--bw-grayscale", this.settings.monochrome ? "100%" : "0%");
|
|
1884
|
+
let t = 1;
|
|
1885
|
+
this.settings.lowSaturation && (t = .3), this.settings.highSaturation && (t = 2.5), e.style.setProperty("--bw-saturation", t.toString()), this.settings.customBgHue === null ? e.removeAttribute("data-bw-has-custom-bg") : (e.style.setProperty("--bw-custom-bg", `hsl(${this.settings.customBgHue}, 50%, 95%)`), e.setAttribute("data-bw-has-custom-bg", "")), this.settings.customHeaderHue === null ? e.removeAttribute("data-bw-has-custom-header") : (e.style.setProperty("--bw-custom-header", `hsl(${this.settings.customHeaderHue}, 70%, 30%)`), e.setAttribute("data-bw-has-custom-header", "")), this.settings.customContentHue === null ? e.removeAttribute("data-bw-has-custom-content") : (e.style.setProperty("--bw-custom-content", `hsl(${this.settings.customContentHue}, 60%, 40%)`), e.setAttribute("data-bw-has-custom-content", "")), this.settings.textScale > 1 ? e.style.fontSize = `${this.settings.textScale * 100}%` : e.style.fontSize = "";
|
|
1886
|
+
let n = {
|
|
1887
|
+
"data-bw-monochrome": this.settings.monochrome,
|
|
1888
|
+
"data-bw-dark-high-contrast": this.settings.darkHighContrast,
|
|
1889
|
+
"data-bw-bright-high-contrast": this.settings.brightHighContrast,
|
|
1890
|
+
"data-bw-contrast-mode": this.settings.contrastMode,
|
|
1891
|
+
"data-bw-text-spacing": this.settings.textSpacing,
|
|
1892
|
+
"data-bw-dyslexic": this.settings.dyslexicFont,
|
|
1893
|
+
"data-bw-focus-visualizer": this.settings.focusVisualizer,
|
|
1894
|
+
"data-bw-cursor-magnifier": this.settings.cursorMagnifier,
|
|
1895
|
+
"data-bw-no-animations": this.settings.animationsDisabled,
|
|
1896
|
+
"data-bw-link-highlight": this.settings.linkHighlight,
|
|
1897
|
+
"data-bw-highlight-headers": this.settings.highlightHeaders,
|
|
1898
|
+
"data-bw-enlarge-buttons": this.settings.enlargeButtons
|
|
1899
|
+
};
|
|
1900
|
+
Object.entries(n).forEach(([t, n]) => {
|
|
1901
|
+
n ? e.setAttribute(t, "") : e.removeAttribute(t);
|
|
1902
|
+
});
|
|
1903
|
+
let r = this.host;
|
|
1904
|
+
r && r.style.setProperty("--bw-font-scale", this.settings.textScale.toString());
|
|
1905
|
+
}
|
|
1906
|
+
toggleMonochrome() {
|
|
1907
|
+
this.settings.monochrome = !this.settings.monochrome, this._saveSettings();
|
|
1908
|
+
}
|
|
1909
|
+
toggleDarkHighContrast() {
|
|
1910
|
+
this.settings.darkHighContrast = !this.settings.darkHighContrast, this.settings.darkHighContrast && (this.settings.brightHighContrast = !1, this.settings.contrastMode = !1), this._saveSettings();
|
|
1911
|
+
}
|
|
1912
|
+
toggleBrightHighContrast() {
|
|
1913
|
+
this.settings.brightHighContrast = !this.settings.brightHighContrast, this.settings.brightHighContrast && (this.settings.darkHighContrast = !1, this.settings.contrastMode = !1), this._saveSettings();
|
|
1914
|
+
}
|
|
1915
|
+
toggleLowSaturation() {
|
|
1916
|
+
this.settings.lowSaturation = !this.settings.lowSaturation, this.settings.lowSaturation && (this.settings.highSaturation = !1), this._saveSettings();
|
|
1917
|
+
}
|
|
1918
|
+
toggleHighSaturation() {
|
|
1919
|
+
this.settings.highSaturation = !this.settings.highSaturation, this.settings.highSaturation && (this.settings.lowSaturation = !1), this._saveSettings();
|
|
1920
|
+
}
|
|
1921
|
+
toggleContrastMode() {
|
|
1922
|
+
this.settings.contrastMode = !this.settings.contrastMode, this.settings.contrastMode && (this.settings.darkHighContrast = !1, this.settings.brightHighContrast = !1), this._saveSettings();
|
|
1923
|
+
}
|
|
1924
|
+
setCustomHue(e) {
|
|
1925
|
+
this.settings.activeColorTab === "background" ? this.settings.customBgHue = e : this.settings.activeColorTab === "header" ? this.settings.customHeaderHue = e : this.settings.customContentHue = e, this._saveSettings();
|
|
1926
|
+
}
|
|
1927
|
+
resetCustomColors() {
|
|
1928
|
+
this.settings.customBgHue = null, this.settings.customHeaderHue = null, this.settings.customContentHue = null, this._saveSettings();
|
|
1929
|
+
}
|
|
1930
|
+
toggleHighlightHeaders() {
|
|
1931
|
+
this.settings.highlightHeaders = !this.settings.highlightHeaders, this._saveSettings();
|
|
1932
|
+
}
|
|
1933
|
+
toggleEnlargeButtons() {
|
|
1934
|
+
this.settings.enlargeButtons = !this.settings.enlargeButtons, this._saveSettings();
|
|
1935
|
+
}
|
|
1936
|
+
incrementTextScale() {
|
|
1937
|
+
this.settings.textScale >= 1.5 ? this.settings.textScale = 1 : this.settings.textScale = parseFloat((this.settings.textScale + .1).toFixed(1)), this._saveSettings();
|
|
1938
|
+
}
|
|
1939
|
+
toggleTextSpacing() {
|
|
1940
|
+
this.settings.textSpacing = !this.settings.textSpacing, this._saveSettings();
|
|
1941
|
+
}
|
|
1942
|
+
toggleDyslexicFont() {
|
|
1943
|
+
this.settings.dyslexicFont = !this.settings.dyslexicFont, this._saveSettings();
|
|
1944
|
+
}
|
|
1945
|
+
toggleFocusVisualizer() {
|
|
1946
|
+
this.settings.focusVisualizer = !this.settings.focusVisualizer, this._saveSettings();
|
|
1947
|
+
}
|
|
1948
|
+
toggleCursorMagnifier() {
|
|
1949
|
+
this.settings.cursorMagnifier = !this.settings.cursorMagnifier, this._saveSettings();
|
|
1950
|
+
}
|
|
1951
|
+
toggleAnimations() {
|
|
1952
|
+
this.settings.animationsDisabled = !this.settings.animationsDisabled, this._saveSettings();
|
|
1953
|
+
}
|
|
1954
|
+
toggleLinkHighlight() {
|
|
1955
|
+
this.settings.linkHighlight = !this.settings.linkHighlight, this._saveSettings();
|
|
1956
|
+
}
|
|
1957
|
+
reset() {
|
|
1958
|
+
this.settings = { ...Y }, this._saveSettings();
|
|
1959
|
+
}
|
|
1960
|
+
}, lt = "http://localhost:8000", ut = class {
|
|
1961
|
+
constructor(e) {
|
|
1962
|
+
this.isFixing = !1, this.simplifyEnabled = !1, this.autoA11yEnabled = !1, this._onParagraphClick = async (e) => {
|
|
1963
|
+
if (!this.simplifyEnabled) return;
|
|
1964
|
+
let t = e.target;
|
|
1965
|
+
if (t.closest("bw-widget") || t.closest(".bw-ai-tooltip")) return;
|
|
1966
|
+
let n = t.tagName.toLowerCase();
|
|
1967
|
+
if ([
|
|
1968
|
+
"p",
|
|
1969
|
+
"span",
|
|
1970
|
+
"div",
|
|
1971
|
+
"li",
|
|
1972
|
+
"article",
|
|
1973
|
+
"h1",
|
|
1974
|
+
"h2",
|
|
1975
|
+
"h3",
|
|
1976
|
+
"h4",
|
|
1977
|
+
"h5",
|
|
1978
|
+
"h6"
|
|
1979
|
+
].includes(n)) {
|
|
1980
|
+
let n = t.innerText?.trim();
|
|
1981
|
+
if (n && n.length > 20) {
|
|
1982
|
+
e.preventDefault(), e.stopPropagation(), document.querySelectorAll(".bw-ai-tooltip").forEach((e) => e.remove());
|
|
1983
|
+
let r = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches, i = document.createElement("div");
|
|
1984
|
+
i.className = "bw-ai-tooltip bw-ai-tooltip-loading", r && i.setAttribute("data-theme", "dark"), i.innerHTML = "\n <div class=\"bw-ai-tooltip-header\">\n <span>✨ AI Упрощение</span>\n <button class=\"bw-ai-tooltip-close\">✕</button>\n </div>\n <div class=\"bw-ai-tooltip-content\">\n Ожидаем ответ от ИИ...\n </div>\n ", document.body.appendChild(i), i.style.left = `${Math.max(10, e.pageX - 160)}px`, i.style.top = `${e.pageY + 20}px`;
|
|
1985
|
+
let a = t.style.outline, o = t.style.backgroundColor;
|
|
1986
|
+
t.style.outline = "2px dashed #a855f7", t.style.backgroundColor = "rgba(168, 85, 247, 0.05)", i.querySelector(".bw-ai-tooltip-close")?.addEventListener("click", () => {
|
|
1987
|
+
i.remove(), t.style.outline = a, t.style.backgroundColor = o;
|
|
1988
|
+
});
|
|
1989
|
+
try {
|
|
1990
|
+
let e = window.BariwebConfig?.clientId || "", t = await fetch(`${lt}/v1/widget/a11y/simplify`, {
|
|
1991
|
+
method: "POST",
|
|
1992
|
+
headers: {
|
|
1993
|
+
"Content-Type": "application/json",
|
|
1994
|
+
"X-Client-ID": e
|
|
1995
|
+
},
|
|
1996
|
+
body: JSON.stringify({ text: n })
|
|
1997
|
+
});
|
|
1998
|
+
if (t.ok) {
|
|
1999
|
+
let e = await t.json();
|
|
2000
|
+
if (e.text) i.classList.remove("bw-ai-tooltip-loading"), i.querySelector(".bw-ai-tooltip-content").innerHTML = e.text;
|
|
2001
|
+
else throw Error("Empty response");
|
|
2002
|
+
} else throw Error("Server error");
|
|
2003
|
+
} catch (e) {
|
|
2004
|
+
console.error("BariWeb AI: Simplify failed", e), i.classList.remove("bw-ai-tooltip-loading"), i.querySelector(".bw-ai-tooltip-content").innerHTML = "<span style=\"color:#ef4444; font-size:13px;\">Ошибка создания упрощенного текста. Попробуйте еще раз.</span>";
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
}, (this.host = e).addController(this), this.simplifyEnabled = localStorage.getItem("bw-ai-simplify") === "true", this.autoA11yEnabled = localStorage.getItem("bw-ai-autofix") === "true", t.onStateChange(() => {
|
|
2009
|
+
this.autoA11yEnabled && !this.isFixing && this.fixMarkup();
|
|
2010
|
+
}), this.autoA11yEnabled && setTimeout(() => this.fixMarkup(), 1e3);
|
|
2011
|
+
}
|
|
2012
|
+
toggleAutoA11y() {
|
|
2013
|
+
this.autoA11yEnabled = !this.autoA11yEnabled, localStorage.setItem("bw-ai-autofix", this.autoA11yEnabled ? "true" : "false"), this.autoA11yEnabled && !this.isFixing && this.fixMarkup(), this.host.requestUpdate();
|
|
2014
|
+
}
|
|
2015
|
+
hostConnected() {}
|
|
2016
|
+
hostDisconnected() {
|
|
2017
|
+
this.simplifyEnabled && (document.body.removeEventListener("click", this._onParagraphClick, { capture: !0 }), document.body.classList.remove("bw-simplify-mode"));
|
|
2018
|
+
}
|
|
2019
|
+
async fixMarkup() {
|
|
2020
|
+
this.isFixing = !0, this.host.requestUpdate();
|
|
2021
|
+
try {
|
|
2022
|
+
let e = [];
|
|
2023
|
+
if (document.querySelectorAll("img:not([alt]), img[alt=\"\"]").forEach((t) => {
|
|
2024
|
+
t.hasAttribute("data-bw-ai-id") || t.setAttribute("data-bw-ai-id", "ai-img-" + Math.random().toString(36).substring(2, 9)), e.push({
|
|
2025
|
+
id: t.getAttribute("data-bw-ai-id"),
|
|
2026
|
+
html: t.outerHTML.substring(0, 300) + (t.outerHTML.length > 300 ? "...>" : "")
|
|
2027
|
+
});
|
|
2028
|
+
}), document.querySelectorAll("button:not([aria-label]), a:not([aria-label]), [role=\"button\"]:not([aria-label])").forEach((t) => {
|
|
2029
|
+
if (t.tagName === "INPUT") return;
|
|
2030
|
+
let n = t;
|
|
2031
|
+
n.innerText?.trim() || n.textContent?.trim() || (t.hasAttribute("data-bw-ai-id") || t.setAttribute("data-bw-ai-id", "ai-btn-" + Math.random().toString(36).substring(2, 9)), e.push({
|
|
2032
|
+
id: t.getAttribute("data-bw-ai-id"),
|
|
2033
|
+
html: t.outerHTML.substring(0, 300) + (t.outerHTML.length > 300 ? "...>" : "")
|
|
2034
|
+
}));
|
|
2035
|
+
}), e.length === 0) {
|
|
2036
|
+
console.log("BariWeb AI: No broken elements found.");
|
|
2037
|
+
return;
|
|
2038
|
+
}
|
|
2039
|
+
console.log(`BariWeb AI: Found ${e.length} broken elements. Processing...`);
|
|
2040
|
+
let t = window.BariwebConfig?.clientId || "";
|
|
2041
|
+
for (let n = 0; n < e.length; n += 10) {
|
|
2042
|
+
let r = e.slice(n, n + 10), i = await fetch(`${lt}/v1/widget/a11y/fix`, {
|
|
2043
|
+
method: "POST",
|
|
2044
|
+
headers: {
|
|
2045
|
+
"Content-Type": "application/json",
|
|
2046
|
+
"X-Client-ID": t
|
|
2047
|
+
},
|
|
2048
|
+
body: JSON.stringify({ elements: r })
|
|
2049
|
+
});
|
|
2050
|
+
i.ok && (await i.json()).forEach((e) => {
|
|
2051
|
+
let t = document.querySelector(`[data-bw-ai-id="${e.id}"]`);
|
|
2052
|
+
if (t && e.value && (e.attribute === "alt" || e.attribute === "aria-label")) {
|
|
2053
|
+
t.setAttribute(e.attribute, e.value);
|
|
2054
|
+
let n = t, r = n.style.outline;
|
|
2055
|
+
n.style.outline = "3px solid #10b981", setTimeout(() => {
|
|
2056
|
+
n.style.outline = r;
|
|
2057
|
+
}, 2e3);
|
|
2058
|
+
}
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
} catch (e) {
|
|
2062
|
+
console.error("BariWeb AI: A11y Fix failed", e);
|
|
2063
|
+
} finally {
|
|
2064
|
+
this.isFixing = !1, this.host.requestUpdate();
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
toggleSimplify() {
|
|
2068
|
+
if (this.simplifyEnabled = !this.simplifyEnabled, this.simplifyEnabled) {
|
|
2069
|
+
if (document.body.addEventListener("click", this._onParagraphClick, { capture: !0 }), document.documentElement.style.setProperty("--bw-simplify-cursor", "help"), !document.getElementById("bw-simplify-mode-style")) {
|
|
2070
|
+
let e = document.createElement("style");
|
|
2071
|
+
e.id = "bw-simplify-mode-style", e.textContent = "\n body.bw-simplify-mode *:hover {\n cursor: help !important;\n background-color: rgba(168, 85, 247, 0.1) !important;\n outline: 1px dashed rgba(168, 85, 247, 0.4) !important;\n }\n bw-widget.bw-simplify-mode *:hover, .bw-ai-tooltip *:hover {\n cursor: inherit !important;\n background-color: transparent !important;\n outline: none !important;\n }\n .bw-ai-tooltip {\n position: absolute;\n width: 320px;\n background: #ffffff;\n border: 1px solid #e2e8f0;\n border-radius: 12px;\n box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n color: #0f172a;\n font-family: system-ui, -apple-system, sans-serif;\n z-index: 999999;\n overflow: hidden;\n animation: bwAiFadeIn 0.2s ease-out;\n }\n .bw-ai-tooltip[data-theme=\"dark\"] {\n background: #1e293b;\n border-color: #334155;\n color: #f8fafc;\n }\n .bw-ai-tooltip-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n background: #f8fafc;\n border-bottom: 1px solid #e2e8f0;\n font-size: 11px;\n font-weight: 700;\n color: #64748b;\n }\n .bw-ai-tooltip[data-theme=\"dark\"] .bw-ai-tooltip-header {\n background: #0f172a;\n border-bottom-color: #334155;\n color: #94a3b8;\n }\n .bw-ai-tooltip-close {\n background: transparent;\n border: none;\n color: inherit;\n cursor: pointer;\n font-size: 14px;\n padding: 2px 6px;\n border-radius: 4px;\n }\n .bw-ai-tooltip-close:hover {\n background: rgba(0,0,0,0.05);\n }\n .bw-ai-tooltip[data-theme=\"dark\"] .bw-ai-tooltip-close:hover {\n background: rgba(255,255,255,0.1);\n }\n .bw-ai-tooltip-content {\n padding: 14px;\n font-size: 14px;\n line-height: 1.6;\n }\n .bw-ai-tooltip-loading .bw-ai-tooltip-content {\n display: flex;\n align-items: center;\n gap: 10px;\n color: #64748b;\n font-style: italic;\n font-size: 13px;\n }\n @keyframes bwAiFadeIn {\n from { opacity: 0; transform: translateY(4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n ", document.head.appendChild(e);
|
|
2072
|
+
}
|
|
2073
|
+
document.body.classList.add("bw-simplify-mode");
|
|
2074
|
+
} else document.body.removeEventListener("click", this._onParagraphClick, { capture: !0 }), document.body.classList.remove("bw-simplify-mode"), document.documentElement.style.removeProperty("--bw-simplify-cursor");
|
|
2075
|
+
this.host.requestUpdate();
|
|
2076
|
+
}
|
|
2077
|
+
}, dt = "bw-tts-enabled-v1", ft = class {
|
|
2078
|
+
constructor() {
|
|
2079
|
+
this.enabled = !0, this.enabled = this.loadEnabled();
|
|
2080
|
+
}
|
|
2081
|
+
isEnabled() {
|
|
2082
|
+
return this.enabled;
|
|
2083
|
+
}
|
|
2084
|
+
setEnabled(e) {
|
|
2085
|
+
this.enabled = e;
|
|
2086
|
+
try {
|
|
2087
|
+
localStorage.setItem(dt, e ? "1" : "0");
|
|
2088
|
+
} catch {}
|
|
2089
|
+
e || this.stop();
|
|
2090
|
+
}
|
|
2091
|
+
stop() {
|
|
2092
|
+
"speechSynthesis" in window && window.speechSynthesis.cancel();
|
|
2093
|
+
}
|
|
2094
|
+
speak(e) {
|
|
2095
|
+
if (!this.enabled || !("speechSynthesis" in window)) return;
|
|
2096
|
+
let t = (e || "").trim();
|
|
2097
|
+
if (t) try {
|
|
2098
|
+
window.speechSynthesis.cancel();
|
|
2099
|
+
let e = new SpeechSynthesisUtterance(t), n = this.detectLanguage(t);
|
|
2100
|
+
e.lang = n;
|
|
2101
|
+
let r = this.pickVoice(n);
|
|
2102
|
+
r && (e.voice = r), e.rate = 1, e.pitch = 1, window.speechSynthesis.speak(e);
|
|
2103
|
+
} catch (e) {
|
|
2104
|
+
console.warn("TTS speak failed", e);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
loadEnabled() {
|
|
2108
|
+
try {
|
|
2109
|
+
let e = localStorage.getItem(dt);
|
|
2110
|
+
return e === null ? !0 : e !== "0";
|
|
2111
|
+
} catch {
|
|
2112
|
+
return !0;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
detectLanguage(e) {
|
|
2116
|
+
let t = e.toLowerCase();
|
|
2117
|
+
return /[әіңғүұқөһ]/i.test(t) ? "kk-KZ" : /[а-яё]/i.test(t) ? "ru-RU" : /[a-z]/i.test(t) ? "en-US" : "ru-RU";
|
|
2118
|
+
}
|
|
2119
|
+
pickVoice(e) {
|
|
2120
|
+
if (!("speechSynthesis" in window)) return null;
|
|
2121
|
+
let t = window.speechSynthesis.getVoices();
|
|
2122
|
+
if (!t || t.length === 0) return null;
|
|
2123
|
+
let n = e.split("-")[0].toLowerCase();
|
|
2124
|
+
return t.find((t) => t.lang.toLowerCase() === e.toLowerCase()) || t.find((e) => e.lang.toLowerCase().startsWith(n)) || t[0] || null;
|
|
2125
|
+
}
|
|
2126
|
+
}, X = "http://localhost:8000", pt = 5, mt = [/(submit|отправить|оплатить|сгенерировать|сохранить|перевести|подтвердит|купить|удалить|delete|pay|purchase|buy|send|transfer|confirm|place.?order|checkout|remove|drop|unsubscribe|sign.?out|выйти|уволить)/i];
|
|
2127
|
+
function ht(e) {
|
|
2128
|
+
if (e.type !== "click_element" || !e.element_id) return !1;
|
|
2129
|
+
let t = document.getElementById(e.element_id);
|
|
2130
|
+
if (!t) return !1;
|
|
2131
|
+
if (t.getAttribute("type") === "submit" || t.tagName.toLowerCase() === "button" && t.closest("form") !== null && t.getAttribute("type") !== "button") return !0;
|
|
2132
|
+
let n = [
|
|
2133
|
+
t.textContent?.trim() || "",
|
|
2134
|
+
t.getAttribute("aria-label") || "",
|
|
2135
|
+
t.getAttribute("title") || "",
|
|
2136
|
+
t.getAttribute("name") || "",
|
|
2137
|
+
t.getAttribute("value") || ""
|
|
2138
|
+
].join(" ");
|
|
2139
|
+
return mt.some((e) => e.test(n));
|
|
2140
|
+
}
|
|
2141
|
+
var gt = class {
|
|
2142
|
+
constructor(e) {
|
|
2143
|
+
this.messages = [], this.isLoading = !1, this.error = null, this._tts = new ft(), this._voiceMode = !1, this.pendingConfirmation = null, (this.host = e).addController(this), this._loadMessages();
|
|
2144
|
+
}
|
|
2145
|
+
hostConnected() {}
|
|
2146
|
+
hostDisconnected() {
|
|
2147
|
+
this._tts.stop();
|
|
2148
|
+
}
|
|
2149
|
+
_loadMessages() {
|
|
2150
|
+
try {
|
|
2151
|
+
let e = sessionStorage.getItem("bw-chat-history");
|
|
2152
|
+
e && (this.messages = JSON.parse(e), this.messages.length > 0 && typeof this.host.setOpen == "function" && setTimeout(() => this.host.setOpen(!0), 100));
|
|
2153
|
+
let t = sessionStorage.getItem("bw-auto-resume");
|
|
2154
|
+
if (t === "true" || t === "verify-only") {
|
|
2155
|
+
sessionStorage.removeItem("bw-auto-resume");
|
|
2156
|
+
let e = t === "verify-only" ? "Страница загрузилась после отправки формы. Проверь новый DOM: если авторизация прошла успешно (нет формы входа, есть контент приложения) — сообщи об успехе. НЕ нажимай ничего снова." : "Страница загрузилась. Продолжай выполнение задачи с учетом нового контекста и DOM.";
|
|
2157
|
+
setTimeout(() => {
|
|
2158
|
+
this._agentStep(e);
|
|
2159
|
+
}, 1e3);
|
|
2160
|
+
}
|
|
2161
|
+
} catch (e) {
|
|
2162
|
+
console.error("Failed to load chat history", e);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
_saveMessages() {
|
|
2166
|
+
try {
|
|
2167
|
+
sessionStorage.setItem("bw-chat-history", JSON.stringify(this.messages));
|
|
2168
|
+
} catch (e) {
|
|
2169
|
+
console.error("Failed to save chat history", e);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
gatherContext() {
|
|
2173
|
+
let e = window.location.href, t = document.body?.innerText?.slice(0, 3e3) ?? "", n = Array.from(document.querySelectorAll("a[href], button, [role=\"button\"], input:not([type=\"hidden\"]), textarea, select")).filter((e) => !e.hasAttribute("bw-private")).map((e) => {
|
|
2174
|
+
let t = e, n = t.tagName.toLowerCase(), r = n === "input" || n === "textarea" || n === "select", i = t.getAttribute("type") || (n === "input" ? "text" : n === "button" ? "button" : n), a = t.getAttribute("name") || "", o = t.getAttribute("placeholder") || "", s = r ? (t.value || "").slice(0, 80) : "";
|
|
2175
|
+
s &&= (s = s.replace(/\b\d{13,19}\b/g, (e) => e.slice(0, 4) + " **** **** " + e.slice(-4)), s.replace(/\b\d{12}\b/g, "**** **** ****"));
|
|
2176
|
+
let c = t.id && !t.getAttribute("data-bw-auto") ? t.id : t.getAttribute("data-id") || t.getAttribute("data-testid") || "";
|
|
2177
|
+
if (!c) {
|
|
2178
|
+
let e = `${n}|${i}|${a}|${o}|${(t.className || "").toString().replace(/\s+/g, "-").slice(0, 40)}|${t.href || ""}|${(t.textContent || "").trim().slice(0, 30)}|${t.parentElement?.tagName?.toLowerCase() || "root"}`, r = 5381;
|
|
2179
|
+
for (let t = 0; t < e.length; t++) r = (r << 5) + r ^ e.charCodeAt(t);
|
|
2180
|
+
c = `bw-${(r >>> 0).toString(16)}`, t.id = c, t.setAttribute("data-bw-auto", "true");
|
|
2181
|
+
}
|
|
2182
|
+
let l = t.getAttribute("aria-label") || "";
|
|
2183
|
+
if (!l && c) {
|
|
2184
|
+
let e = document.querySelector(`label[for="${c}"]`);
|
|
2185
|
+
e && (l = e.textContent?.trim() || "");
|
|
2186
|
+
}
|
|
2187
|
+
if (!l) {
|
|
2188
|
+
let e = t.parentElement;
|
|
2189
|
+
for (; e && e.tagName.toLowerCase() !== "form" && e.tagName.toLowerCase() !== "body";) {
|
|
2190
|
+
if (e.tagName.toLowerCase() === "label") {
|
|
2191
|
+
l = (e.textContent || "").replace(t.textContent || "", "").trim();
|
|
2192
|
+
break;
|
|
2193
|
+
}
|
|
2194
|
+
e = e.parentElement;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
if (l ||= (t.textContent || "").trim().slice(0, 80), l ||= t.getAttribute("title") || "", !l && o && (l = o), !l && n === "button") {
|
|
2198
|
+
let e = t.querySelector("svg");
|
|
2199
|
+
if (e && typeof e.className?.baseVal == "string") {
|
|
2200
|
+
let t = e.className.baseVal.match(/lucide-([a-z0-9\-]+)/);
|
|
2201
|
+
l = t ? `[icon:${t[1]}]` : "[icon]";
|
|
2202
|
+
} else l = `[btn:${(t.className || "").toString().slice(0, 30)}]`;
|
|
2203
|
+
}
|
|
2204
|
+
return {
|
|
2205
|
+
id: c,
|
|
2206
|
+
label: l.trim(),
|
|
2207
|
+
tag: n,
|
|
2208
|
+
type: i,
|
|
2209
|
+
name: a,
|
|
2210
|
+
placeholder: o,
|
|
2211
|
+
value: s
|
|
2212
|
+
};
|
|
2213
|
+
}).filter((e) => e.label.length > 0 || (e.placeholder ?? "").length > 0 || (e.name ?? "").length > 0).slice(0, 100).map((e) => "[" + [
|
|
2214
|
+
e.tag,
|
|
2215
|
+
e.type || "",
|
|
2216
|
+
e.id,
|
|
2217
|
+
e.name || "",
|
|
2218
|
+
e.placeholder || "",
|
|
2219
|
+
e.value || "",
|
|
2220
|
+
e.label
|
|
2221
|
+
].join("|") + "]").join(""), r = t;
|
|
2222
|
+
return r = r.replace(/\b\d{13,19}\b/g, "**** **** **** ****"), r = r.replace(/\b\d{12}\b/g, "**** **** ****"), {
|
|
2223
|
+
page_text: r,
|
|
2224
|
+
elements: n,
|
|
2225
|
+
page_url: e
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2228
|
+
executeAction(e) {
|
|
2229
|
+
if (e.type === "click_element" && e.element_id) {
|
|
2230
|
+
let t = document.getElementById(e.element_id);
|
|
2231
|
+
if (t) {
|
|
2232
|
+
if (t.tagName.toLowerCase() === "a" && t.href) {
|
|
2233
|
+
let n = t.href;
|
|
2234
|
+
return new URL(n, window.location.origin).origin === window.location.origin && sessionStorage.setItem("bw-auto-resume", "true"), t.click(), {
|
|
2235
|
+
result: `✅ Нажал на "${t.textContent?.trim() || e.element_id}"`,
|
|
2236
|
+
causesNavigation: !0
|
|
2237
|
+
};
|
|
2238
|
+
}
|
|
2239
|
+
return t.getAttribute("type") === "submit" || t.tagName.toLowerCase() === "button" && t.closest("form") !== null && t.getAttribute("type") !== "button" ? (sessionStorage.setItem("bw-auto-resume", "verify-only"), t.click(), {
|
|
2240
|
+
result: `✅ Нажал на "${t.textContent?.trim() || e.element_id}"`,
|
|
2241
|
+
causesNavigation: !0
|
|
2242
|
+
}) : (t.click(), {
|
|
2243
|
+
result: `✅ Нажал на "${t.textContent?.trim() || e.element_id}"`,
|
|
2244
|
+
causesNavigation: !1
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
return {
|
|
2248
|
+
result: `⚠️ Элемент "${e.element_id}" не найден.`,
|
|
2249
|
+
causesNavigation: !1
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
if (e.type === "navigate" && e.url) return sessionStorage.setItem("bw-auto-resume", "true"), window.location.href = e.url, {
|
|
2253
|
+
result: `🔀 Перехожу на ${e.url}...`,
|
|
2254
|
+
causesNavigation: !0
|
|
2255
|
+
};
|
|
2256
|
+
if (e.type === "input_text" && e.element_id && e.value !== void 0) {
|
|
2257
|
+
let t = document.getElementById(e.element_id);
|
|
2258
|
+
if (t) {
|
|
2259
|
+
let n = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set, r = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value")?.set;
|
|
2260
|
+
return t.tagName.toLowerCase() === "textarea" && r ? r.call(t, e.value) : n ? n.call(t, e.value) : t.value = e.value, t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 })), {
|
|
2261
|
+
result: `⌨️ Ввел текст "${e.value}" в поле.`,
|
|
2262
|
+
causesNavigation: !1
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
return {
|
|
2266
|
+
result: `⚠️ Поле ввода "${e.element_id}" не найдено.`,
|
|
2267
|
+
causesNavigation: !1
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
return e.type === "continue" ? {
|
|
2271
|
+
result: "🔄 Анализирую страницу...",
|
|
2272
|
+
causesNavigation: !1
|
|
2273
|
+
} : {
|
|
2274
|
+
result: "⚠️ Неизвестное действие.",
|
|
2275
|
+
causesNavigation: !1
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
async _callAPI(t) {
|
|
2279
|
+
let { page_text: n, elements: r, page_url: i } = this.gatherContext(), a = e(), o = this.host.clientId || window.__BARIWEB_CLIENT_ID__ || "", s = null;
|
|
2280
|
+
try {
|
|
2281
|
+
let e = await fetch(`${X}/v1/training/match-screen`, {
|
|
2282
|
+
method: "POST",
|
|
2283
|
+
headers: {
|
|
2284
|
+
"Content-Type": "application/json",
|
|
2285
|
+
"X-Client-ID": o
|
|
2286
|
+
},
|
|
2287
|
+
body: JSON.stringify({ fingerprint: a })
|
|
2288
|
+
});
|
|
2289
|
+
if (e.ok) {
|
|
2290
|
+
let t = await e.json();
|
|
2291
|
+
t.matched && (s = t.label);
|
|
2292
|
+
}
|
|
2293
|
+
} catch (e) {
|
|
2294
|
+
console.warn("Failed to match screen fingerprint", e);
|
|
2295
|
+
}
|
|
2296
|
+
let c = await fetch(`${X}/v1/chat`, {
|
|
2297
|
+
method: "POST",
|
|
2298
|
+
headers: {
|
|
2299
|
+
"Content-Type": "application/json",
|
|
2300
|
+
"X-Client-ID": o
|
|
2301
|
+
},
|
|
2302
|
+
body: JSON.stringify({
|
|
2303
|
+
query: t,
|
|
2304
|
+
history: this._compressedHistory(),
|
|
2305
|
+
page_text: n,
|
|
2306
|
+
elements: r,
|
|
2307
|
+
page_url: i,
|
|
2308
|
+
screen_label: s,
|
|
2309
|
+
screen_fingerprint: a
|
|
2310
|
+
})
|
|
2311
|
+
});
|
|
2312
|
+
if (!c.ok) throw Error(`HTTP ${c.status}: ${c.statusText}`);
|
|
2313
|
+
let l = await c.json();
|
|
2314
|
+
if (l.text && l.text.trimStart().startsWith("{")) try {
|
|
2315
|
+
let e = JSON.parse(l.text);
|
|
2316
|
+
e.text && (l.text = e.text, e.action && !l.action && (l.action = e.action));
|
|
2317
|
+
} catch {
|
|
2318
|
+
l.text = l.text.replace(/^\{"text"\s*:\s*"/, "").replace(/",?\s*"action".*$/, "");
|
|
2319
|
+
}
|
|
2320
|
+
return l;
|
|
2321
|
+
}
|
|
2322
|
+
_compressedHistory() {
|
|
2323
|
+
let e = this.messages.map((e) => ({
|
|
2324
|
+
role: e.role,
|
|
2325
|
+
text: e.text
|
|
2326
|
+
}));
|
|
2327
|
+
if (e.length <= 3) return e;
|
|
2328
|
+
let t = -1;
|
|
2329
|
+
for (let n = e.length - 1; n >= 0; n--) if (e[n].role === "user") {
|
|
2330
|
+
t = n;
|
|
2331
|
+
break;
|
|
2332
|
+
}
|
|
2333
|
+
return t === -1 ? e.slice(-3) : [e[t], ...e.slice(t + 1).filter((e) => e.role === "assistant").slice(-2)];
|
|
2334
|
+
}
|
|
2335
|
+
async _agentLoop(e, t, n = !1) {
|
|
2336
|
+
if (this.isLoading) return;
|
|
2337
|
+
this.isLoading = !0, this.error = null, this._voiceMode = n, t && (this.messages = [...this.messages, {
|
|
2338
|
+
role: "user",
|
|
2339
|
+
text: e,
|
|
2340
|
+
timestamp: Date.now()
|
|
2341
|
+
}], this._saveMessages()), this.host.requestUpdate();
|
|
2342
|
+
let r = e, i = 0;
|
|
2343
|
+
try {
|
|
2344
|
+
for (; i < pt;) {
|
|
2345
|
+
i++;
|
|
2346
|
+
let e = await this._callAPI(r), t = e.text;
|
|
2347
|
+
if (e.action) {
|
|
2348
|
+
if (ht(e.action)) {
|
|
2349
|
+
let t = document.getElementById(e.action.element_id || "")?.textContent?.trim() || e.action.element_id || "кнопку";
|
|
2350
|
+
this.pendingConfirmation = {
|
|
2351
|
+
text: `${e.text}\n\n⚠️ Нажать «${t}»?`,
|
|
2352
|
+
action: e.action,
|
|
2353
|
+
currentQuery: r,
|
|
2354
|
+
step: i
|
|
2355
|
+
}, this.messages = [...this.messages, {
|
|
2356
|
+
role: "assistant",
|
|
2357
|
+
text: `${e.text}\n\n🛑 **Подтвердите действие:** нажать «${t}»?`,
|
|
2358
|
+
timestamp: Date.now()
|
|
2359
|
+
}], this._saveMessages(), this._voiceMode && this._tts.speak(e.text), this.isLoading = !1, this.host.requestUpdate();
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
let n = this.gatherContext().page_text, { result: a, causesNavigation: o } = this.executeAction(e.action);
|
|
2363
|
+
if (e.action.type === "continue") {
|
|
2364
|
+
this.messages = [...this.messages, {
|
|
2365
|
+
role: "assistant",
|
|
2366
|
+
text: "🔄 Анализирую...",
|
|
2367
|
+
timestamp: Date.now()
|
|
2368
|
+
}], this._saveMessages(), this._voiceMode && this._tts.speak("Анализирую..."), this.host.requestUpdate(), await this._waitForDom(800), r = "Страница обновилась. Продолжай задачу, прочитай DOM.";
|
|
2369
|
+
continue;
|
|
2370
|
+
}
|
|
2371
|
+
if (t = `${e.text}\n${a}`, o) {
|
|
2372
|
+
this.messages = [...this.messages, {
|
|
2373
|
+
role: "assistant",
|
|
2374
|
+
text: t,
|
|
2375
|
+
timestamp: Date.now()
|
|
2376
|
+
}], this._saveMessages(), this._voiceMode && this._tts.speak(t), this.host.requestUpdate(), await this._waitForDom(1500);
|
|
2377
|
+
let e = sessionStorage.getItem("bw-auto-resume");
|
|
2378
|
+
if (e === "true" || e === "verify-only") {
|
|
2379
|
+
sessionStorage.removeItem("bw-auto-resume"), r = e === "verify-only" ? "Страница загрузилась после отправки формы (SPA навигация). Проверь новый DOM: если задача выполнена — сообщи об успехе. НЕ нажимай ничего снова." : "Страница загрузилась (SPA навигация). Продолжай задачу, прочитай новый DOM.";
|
|
2380
|
+
continue;
|
|
2381
|
+
}
|
|
2382
|
+
break;
|
|
2383
|
+
}
|
|
2384
|
+
this.messages = [...this.messages, {
|
|
2385
|
+
role: "assistant",
|
|
2386
|
+
text: t,
|
|
2387
|
+
timestamp: Date.now()
|
|
2388
|
+
}], this._saveMessages(), this._voiceMode && this._tts.speak(t), this.host.requestUpdate(), e.action.type === "input_text" && e.action.element_id ? (await this._waitForDom(800), r = (document.getElementById(e.action.element_id)?.value ?? "").length > 0 ? "✅ Поле заполнено. Переходи к СЛЕДУЮЩЕМУ незаполненному полю или нажми кнопку отправки. НЕ повторяй ввод." : `⚠️ Поле не получило значение. Попробуй ввести снова в id="${e.action.element_id}".`) : (await this._waitForDom(800), r = n === this.gatherContext().page_text ? "⚠️ Страница не изменилась. Возможно кнопка не сработала. Проверь DOM." : "Действие выполнено. Если задача готова — сообщи. Иначе продолжай.");
|
|
2389
|
+
continue;
|
|
2390
|
+
}
|
|
2391
|
+
this.messages = [...this.messages, {
|
|
2392
|
+
role: "assistant",
|
|
2393
|
+
text: t,
|
|
2394
|
+
timestamp: Date.now()
|
|
2395
|
+
}], this._saveMessages(), this._voiceMode && this._tts.speak(t);
|
|
2396
|
+
break;
|
|
2397
|
+
}
|
|
2398
|
+
} catch (e) {
|
|
2399
|
+
this.error = e.message ?? "Ошибка соединения", this.messages = [...this.messages, {
|
|
2400
|
+
role: "assistant",
|
|
2401
|
+
text: `❌ Ошибка: ${this.error}`,
|
|
2402
|
+
timestamp: Date.now()
|
|
2403
|
+
}], this._saveMessages(), this._voiceMode && this._tts.speak(`Ошибка: ${this.error}`);
|
|
2404
|
+
} finally {
|
|
2405
|
+
this.isLoading = !1, this.host.requestUpdate();
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
async confirmAction() {
|
|
2409
|
+
if (!this.pendingConfirmation) return;
|
|
2410
|
+
let { action: e } = this.pendingConfirmation;
|
|
2411
|
+
this.pendingConfirmation = null, this.messages = [...this.messages, {
|
|
2412
|
+
role: "user",
|
|
2413
|
+
text: "✅ Подтверждаю",
|
|
2414
|
+
timestamp: Date.now()
|
|
2415
|
+
}], this._saveMessages(), this.host.requestUpdate();
|
|
2416
|
+
let { result: t, causesNavigation: n } = this.executeAction(e);
|
|
2417
|
+
this.messages = [...this.messages, {
|
|
2418
|
+
role: "assistant",
|
|
2419
|
+
text: t,
|
|
2420
|
+
timestamp: Date.now()
|
|
2421
|
+
}], this._saveMessages(), this._voiceMode && this._tts.speak(t), this.host.requestUpdate(), !n && (await this._waitForDom(1200), await this._agentStep("Действие подтверждено и выполнено. Проверь результат в DOM."));
|
|
2422
|
+
}
|
|
2423
|
+
cancelAction() {
|
|
2424
|
+
this.pendingConfirmation && (this.pendingConfirmation = null, this.messages = [
|
|
2425
|
+
...this.messages,
|
|
2426
|
+
{
|
|
2427
|
+
role: "user",
|
|
2428
|
+
text: "❌ Отмена",
|
|
2429
|
+
timestamp: Date.now()
|
|
2430
|
+
},
|
|
2431
|
+
{
|
|
2432
|
+
role: "assistant",
|
|
2433
|
+
text: "🚫 Действие отменено. Чем ещё могу помочь?",
|
|
2434
|
+
timestamp: Date.now()
|
|
2435
|
+
}
|
|
2436
|
+
], this._saveMessages(), this._voiceMode && this._tts.speak("Действие отменено. Чем ещё могу помочь?"), this.host.requestUpdate());
|
|
2437
|
+
}
|
|
2438
|
+
_waitForDom(e) {
|
|
2439
|
+
return new Promise((t) => setTimeout(t, e));
|
|
2440
|
+
}
|
|
2441
|
+
async sendMessage(e, t = !1) {
|
|
2442
|
+
!e.trim() || this.isLoading || (await this._agentLoop(e, !0, t), this.host.updateComplete?.then(() => {
|
|
2443
|
+
let e = this.host.renderRoot?.querySelector(".chat-messages");
|
|
2444
|
+
e && (e.scrollTop = e.scrollHeight);
|
|
2445
|
+
}));
|
|
2446
|
+
}
|
|
2447
|
+
async _agentStep(e) {
|
|
2448
|
+
await this._agentLoop(e, !1, this._voiceMode), this.host.updateComplete?.then(() => {
|
|
2449
|
+
let e = this.host.renderRoot?.querySelector(".chat-messages");
|
|
2450
|
+
e && (e.scrollTop = e.scrollHeight);
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
clearMessages() {
|
|
2454
|
+
this.messages = [], this.error = null, this.pendingConfirmation = null, this._saveMessages(), this.host.requestUpdate();
|
|
2455
|
+
}
|
|
2456
|
+
isTtsEnabled() {
|
|
2457
|
+
return this._tts.isEnabled();
|
|
2458
|
+
}
|
|
2459
|
+
setTtsEnabled(e) {
|
|
2460
|
+
this._tts.setEnabled(e), this.host.requestUpdate();
|
|
2461
|
+
}
|
|
2462
|
+
async transcribeAudio(e, t) {
|
|
2463
|
+
let n = this.host.clientId || window.__BARIWEB_CLIENT_ID__ || "", r = new FormData();
|
|
2464
|
+
r.append("language_mode", t), r.append("audio", e, "speech.wav");
|
|
2465
|
+
let i = await fetch(`${X}/v1/stt/transcribe`, {
|
|
2466
|
+
method: "POST",
|
|
2467
|
+
headers: { "X-Client-ID": n },
|
|
2468
|
+
body: r
|
|
2469
|
+
});
|
|
2470
|
+
if (!i.ok) {
|
|
2471
|
+
let e = `HTTP ${i.status}`;
|
|
2472
|
+
try {
|
|
2473
|
+
e = (await i.json())?.detail || e;
|
|
2474
|
+
} catch {}
|
|
2475
|
+
throw Error(e);
|
|
2476
|
+
}
|
|
2477
|
+
return await i.json();
|
|
2478
|
+
}
|
|
2479
|
+
};
|
|
2480
|
+
//#endregion
|
|
2481
|
+
//#region \0@oxc-project+runtime@0.122.0/helpers/decorate.js
|
|
2482
|
+
function Z(e, t, n, r) {
|
|
2483
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
2484
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
2485
|
+
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
2486
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
2487
|
+
}
|
|
2488
|
+
//#endregion
|
|
2489
|
+
//#region src/widget.ts
|
|
2490
|
+
var _t = "bw-stt-lang-v1", vt = 200, yt = .015, bt = 1200, xt = 2e4, St = 350, Q = {
|
|
2491
|
+
kz: {
|
|
2492
|
+
langLabel: "Тану және виджет тілі",
|
|
2493
|
+
langKz: "Қазақша",
|
|
2494
|
+
langRu: "Орысша",
|
|
2495
|
+
langEn: "Ағылшынша",
|
|
2496
|
+
chatTab: "💬 Чат",
|
|
2497
|
+
settingsTab: "♿ Баптаулар",
|
|
2498
|
+
brandSub: "Инклюзия",
|
|
2499
|
+
madeIn: "Қазақстанда жасалған 🇰🇿",
|
|
2500
|
+
voiceBtnInit: "Дауыс",
|
|
2501
|
+
voiceBtnRec: "Жазылуда...",
|
|
2502
|
+
micBannerRec: "🎙️ Тыңдаудамын... (тыныштық болса тоқтаймын)",
|
|
2503
|
+
micBannerWait: "⏳ Сөзді тану...",
|
|
2504
|
+
micBannerErr: "⚠️",
|
|
2505
|
+
micAriaL: "Голостық енгізуді қосу (жазу үшін ұстап тұрыңыз)",
|
|
2506
|
+
inputAriaL: "Хабарламаны енгізу өрісі",
|
|
2507
|
+
inputPl: "Хабарлама енгізіңіз...",
|
|
2508
|
+
ttsAriaOn: "Жауапты дыбыстауды өшіру",
|
|
2509
|
+
ttsAriaOff: "Жауапты дыбыстауды қосу",
|
|
2510
|
+
sendAria: "Хабарлама жіберу",
|
|
2511
|
+
onPage: "Бетте:",
|
|
2512
|
+
emptyChatTitle: "Сіздің көмекшіңіз",
|
|
2513
|
+
emptyChatSub: "Тапсырманы сипаттаңыз — мен қажетті түймелерді тауып, өрістерді сіз үшін толтырамын.",
|
|
2514
|
+
confirmAction: "✅ Әрекетті растау",
|
|
2515
|
+
cancelAction: "Болдырмау",
|
|
2516
|
+
textScale: "Мәтін өлшемі",
|
|
2517
|
+
monochrome: "А/Қ",
|
|
2518
|
+
monochromeVal: "Монохром",
|
|
2519
|
+
contrast: "Контраст",
|
|
2520
|
+
contrastVal: "Қараңғы",
|
|
2521
|
+
links: "Сілтемелер",
|
|
2522
|
+
linksVal: "Ерекшелеу",
|
|
2523
|
+
spacing: "Аралық",
|
|
2524
|
+
spacingVal: "Үлкейту",
|
|
2525
|
+
font: "Қаріп",
|
|
2526
|
+
fontVal: "Дислексия",
|
|
2527
|
+
cursor: "Курсор",
|
|
2528
|
+
cursorVal: "Үлкейту",
|
|
2529
|
+
colorSettingsTitle: "Түс баптаулары",
|
|
2530
|
+
colorBg: "Фон",
|
|
2531
|
+
colorHeader: "Бас киім",
|
|
2532
|
+
colorText: "Мәтін",
|
|
2533
|
+
aiSimplifyTitle: "AI Мәтінді оңтайландыру",
|
|
2534
|
+
aiBlindTitle: "Зағиптар режимі (AI)",
|
|
2535
|
+
on: "ҚОСУЛЫ",
|
|
2536
|
+
off: "ӨШІРУЛІ",
|
|
2537
|
+
closeAria: "Жабу"
|
|
2538
|
+
},
|
|
2539
|
+
ru: {
|
|
2540
|
+
langLabel: "Язык распознавания и виджета",
|
|
2541
|
+
langKz: "Казахский",
|
|
2542
|
+
langRu: "Русский",
|
|
2543
|
+
langEn: "Английский",
|
|
2544
|
+
chatTab: "💬 Чат",
|
|
2545
|
+
settingsTab: "♿ Настройки",
|
|
2546
|
+
brandSub: "Инклюзия",
|
|
2547
|
+
madeIn: "Сделано в Казахстане 🇰🇿",
|
|
2548
|
+
voiceBtnInit: "Нажмите",
|
|
2549
|
+
voiceBtnRec: "Запись...",
|
|
2550
|
+
micBannerRec: "🎙️ Слушаю... (остановлюсь по тишине)",
|
|
2551
|
+
micBannerWait: "⏳ Распознаю речь...",
|
|
2552
|
+
micBannerErr: "⚠️",
|
|
2553
|
+
micAriaL: "Включить голосовой ввод (удерживайте для записи)",
|
|
2554
|
+
inputAriaL: "Текстовое поле ввода сообщения",
|
|
2555
|
+
inputPl: "Введите сообщение...",
|
|
2556
|
+
ttsAriaOn: "Выключить озвучку ответа",
|
|
2557
|
+
ttsAriaOff: "Включить озвучку ответа",
|
|
2558
|
+
sendAria: "Отправить сообщение",
|
|
2559
|
+
onPage: "На странице:",
|
|
2560
|
+
emptyChatTitle: "Ваш помощник",
|
|
2561
|
+
emptyChatSub: "Опишите задачу — я найду нужные кнопки и заполню поля за вас.",
|
|
2562
|
+
confirmAction: "✅ Подтвердить действие",
|
|
2563
|
+
cancelAction: "Отменить",
|
|
2564
|
+
textScale: "Размер текста",
|
|
2565
|
+
monochrome: "Ч/Б",
|
|
2566
|
+
monochromeVal: "Монохром",
|
|
2567
|
+
contrast: "Контраст",
|
|
2568
|
+
contrastVal: "Тёмный",
|
|
2569
|
+
links: "Ссылки",
|
|
2570
|
+
linksVal: "Выделить",
|
|
2571
|
+
spacing: "Отступы",
|
|
2572
|
+
spacingVal: "Увеличить",
|
|
2573
|
+
font: "Шрифт",
|
|
2574
|
+
fontVal: "Дислексия",
|
|
2575
|
+
cursor: "Курсор",
|
|
2576
|
+
cursorVal: "Увеличить",
|
|
2577
|
+
colorSettingsTitle: "Настройка цвета",
|
|
2578
|
+
colorBg: "Фон",
|
|
2579
|
+
colorHeader: "Шапка",
|
|
2580
|
+
colorText: "Текст",
|
|
2581
|
+
aiSimplifyTitle: "AI Упрощение текста",
|
|
2582
|
+
aiBlindTitle: "Режим для незрячих (AI)",
|
|
2583
|
+
on: "ВКЛ",
|
|
2584
|
+
off: "ВЫКЛ",
|
|
2585
|
+
closeAria: "Закрыть"
|
|
2586
|
+
},
|
|
2587
|
+
en: {
|
|
2588
|
+
langLabel: "Widget & Recognition Language",
|
|
2589
|
+
langKz: "Kazakh",
|
|
2590
|
+
langRu: "Russian",
|
|
2591
|
+
langEn: "English",
|
|
2592
|
+
chatTab: "💬 Chat",
|
|
2593
|
+
settingsTab: "♿ Settings",
|
|
2594
|
+
brandSub: "Inclusion",
|
|
2595
|
+
madeIn: "Made in Kazakhstan 🇰🇿",
|
|
2596
|
+
voiceBtnInit: "Press",
|
|
2597
|
+
voiceBtnRec: "Recording...",
|
|
2598
|
+
micBannerRec: "🎙️ Listening... (stops on silence)",
|
|
2599
|
+
micBannerWait: "⏳ Recognizing...",
|
|
2600
|
+
micBannerErr: "⚠️",
|
|
2601
|
+
micAriaL: "Enable voice input (hold to record)",
|
|
2602
|
+
inputAriaL: "Text input field",
|
|
2603
|
+
inputPl: "Type a message...",
|
|
2604
|
+
ttsAriaOn: "Disable answer TTS",
|
|
2605
|
+
ttsAriaOff: "Enable answer TTS",
|
|
2606
|
+
sendAria: "Send message",
|
|
2607
|
+
onPage: "On page:",
|
|
2608
|
+
emptyChatTitle: "Your Assistant",
|
|
2609
|
+
emptyChatSub: "Describe the task — I will find buttons and fill fields for you.",
|
|
2610
|
+
confirmAction: "✅ Confirm Action",
|
|
2611
|
+
cancelAction: "Cancel",
|
|
2612
|
+
textScale: "Text size",
|
|
2613
|
+
monochrome: "B/W",
|
|
2614
|
+
monochromeVal: "Monochrome",
|
|
2615
|
+
contrast: "Contrast",
|
|
2616
|
+
contrastVal: "Dark",
|
|
2617
|
+
links: "Links",
|
|
2618
|
+
linksVal: "Highlight",
|
|
2619
|
+
spacing: "Spacing",
|
|
2620
|
+
spacingVal: "Increase",
|
|
2621
|
+
font: "Font",
|
|
2622
|
+
fontVal: "Dyslexia",
|
|
2623
|
+
cursor: "Cursor",
|
|
2624
|
+
cursorVal: "Increase",
|
|
2625
|
+
colorSettingsTitle: "Color Settings",
|
|
2626
|
+
colorBg: "Bg",
|
|
2627
|
+
colorHeader: "Header",
|
|
2628
|
+
colorText: "Text",
|
|
2629
|
+
aiSimplifyTitle: "AI Text Simplification",
|
|
2630
|
+
aiBlindTitle: "Blind Mode (AI)",
|
|
2631
|
+
on: "ON",
|
|
2632
|
+
off: "OFF",
|
|
2633
|
+
closeAria: "Close"
|
|
2634
|
+
}
|
|
2635
|
+
}, $ = class extends W {
|
|
2636
|
+
static {
|
|
2637
|
+
this.styles = [ot];
|
|
2638
|
+
}
|
|
2639
|
+
constructor() {
|
|
2640
|
+
super(), this._a11y = new ct(this), this._aiA11y = new ut(this), this._chat = new gt(this), this.clientId = "", this._isOpen = !1, this._activeTab = "chat", this._inputValue = "", this._isAdmin = !1, this._adminPassword = "", this._authError = "", this._currentScreenLabel = "", this._sttState = "idle", this._sttLanguageMode = "ru", this._sttError = "", this._adminClickCount = 0, this._showAdminLogin = !1, this._mediaStream = null, this._audioContext = null, this._analyser = null, this._scriptProcessor = null, this._pcmChunks = [], this._sampleRate = 44100, this._recordingStartTs = 0, this._silenceStartedTs = null, this._silenceIntervalId = null, this._maxDurationTimeoutId = null, this._adminClickTimer = null, this._handleGlobalKeydown = (e) => {
|
|
2641
|
+
this._isOpen && e.altKey && e.code === "KeyV" && (e.preventDefault(), this._toggleVoice());
|
|
2642
|
+
};
|
|
2643
|
+
try {
|
|
2644
|
+
let e = localStorage.getItem(_t);
|
|
2645
|
+
(e === "kz" || e === "ru" || e === "en") && (this._sttLanguageMode = e);
|
|
2646
|
+
} catch {}
|
|
2647
|
+
this._checkAuthStatus();
|
|
2648
|
+
}
|
|
2649
|
+
_setSttLanguageMode(e) {
|
|
2650
|
+
this._sttLanguageMode = e;
|
|
2651
|
+
try {
|
|
2652
|
+
localStorage.setItem(_t, e);
|
|
2653
|
+
} catch {}
|
|
2654
|
+
}
|
|
2655
|
+
async _checkAuthStatus() {
|
|
2656
|
+
let e = localStorage.getItem("bw_admin_token");
|
|
2657
|
+
if (e) try {
|
|
2658
|
+
(await fetch("http://localhost:8000/auth/login/widget/verify", { headers: { Authorization: `Bearer ${e}` } })).ok ? (this._isAdmin = !0, this._loadAdminUI()) : localStorage.removeItem("bw_admin_token");
|
|
2659
|
+
} catch {
|
|
2660
|
+
try {
|
|
2661
|
+
let t = JSON.parse(atob(e.split(".")[1]));
|
|
2662
|
+
t.exp * 1e3 > Date.now() && t.role === "admin" ? (this._isAdmin = !0, this._loadAdminUI()) : localStorage.removeItem("bw_admin_token");
|
|
2663
|
+
} catch {
|
|
2664
|
+
localStorage.removeItem("bw_admin_token");
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
async _loadAdminUI() {
|
|
2669
|
+
try {
|
|
2670
|
+
let { initAdminMode: e } = await import("./AdminUI-CGKuDZdZ.js");
|
|
2671
|
+
e(), t.isAutoDiscoveryEnabled = !0;
|
|
2672
|
+
} catch (e) {
|
|
2673
|
+
console.error("Admin UI load failed", e);
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
async _handleAdminLogin() {
|
|
2677
|
+
if (this._authError = "", !this.clientId) {
|
|
2678
|
+
this._authError = "Client ID not configured";
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
try {
|
|
2682
|
+
let e = await fetch("http://localhost:8000/auth/login/widget", {
|
|
2683
|
+
method: "POST",
|
|
2684
|
+
headers: { "Content-Type": "application/json" },
|
|
2685
|
+
body: JSON.stringify({
|
|
2686
|
+
client_public_id: this.clientId,
|
|
2687
|
+
admin_key: this._adminPassword
|
|
2688
|
+
})
|
|
2689
|
+
});
|
|
2690
|
+
if (e.ok) {
|
|
2691
|
+
let { access_token: t } = await e.json();
|
|
2692
|
+
localStorage.setItem("bw_admin_token", t), this._isAdmin = !0, this._showAdminLogin = !1, this._loadAdminUI();
|
|
2693
|
+
} else this._authError = (await e.json().catch(() => ({}))).detail || "Invalid admin key";
|
|
2694
|
+
} catch {
|
|
2695
|
+
this._authError = "Connection failed";
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
_handleAdminLogout() {
|
|
2699
|
+
localStorage.removeItem("bw_admin_token"), this._isAdmin = !1, this._adminPassword = "", this._showAdminLogin = !1, t.isAutoDiscoveryEnabled = !1, document.querySelector("#bw-admin-wrapper")?.remove();
|
|
2700
|
+
}
|
|
2701
|
+
_handleLogoClick() {
|
|
2702
|
+
this._adminClickCount++, this._adminClickCount >= 5 && (this._showAdminLogin = !this._showAdminLogin, this._adminClickCount = 0), this._adminClickTimer && clearTimeout(this._adminClickTimer), this._adminClickTimer = setTimeout(() => {
|
|
2703
|
+
this._adminClickCount = 0;
|
|
2704
|
+
}, 2e3);
|
|
2705
|
+
}
|
|
2706
|
+
connectedCallback() {
|
|
2707
|
+
super.connectedCallback(), t.start(), t.onStateChange(async (e) => {
|
|
2708
|
+
try {
|
|
2709
|
+
let t = await fetch("http://localhost:8000/v1/training/match-screen", {
|
|
2710
|
+
method: "POST",
|
|
2711
|
+
headers: {
|
|
2712
|
+
"Content-Type": "application/json",
|
|
2713
|
+
"X-Client-ID": this.clientId || window.__BARIWEB_CLIENT_ID__ || ""
|
|
2714
|
+
},
|
|
2715
|
+
body: JSON.stringify({ fingerprint: e.fingerprint })
|
|
2716
|
+
});
|
|
2717
|
+
if (t.ok) {
|
|
2718
|
+
let e = await t.json();
|
|
2719
|
+
this._currentScreenLabel = e.matched ? e.label : "";
|
|
2720
|
+
}
|
|
2721
|
+
} catch {}
|
|
2722
|
+
}), window.addEventListener("keydown", this._handleGlobalKeydown);
|
|
2723
|
+
}
|
|
2724
|
+
disconnectedCallback() {
|
|
2725
|
+
super.disconnectedCallback(), t.stop(), this._cleanupRecording(), window.removeEventListener("keydown", this._handleGlobalKeydown);
|
|
2726
|
+
}
|
|
2727
|
+
_beep(e) {
|
|
2728
|
+
let t = new (window.AudioContext || window.webkitAudioContext)(), n = t.createOscillator(), r = t.createGain();
|
|
2729
|
+
n.type = "sine", n.frequency.setValueAtTime(e, t.currentTime), r.gain.setValueAtTime(.1, t.currentTime), r.gain.exponentialRampToValueAtTime(1e-5, t.currentTime + .1), n.connect(r), r.connect(t.destination), n.start(), n.stop(t.currentTime + .1);
|
|
2730
|
+
}
|
|
2731
|
+
_toggle() {
|
|
2732
|
+
this._isOpen = !this._isOpen;
|
|
2733
|
+
}
|
|
2734
|
+
setOpen(e) {
|
|
2735
|
+
this._isOpen = e;
|
|
2736
|
+
}
|
|
2737
|
+
_setTab(e) {
|
|
2738
|
+
this._activeTab = e;
|
|
2739
|
+
}
|
|
2740
|
+
_handleInput(e) {
|
|
2741
|
+
this._inputValue = e.target.value;
|
|
2742
|
+
}
|
|
2743
|
+
_handleKeydown(e) {
|
|
2744
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this._handleSend()), e.code === "Space" && e.target.tagName !== "INPUT" && (e.preventDefault(), this._sttState === "idle" && this._startRecording());
|
|
2745
|
+
}
|
|
2746
|
+
async _handleSend() {
|
|
2747
|
+
let e = this._inputValue.trim();
|
|
2748
|
+
!e || this._chat.isLoading || this._sttState !== "idle" || (this._inputValue = "", await this._chat.sendMessage(e, !1), this._scrollMessages());
|
|
2749
|
+
}
|
|
2750
|
+
_scrollMessages() {
|
|
2751
|
+
this.updateComplete.then(() => {
|
|
2752
|
+
this._messagesEl && (this._messagesEl.scrollTop = this._messagesEl.scrollHeight);
|
|
2753
|
+
});
|
|
2754
|
+
}
|
|
2755
|
+
_getCurrentHue() {
|
|
2756
|
+
let e = this._a11y.settings;
|
|
2757
|
+
return e.activeColorTab === "background" ? e.customBgHue || 0 : e.activeColorTab === "header" ? e.customHeaderHue || 0 : e.customContentHue || 0;
|
|
2758
|
+
}
|
|
2759
|
+
_clearSttTimers() {
|
|
2760
|
+
this._silenceIntervalId !== null && (window.clearInterval(this._silenceIntervalId), this._silenceIntervalId = null), this._maxDurationTimeoutId !== null && (window.clearTimeout(this._maxDurationTimeoutId), this._maxDurationTimeoutId = null);
|
|
2761
|
+
}
|
|
2762
|
+
_cleanupRecording() {
|
|
2763
|
+
this._clearSttTimers(), this._analyser = null, this._scriptProcessor &&= (this._scriptProcessor.disconnect(), this._scriptProcessor.onaudioprocess = null, null), this._audioContext &&= (this._audioContext.close().catch(() => {}), null), this._mediaStream &&= (this._mediaStream.getTracks().forEach((e) => e.stop()), null), this._pcmChunks = [], this._silenceStartedTs = null;
|
|
2764
|
+
}
|
|
2765
|
+
async _toggleVoice() {
|
|
2766
|
+
if (this._sttState !== "processing") {
|
|
2767
|
+
if (this._sttState === "recording") {
|
|
2768
|
+
this._stopRecording();
|
|
2769
|
+
return;
|
|
2770
|
+
}
|
|
2771
|
+
await this._startRecording();
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
async _startRecording() {
|
|
2775
|
+
if (!navigator.mediaDevices?.getUserMedia) {
|
|
2776
|
+
this._sttState = "error", this._sttError = "Микрофон не поддерживается.";
|
|
2777
|
+
return;
|
|
2778
|
+
}
|
|
2779
|
+
try {
|
|
2780
|
+
this._cleanupRecording(), this._sttError = "";
|
|
2781
|
+
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
2782
|
+
this._mediaStream = e, this._pcmChunks = [], this._recordingStartTs = Date.now(), this._silenceStartedTs = null, this._audioContext = new AudioContext(), this._sampleRate = this._audioContext.sampleRate;
|
|
2783
|
+
let t = this._audioContext.createMediaStreamSource(e);
|
|
2784
|
+
this._analyser = this._audioContext.createAnalyser(), this._analyser.fftSize = 2048, t.connect(this._analyser), this._scriptProcessor = this._audioContext.createScriptProcessor(4096, 1, 1), t.connect(this._scriptProcessor), this._scriptProcessor.connect(this._audioContext.destination), this._scriptProcessor.onaudioprocess = (e) => {
|
|
2785
|
+
this._sttState === "recording" && (this._pcmChunks.push(new Float32Array(e.inputBuffer.getChannelData(0))), e.outputBuffer.getChannelData(0).fill(0));
|
|
2786
|
+
}, this._sttState = "recording", this._beep(880), this._maxDurationTimeoutId = window.setTimeout(() => {
|
|
2787
|
+
this._sttState === "recording" && this._stopRecording();
|
|
2788
|
+
}, xt);
|
|
2789
|
+
let n = new Uint8Array(this._analyser.fftSize);
|
|
2790
|
+
this._silenceIntervalId = window.setInterval(() => {
|
|
2791
|
+
if (!this._analyser || this._sttState !== "recording") return;
|
|
2792
|
+
this._analyser.getByteTimeDomainData(n);
|
|
2793
|
+
let e = 0;
|
|
2794
|
+
for (let t = 0; t < n.length; t++) {
|
|
2795
|
+
let r = (n[t] - 128) / 128;
|
|
2796
|
+
e += r * r;
|
|
2797
|
+
}
|
|
2798
|
+
Math.sqrt(e / n.length) < yt ? this._silenceStartedTs ? Date.now() - this._silenceStartedTs >= bt && this._stopRecording() : this._silenceStartedTs = Date.now() : this._silenceStartedTs = null;
|
|
2799
|
+
}, vt);
|
|
2800
|
+
} catch {
|
|
2801
|
+
this._sttState = "error", this._sttError = "Нет доступа к микрофону.", this._cleanupRecording();
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
_stopRecording() {
|
|
2805
|
+
this._sttState === "recording" && (this._clearSttTimers(), this._sttState = "processing", this._beep(440), this._finalizeRecording().catch((e) => {
|
|
2806
|
+
this._sttState = "error", this._sttError = e?.message || "Ошибка обработки.";
|
|
2807
|
+
}));
|
|
2808
|
+
}
|
|
2809
|
+
async _finalizeRecording() {
|
|
2810
|
+
let e = Date.now() - this._recordingStartTs, t = this._pcmChunks.reduce((e, t) => e + t.length, 0), n = new Float32Array(t), r = 0;
|
|
2811
|
+
for (let e of this._pcmChunks) n.set(e, r), r += e.length;
|
|
2812
|
+
let i = this._encodeWav(n, this._sampleRate);
|
|
2813
|
+
if (this._cleanupRecording(), e < St || i.size === 0) {
|
|
2814
|
+
this._sttState = "error", this._sttError = "Слишком короткая запись.";
|
|
2815
|
+
return;
|
|
2816
|
+
}
|
|
2817
|
+
try {
|
|
2818
|
+
let e = (await this._chat.transcribeAudio(i, this._sttLanguageMode)).text?.trim();
|
|
2819
|
+
if (!e) {
|
|
2820
|
+
this._sttState = "error", this._sttError = "Речь не распознана.";
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
await this._chat.sendMessage(e, !0), this._sttState = "idle", this._sttError = "", this._inputValue = "", this._scrollMessages();
|
|
2824
|
+
} catch (e) {
|
|
2825
|
+
this._sttState = "error", this._sttError = e?.message || "Ошибка распознавания.";
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
_encodeWav(e, t) {
|
|
2829
|
+
let n = t * 2, r = e.length * 2, i = new ArrayBuffer(44 + r), a = new DataView(i), o = (e, t) => {
|
|
2830
|
+
for (let n = 0; n < t.length; n++) a.setUint8(e + n, t.charCodeAt(n));
|
|
2831
|
+
};
|
|
2832
|
+
o(0, "RIFF"), a.setUint32(4, 36 + r, !0), o(8, "WAVE"), o(12, "fmt "), a.setUint32(16, 16, !0), a.setUint16(20, 1, !0), a.setUint16(22, 1, !0), a.setUint32(24, t, !0), a.setUint32(28, n, !0), a.setUint16(32, 2, !0), a.setUint16(34, 16, !0), o(36, "data"), a.setUint32(40, r, !0);
|
|
2833
|
+
let s = 44;
|
|
2834
|
+
for (let t = 0; t < e.length; t++) {
|
|
2835
|
+
let n = Math.max(-1, Math.min(1, e[t]));
|
|
2836
|
+
a.setInt16(s, n < 0 ? n * 32768 : n * 32767, !0), s += 2;
|
|
2837
|
+
}
|
|
2838
|
+
return new Blob([i], { type: "audio/wav" });
|
|
2839
|
+
}
|
|
2840
|
+
_vibrate() {
|
|
2841
|
+
"vibrate" in navigator && navigator.vibrate(20);
|
|
2842
|
+
}
|
|
2843
|
+
_renderChatTab() {
|
|
2844
|
+
let e = Q[this._sttLanguageMode], t = this._chat.messages, n = this._chat.isLoading, r = this._chat.pendingConfirmation, i = n || this._sttState !== "idle";
|
|
2845
|
+
return F`
|
|
2846
|
+
<div class="chat-messages" id="bw-chat-messages">
|
|
2847
|
+
${this._currentScreenLabel ? F`
|
|
2848
|
+
<div class="screen-label-badge">
|
|
2849
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" width="12" height="12"><polyline points="20 6 9 17 4 12"/></svg>
|
|
2850
|
+
${e.onPage} <strong>${this._currentScreenLabel}</strong>
|
|
2851
|
+
</div>
|
|
2852
|
+
` : ""}
|
|
2853
|
+
|
|
2854
|
+
${t.length === 0 ? F`
|
|
2855
|
+
<div class="chat-empty">
|
|
2856
|
+
${J.accessibility}
|
|
2857
|
+
<p class="chat-empty-title">${e.emptyChatTitle}</p>
|
|
2858
|
+
<p class="chat-empty-sub">${e.emptyChatSub}</p>
|
|
2859
|
+
</div>
|
|
2860
|
+
` : t.map((e) => e.role === "assistant" && (e.text.includes("✅") || e.text.includes("⌨️") || e.text.includes("🔄")) ? F`
|
|
2861
|
+
<details class="system-log">
|
|
2862
|
+
<summary class="system-log-header"><span>${e.text.split("\n")[0]}</span></summary>
|
|
2863
|
+
<div class="system-log-details">${e.text}</div>
|
|
2864
|
+
</details>` : F`<div class="chat-bubble ${e.role}">${e.text}</div>`)}
|
|
2865
|
+
|
|
2866
|
+
${n ? F`
|
|
2867
|
+
<div class="typing-indicator">
|
|
2868
|
+
<div class="typing-dot"></div><div class="typing-dot"></div><div class="typing-dot"></div>
|
|
2869
|
+
</div>` : ""}
|
|
2870
|
+
</div>
|
|
2871
|
+
|
|
2872
|
+
${r ? F`
|
|
2873
|
+
<div class="confirm-panel">
|
|
2874
|
+
<button class="btn-confirm" @click=${() => this._chat.confirmAction()} id="bw-confirm-action">
|
|
2875
|
+
${e.confirmAction}
|
|
2876
|
+
</button>
|
|
2877
|
+
<button class="btn-cancel" @click=${() => this._chat.cancelAction()} id="bw-cancel-action">
|
|
2878
|
+
${e.cancelAction}
|
|
2879
|
+
</button>
|
|
2880
|
+
</div>
|
|
2881
|
+
` : F`
|
|
2882
|
+
<div class="chat-input-area">
|
|
2883
|
+
${this._sttState === "idle" ? "" : F`
|
|
2884
|
+
<div class="stt-banner ${this._sttState}">
|
|
2885
|
+
${this._sttState === "recording" ? e.micBannerRec : this._sttState === "processing" ? e.micBannerWait : `${e.micBannerErr} ${this._sttError}`}
|
|
2886
|
+
</div>`}
|
|
2887
|
+
<div class="chat-input-row">
|
|
2888
|
+
<!-- 🎙️ Primary Mic Button (Large Target Size) -->
|
|
2889
|
+
<button class="chat-icon-btn ${this._sttState === "recording" ? "recording" : ""}"
|
|
2890
|
+
@mouseenter=${this._vibrate}
|
|
2891
|
+
@focus=${this._vibrate}
|
|
2892
|
+
@mousedown=${this._startRecording}
|
|
2893
|
+
@mouseup=${this._stopRecording}
|
|
2894
|
+
@touchstart=${(e) => {
|
|
2895
|
+
e.preventDefault(), this._startRecording(), this._vibrate();
|
|
2896
|
+
}}
|
|
2897
|
+
@touchend=${(e) => {
|
|
2898
|
+
e.preventDefault(), this._stopRecording();
|
|
2899
|
+
}}
|
|
2900
|
+
@click=${this._toggleVoice}
|
|
2901
|
+
?disabled=${this._sttState === "processing" || n}
|
|
2902
|
+
id="bw-voice-btn"
|
|
2903
|
+
aria-label="${e.micAriaL}">
|
|
2904
|
+
${J.mic}
|
|
2905
|
+
</button>
|
|
2906
|
+
|
|
2907
|
+
<input
|
|
2908
|
+
class="chat-input"
|
|
2909
|
+
type="text"
|
|
2910
|
+
placeholder="${e.inputPl}"
|
|
2911
|
+
.value=${this._inputValue}
|
|
2912
|
+
@input=${this._handleInput}
|
|
2913
|
+
@keydown=${this._handleKeydown}
|
|
2914
|
+
?disabled=${i}
|
|
2915
|
+
id="bw-chat-input"
|
|
2916
|
+
aria-label="${e.inputAriaL}"
|
|
2917
|
+
/>
|
|
2918
|
+
|
|
2919
|
+
<!-- ▶ Send Button -->
|
|
2920
|
+
<button class="chat-send-btn" @click=${this._handleSend}
|
|
2921
|
+
?disabled=${!this._inputValue.trim() || i}
|
|
2922
|
+
id="bw-send-btn"
|
|
2923
|
+
aria-label="${e.sendAria}">
|
|
2924
|
+
${J.send}
|
|
2925
|
+
</button>
|
|
2926
|
+
</div>
|
|
2927
|
+
</div>
|
|
2928
|
+
`}
|
|
2929
|
+
`;
|
|
2930
|
+
}
|
|
2931
|
+
_renderA11yTab() {
|
|
2932
|
+
let e = Q[this._sttLanguageMode], t = this._a11y.settings, n = [
|
|
2933
|
+
{
|
|
2934
|
+
id: "bw-tile-textscale",
|
|
2935
|
+
icon: J.textSize,
|
|
2936
|
+
label: e.textScale,
|
|
2937
|
+
value: `${Math.round(t.textScale * 100)}%`,
|
|
2938
|
+
active: t.textScale > 1,
|
|
2939
|
+
action: () => this._a11y.incrementTextScale()
|
|
2940
|
+
},
|
|
2941
|
+
{
|
|
2942
|
+
id: "bw-tile-monochrome",
|
|
2943
|
+
icon: J.visualImpair,
|
|
2944
|
+
label: e.monochrome,
|
|
2945
|
+
value: e.monochromeVal,
|
|
2946
|
+
active: t.monochrome,
|
|
2947
|
+
action: () => this._a11y.toggleMonochrome()
|
|
2948
|
+
},
|
|
2949
|
+
{
|
|
2950
|
+
id: "bw-tile-contrast",
|
|
2951
|
+
icon: J.moon,
|
|
2952
|
+
label: e.contrast,
|
|
2953
|
+
value: e.contrastVal,
|
|
2954
|
+
active: t.darkHighContrast,
|
|
2955
|
+
action: () => this._a11y.toggleDarkHighContrast()
|
|
2956
|
+
},
|
|
2957
|
+
{
|
|
2958
|
+
id: "bw-tile-links",
|
|
2959
|
+
icon: J.visualImpair,
|
|
2960
|
+
label: e.links,
|
|
2961
|
+
value: e.linksVal,
|
|
2962
|
+
active: t.linkHighlight,
|
|
2963
|
+
action: () => this._a11y.toggleLinkHighlight()
|
|
2964
|
+
},
|
|
2965
|
+
{
|
|
2966
|
+
id: "bw-tile-spacing",
|
|
2967
|
+
icon: J.textSize,
|
|
2968
|
+
label: e.spacing,
|
|
2969
|
+
value: e.spacingVal,
|
|
2970
|
+
active: t.textSpacing,
|
|
2971
|
+
action: () => this._a11y.toggleTextSpacing()
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
id: "bw-tile-font",
|
|
2975
|
+
icon: J.textSize,
|
|
2976
|
+
label: e.font,
|
|
2977
|
+
value: e.fontVal,
|
|
2978
|
+
active: t.dyslexicFont,
|
|
2979
|
+
action: () => this._a11y.toggleDyslexicFont()
|
|
2980
|
+
},
|
|
2981
|
+
{
|
|
2982
|
+
id: "bw-tile-cursor",
|
|
2983
|
+
icon: J.cursor,
|
|
2984
|
+
label: e.cursor,
|
|
2985
|
+
value: e.cursorVal,
|
|
2986
|
+
active: t.cursorMagnifier,
|
|
2987
|
+
action: () => this._a11y.toggleCursorMagnifier()
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
id: "bw-tile-voice",
|
|
2991
|
+
icon: null,
|
|
2992
|
+
label: e.voiceBtnInit,
|
|
2993
|
+
value: this._sttState === "recording" ? e.voiceBtnRec : e.voiceBtnInit,
|
|
2994
|
+
active: this._sttState === "recording",
|
|
2995
|
+
action: () => this._toggleVoice()
|
|
2996
|
+
}
|
|
2997
|
+
];
|
|
2998
|
+
return F`
|
|
2999
|
+
<div class="a11y-scroller">
|
|
3000
|
+
|
|
3001
|
+
<!-- Language config mapped to TOP of settings tab -->
|
|
3002
|
+
<div style="padding: 16px 16px 0;">
|
|
3003
|
+
<div style="display: flex; align-items: center; justify-content: space-between; padding: 12px; background: var(--bw-bg-subtle, #f8fafc); border-radius: var(--bw-radius, 14px); margin-bottom: 0px;">
|
|
3004
|
+
<div style="display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; color: var(--bw-fg, #1e293b);">
|
|
3005
|
+
${J.languages} ${e.langLabel}
|
|
3006
|
+
</div>
|
|
3007
|
+
<select style="height: 34px; padding: 0 8px; border: 1px solid var(--bw-primary, #6d28d9); border-radius: 8px; background: rgba(109, 40, 217, 0.05); color: var(--bw-primary, #6d28d9); cursor: pointer; outline: none; font-size: 13px; font-weight: 600;"
|
|
3008
|
+
.value=${this._sttLanguageMode}
|
|
3009
|
+
@change=${(e) => {
|
|
3010
|
+
this._setSttLanguageMode(e.target.value), this.requestUpdate();
|
|
3011
|
+
}}
|
|
3012
|
+
aria-label="${e.langLabel}">
|
|
3013
|
+
<option value="kz">${Q.kz.langKz}</option>
|
|
3014
|
+
<option value="ru">${Q.ru.langRu}</option>
|
|
3015
|
+
<option value="en">${Q.en.langEn}</option>
|
|
3016
|
+
</select>
|
|
3017
|
+
</div>
|
|
3018
|
+
</div>
|
|
3019
|
+
|
|
3020
|
+
<div class="settings-grid">
|
|
3021
|
+
${n.map((e) => F`
|
|
3022
|
+
<button class="settings-card" ?active=${e.active} @click=${e.action} id=${e.id}
|
|
3023
|
+
aria-pressed=${e.active ? "true" : "false"} aria-label=${e.label}>
|
|
3024
|
+
${e.icon || J.mic}
|
|
3025
|
+
<span class="settings-card-label">${e.label}</span>
|
|
3026
|
+
<span class="settings-card-value">${e.value}</span>
|
|
3027
|
+
${e.active ? F`<span class="active-badge">${J.check}</span>` : ""}
|
|
3028
|
+
</button>
|
|
3029
|
+
`)}
|
|
3030
|
+
</div>
|
|
3031
|
+
|
|
3032
|
+
<div class="color-section">
|
|
3033
|
+
<div class="color-section-header">
|
|
3034
|
+
${J.droplet}
|
|
3035
|
+
<h4 class="color-section-title">${e.colorSettingsTitle}</h4>
|
|
3036
|
+
</div>
|
|
3037
|
+
<div class="color-tabs">
|
|
3038
|
+
<button class="color-tab" ?active=${t.activeColorTab === "background"}
|
|
3039
|
+
@click=${() => {
|
|
3040
|
+
t.activeColorTab = "background", this.requestUpdate();
|
|
3041
|
+
}}>${e.colorBg}</button>
|
|
3042
|
+
<button class="color-tab" ?active=${t.activeColorTab === "header"}
|
|
3043
|
+
@click=${() => {
|
|
3044
|
+
t.activeColorTab = "header", this.requestUpdate();
|
|
3045
|
+
}}>${e.colorHeader}</button>
|
|
3046
|
+
<button class="color-tab" ?active=${t.activeColorTab === "content"}
|
|
3047
|
+
@click=${() => {
|
|
3048
|
+
t.activeColorTab = "content", this.requestUpdate();
|
|
3049
|
+
}}>${e.colorText}</button>
|
|
3050
|
+
</div>
|
|
3051
|
+
<div class="hue-row">
|
|
3052
|
+
<button class="hue-step-btn" @click=${() => this._a11y.setCustomHue((this._getCurrentHue() - 15 + 360) % 360)} aria-label="Уменьшить">–</button>
|
|
3053
|
+
<input type="range" class="hue-slider" min="0" max="360"
|
|
3054
|
+
.value=${String(this._getCurrentHue())}
|
|
3055
|
+
@input=${(e) => this._a11y.setCustomHue(parseInt(e.target.value))}
|
|
3056
|
+
aria-label="Оттенок" />
|
|
3057
|
+
<button class="hue-step-btn" @click=${() => this._a11y.setCustomHue((this._getCurrentHue() + 15) % 360)} aria-label="Увеличить">+</button>
|
|
3058
|
+
</div>
|
|
3059
|
+
</div>
|
|
3060
|
+
|
|
3061
|
+
<div class="ai-tools-section" style="margin-top: 16px;">
|
|
3062
|
+
<button class="ai-tool-btn ${this._aiA11y.simplifyEnabled ? "active" : ""}"
|
|
3063
|
+
@click=${() => this._aiA11y.toggleSimplify()} id="bw-ai-simplify">
|
|
3064
|
+
${J.textSize}
|
|
3065
|
+
<span class="ai-tool-btn-label">${e.aiSimplifyTitle}</span>
|
|
3066
|
+
<span class="ai-tool-badge ${this._aiA11y.simplifyEnabled ? "on" : ""}">
|
|
3067
|
+
${this._aiA11y.simplifyEnabled ? e.on : e.off}
|
|
3068
|
+
</span>
|
|
3069
|
+
</button>
|
|
3070
|
+
|
|
3071
|
+
<button class="ai-tool-btn ${this._aiA11y.autoA11yEnabled ? "active" : ""}"
|
|
3072
|
+
@click=${() => this._aiA11y.toggleAutoA11y()}
|
|
3073
|
+
id="bw-ai-fix">
|
|
3074
|
+
${J.accessibility}
|
|
3075
|
+
<span class="ai-tool-btn-label">${e.aiBlindTitle}</span>
|
|
3076
|
+
<span class="ai-tool-badge ${this._aiA11y.autoA11yEnabled ? "on" : ""}">
|
|
3077
|
+
${this._aiA11y.autoA11yEnabled ? e.on : e.off}
|
|
3078
|
+
</span>
|
|
3079
|
+
</button>
|
|
3080
|
+
</div>
|
|
3081
|
+
</div>
|
|
3082
|
+
`;
|
|
3083
|
+
}
|
|
3084
|
+
_renderAdminOverlay() {
|
|
3085
|
+
return this._showAdminLogin ? F`
|
|
3086
|
+
<div class="admin-overlay">
|
|
3087
|
+
<div class="admin-icon">🔐</div>
|
|
3088
|
+
<h4>${this._isAdmin ? "Режим администратора" : "Admin доступ"}</h4>
|
|
3089
|
+
${this._isAdmin ? F`
|
|
3090
|
+
<p class="admin-status">✅ Вы вошли как администратор</p>
|
|
3091
|
+
<button class="admin-logout-btn" @click=${this._handleAdminLogout}>Выйти из аккаунта</button>
|
|
3092
|
+
` : F`
|
|
3093
|
+
<p>Введите ключ для активации режима обучения</p>
|
|
3094
|
+
<input type="password" placeholder="Admin Key"
|
|
3095
|
+
.value=${this._adminPassword}
|
|
3096
|
+
@input=${(e) => {
|
|
3097
|
+
this._adminPassword = e.target.value;
|
|
3098
|
+
}}
|
|
3099
|
+
@keydown=${(e) => {
|
|
3100
|
+
e.key === "Enter" && this._handleAdminLogin();
|
|
3101
|
+
}} />
|
|
3102
|
+
${this._authError ? F`<p class="auth-error">${this._authError}</p>` : ""}
|
|
3103
|
+
<button class="admin-login-btn" @click=${this._handleAdminLogin}>Войти</button>
|
|
3104
|
+
`}
|
|
3105
|
+
<button class="admin-close-btn" @click=${() => {
|
|
3106
|
+
this._showAdminLogin = !1, this._authError = "";
|
|
3107
|
+
}}>
|
|
3108
|
+
Закрыть
|
|
3109
|
+
</button>
|
|
3110
|
+
</div>
|
|
3111
|
+
` : "";
|
|
3112
|
+
}
|
|
3113
|
+
render() {
|
|
3114
|
+
let e = Q[this._sttLanguageMode];
|
|
3115
|
+
return F`
|
|
3116
|
+
<div class="widget-container">
|
|
3117
|
+
<!-- Panel -->
|
|
3118
|
+
<div class="bw-panel ${this._isOpen ? "panel-visible" : "panel-hidden"}"
|
|
3119
|
+
role="dialog" aria-modal="true" aria-label="BariWeb Accessibility Widget">
|
|
3120
|
+
|
|
3121
|
+
<!-- Header -->
|
|
3122
|
+
<div class="bw-header">
|
|
3123
|
+
<div class="header-branding" @click=${this._handleLogoClick} id="bw-logo">
|
|
3124
|
+
${J.accessibility}
|
|
3125
|
+
<div class="header-branding-text">
|
|
3126
|
+
<span class="header-brand-name">BariWeb</span>
|
|
3127
|
+
<span class="header-brand-sub">${e.brandSub}</span>
|
|
3128
|
+
</div>
|
|
3129
|
+
</div>
|
|
3130
|
+
<button class="close-btn" @click=${this._toggle} aria-label="${e.closeAria}" id="bw-close">
|
|
3131
|
+
${J.close}
|
|
3132
|
+
</button>
|
|
3133
|
+
</div>
|
|
3134
|
+
|
|
3135
|
+
<!-- Tabs -->
|
|
3136
|
+
<div class="bw-tabs" role="tablist">
|
|
3137
|
+
<button class="bw-tab" ?active=${this._activeTab === "chat"}
|
|
3138
|
+
@click=${() => this._setTab("chat")} role="tab"
|
|
3139
|
+
aria-selected=${this._activeTab === "chat"} id="bw-tab-chat">
|
|
3140
|
+
${e.chatTab}
|
|
3141
|
+
</button>
|
|
3142
|
+
<button class="bw-tab" ?active=${this._activeTab === "a11y"}
|
|
3143
|
+
@click=${() => this._setTab("a11y")} role="tab"
|
|
3144
|
+
aria-selected=${this._activeTab === "a11y"} id="bw-tab-settings">
|
|
3145
|
+
${e.settingsTab}
|
|
3146
|
+
</button>
|
|
3147
|
+
</div>
|
|
3148
|
+
|
|
3149
|
+
<!-- Content -->
|
|
3150
|
+
<div class="bw-content">
|
|
3151
|
+
<div class="tab-panel" ?active=${this._activeTab === "chat"} role="tabpanel">
|
|
3152
|
+
${this._renderChatTab()}
|
|
3153
|
+
</div>
|
|
3154
|
+
<div class="tab-panel" ?active=${this._activeTab === "a11y"} role="tabpanel">
|
|
3155
|
+
${this._renderA11yTab()}
|
|
3156
|
+
</div>
|
|
3157
|
+
${this._renderAdminOverlay()}
|
|
3158
|
+
</div>
|
|
3159
|
+
|
|
3160
|
+
<!-- Footer -->
|
|
3161
|
+
<div class="bw-footer" @click=${this._handleLogoClick}>
|
|
3162
|
+
<div class="footer-brand">
|
|
3163
|
+
${J.accessibility} BariWeb
|
|
3164
|
+
</div>
|
|
3165
|
+
<span>${e.madeIn}</span>
|
|
3166
|
+
</div>
|
|
3167
|
+
</div>
|
|
3168
|
+
|
|
3169
|
+
<!-- FAB Trigger -->
|
|
3170
|
+
<button class="trigger" @click=${this._toggle}
|
|
3171
|
+
aria-expanded=${this._isOpen} aria-label="Открыть/Закрыть меню доступности"
|
|
3172
|
+
id="bw-trigger" style="position:fixed; bottom:24px; left:24px; width:60px; height:60px; border-radius:50%; background:var(--bw-primary,#6d28d9); color:white; border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; pointer-events:auto; box-shadow:0 4px 20px rgba(109,40,217,0.4); transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s;">
|
|
3173
|
+
${this._isOpen ? J.close : J.accessibility}
|
|
3174
|
+
</button>
|
|
3175
|
+
</div>
|
|
3176
|
+
`;
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
Z([$e({
|
|
3180
|
+
type: String,
|
|
3181
|
+
attribute: "client-id"
|
|
3182
|
+
})], $.prototype, "clientId", void 0), Z([G()], $.prototype, "_isOpen", void 0), Z([G()], $.prototype, "_activeTab", void 0), Z([G()], $.prototype, "_inputValue", void 0), Z([G()], $.prototype, "_isAdmin", void 0), Z([G()], $.prototype, "_adminPassword", void 0), Z([G()], $.prototype, "_authError", void 0), Z([G()], $.prototype, "_currentScreenLabel", void 0), Z([G()], $.prototype, "_sttState", void 0), Z([G()], $.prototype, "_sttLanguageMode", void 0), Z([G()], $.prototype, "_sttError", void 0), Z([G()], $.prototype, "_adminClickCount", void 0), Z([G()], $.prototype, "_showAdminLogin", void 0), Z([tt(".chat-messages")], $.prototype, "_messagesEl", void 0), $ = Z([Xe("bw-widget")], $);
|
|
3183
|
+
//#endregion
|
|
3184
|
+
//#region src/index.ts
|
|
3185
|
+
var Ct = () => {
|
|
3186
|
+
let e = document.querySelector("bw-widget")?.getAttribute("client-id");
|
|
3187
|
+
if (e) return e;
|
|
3188
|
+
let t = (document.currentScript || document.querySelector("script[src*=\"bariweb\"]"))?.getAttribute("data-client-id");
|
|
3189
|
+
return t ||= document.querySelector("script[data-client-id]")?.getAttribute("data-client-id") || "", t || window.__BARIWEB_CLIENT_ID__ || "";
|
|
3190
|
+
}, wt = Ct();
|
|
3191
|
+
window.__BARIWEB_CLIENT_ID__ = wt, de.setConfig({ baseUrl: "http://localhost:8000" }), de.interceptors.request.use((e) => {
|
|
3192
|
+
let t = Ct();
|
|
3193
|
+
return e.headers.set("X-Client-ID", t), e;
|
|
3194
|
+
});
|
|
3195
|
+
//#endregion
|