@useknest/widget-core 0.1.0-beta.10 → 0.1.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +338 -298
- package/dist/persistence.d.ts +27 -0
- package/dist/persistence.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,6 @@ export { initWidgetAuth, getAccessToken, isAuthenticated, getSupabaseClient } fr
|
|
|
9
9
|
export { initWidgetSentry, captureWidgetException } from './sentry';
|
|
10
10
|
export { subscribeToThread } from './realtime';
|
|
11
11
|
export type { BroadcastMessage } from './realtime';
|
|
12
|
+
export { loadChatState, saveChatState, saveChatStateDebounced, clearChatState } from './persistence';
|
|
13
|
+
export type { PersistedChatState } from './persistence';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACX,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAG5F,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACX,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAG5F,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,EACN,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import { createClient as
|
|
2
|
-
import { marked as
|
|
3
|
-
import * as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return `${a}${
|
|
1
|
+
import { createClient as Se } from "@supabase/supabase-js";
|
|
2
|
+
import { marked as W } from "marked";
|
|
3
|
+
import * as q from "@sentry/browser";
|
|
4
|
+
const de = "https://useknest.com", ge = "/api/v1", Xe = "https://lghrsugmhzpccpriqhrx.supabase.co", je = "sb_publishable_-KUwilDA78QM849gk662FA_kEzMezNS";
|
|
5
|
+
function Ae(a = de) {
|
|
6
|
+
return `${a}${ge}/chat-messages`;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return `${a}${
|
|
8
|
+
function Te(a = de) {
|
|
9
|
+
return `${a}${ge}/widget-config`;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const be = "Sorry, I didn't get a response.", te = "Unknown error occurred", Ie = "This domain is not authorized. Please add it to your allowed origins in the Knest dashboard.", ye = "This chatbot has reached its usage limit. Please contact the site owner to upgrade their plan.", Ke = "https://useknest.com/default-avatar.svg", qe = "#3b82f6", Ve = "Hi! I'm your AI assistant. I'm trained to answer questions about your documentation. How can I help you today?", Ze = [
|
|
12
12
|
"How do I get started?",
|
|
13
13
|
"What features are available?",
|
|
14
14
|
"How do I integrate this?"
|
|
15
|
-
],
|
|
16
|
-
function
|
|
17
|
-
return
|
|
15
|
+
], Re = "knest-widget-config-", Oe = 1440 * 60 * 1e3;
|
|
16
|
+
function V(a) {
|
|
17
|
+
return Re + a;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function ve(a, u) {
|
|
20
20
|
try {
|
|
21
|
-
const e = localStorage.getItem(
|
|
21
|
+
const e = localStorage.getItem(V(a));
|
|
22
22
|
if (!e) return null;
|
|
23
|
-
const { config:
|
|
24
|
-
return Date.now() -
|
|
23
|
+
const { config: l, cachedAt: d } = JSON.parse(e);
|
|
24
|
+
return Date.now() - d > Oe ? (localStorage.removeItem(V(a)), null) : (u && l.updatedAt, l);
|
|
25
25
|
} catch {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Ne(a, u) {
|
|
30
30
|
try {
|
|
31
|
-
const e = { config:
|
|
32
|
-
localStorage.setItem(
|
|
31
|
+
const e = { config: u, cachedAt: Date.now() };
|
|
32
|
+
localStorage.setItem(V(a), JSON.stringify(e));
|
|
33
33
|
} catch {
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
async function
|
|
36
|
+
async function ne(a, u) {
|
|
37
37
|
try {
|
|
38
|
-
const e = await fetch(
|
|
38
|
+
const e = await fetch(Te(u), {
|
|
39
39
|
method: "GET",
|
|
40
40
|
headers: {
|
|
41
41
|
"X-Api-Key": a
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
if (e.ok) {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
45
|
+
const d = await e.json();
|
|
46
|
+
return Ne(a, d), { config: d, error: null };
|
|
47
47
|
}
|
|
48
48
|
if (e.status === 401 || e.status === 403) {
|
|
49
|
-
const
|
|
50
|
-
return console.warn("Widget config auth error:", e.status,
|
|
49
|
+
const d = await e.json().catch(() => ({}));
|
|
50
|
+
return console.warn("Widget config auth error:", e.status, d), { config: null, error: "auth" };
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
return console.warn("Failed to fetch widget config:", e.status,
|
|
52
|
+
const l = await e.text();
|
|
53
|
+
return console.warn("Failed to fetch widget config:", e.status, l), { config: null, error: "network" };
|
|
54
54
|
} catch (e) {
|
|
55
55
|
return console.error("Error fetching widget config:", e), { config: null, error: "network" };
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
}), { config:
|
|
58
|
+
async function Je(a, u, e) {
|
|
59
|
+
const l = ve(a);
|
|
60
|
+
return l ? (e && ne(a, u).then((d) => {
|
|
61
|
+
d.config && d.config.updatedAt !== l.updatedAt && e(d.config);
|
|
62
|
+
}), { config: l, error: null }) : ne(a, u);
|
|
63
63
|
}
|
|
64
|
-
let k = null,
|
|
65
|
-
async function
|
|
66
|
-
return x || (
|
|
64
|
+
let k = null, H = !1, x = null;
|
|
65
|
+
async function Qe(a, u) {
|
|
66
|
+
return x || (H && k ? !0 : (x = (async () => {
|
|
67
67
|
try {
|
|
68
|
-
k =
|
|
68
|
+
k = Se(a, u, {
|
|
69
69
|
auth: {
|
|
70
70
|
// Persist session in localStorage for cross-page persistence.
|
|
71
71
|
persistSession: !0,
|
|
@@ -77,9 +77,9 @@ async function je(a, g) {
|
|
|
77
77
|
data: { session: e }
|
|
78
78
|
} = await k.auth.getSession();
|
|
79
79
|
if (e)
|
|
80
|
-
return
|
|
81
|
-
const { error:
|
|
82
|
-
return
|
|
80
|
+
return H = !0, !0;
|
|
81
|
+
const { error: l } = await k.auth.signInAnonymously();
|
|
82
|
+
return l ? (console.error("Widget auth error:", l.message), !1) : (H = !0, !0);
|
|
83
83
|
} catch (e) {
|
|
84
84
|
return console.error("Widget auth initialization failed:", e), !1;
|
|
85
85
|
} finally {
|
|
@@ -87,7 +87,7 @@ async function je(a, g) {
|
|
|
87
87
|
}
|
|
88
88
|
})(), x));
|
|
89
89
|
}
|
|
90
|
-
async function
|
|
90
|
+
async function we() {
|
|
91
91
|
if (!k)
|
|
92
92
|
return null;
|
|
93
93
|
const {
|
|
@@ -95,49 +95,49 @@ async function ve() {
|
|
|
95
95
|
} = await k.auth.getSession();
|
|
96
96
|
return a?.access_token || null;
|
|
97
97
|
}
|
|
98
|
-
function Ne() {
|
|
99
|
-
return B;
|
|
100
|
-
}
|
|
101
98
|
function Fe() {
|
|
99
|
+
return H;
|
|
100
|
+
}
|
|
101
|
+
function Le() {
|
|
102
102
|
return k;
|
|
103
103
|
}
|
|
104
|
-
async function
|
|
105
|
-
const { publishableApiKey:
|
|
104
|
+
async function et(a) {
|
|
105
|
+
const { publishableApiKey: u, content: e, threadId: l, callbacks: d, baseUrl: h } = a;
|
|
106
106
|
try {
|
|
107
|
-
if (!
|
|
107
|
+
if (!Fe())
|
|
108
108
|
throw new Error("Widget not authenticated. Call initWidgetAuth() first.");
|
|
109
|
-
const
|
|
110
|
-
if (!
|
|
109
|
+
const A = await we();
|
|
110
|
+
if (!A)
|
|
111
111
|
throw new Error("No access token available. Please refresh and try again.");
|
|
112
112
|
const o = { content: e };
|
|
113
|
-
|
|
114
|
-
const m = await fetch(
|
|
113
|
+
l && (o.threadId = l);
|
|
114
|
+
const m = await fetch(Ae(h), {
|
|
115
115
|
method: "POST",
|
|
116
116
|
headers: {
|
|
117
117
|
"Content-Type": "application/json",
|
|
118
|
-
"X-Api-Key":
|
|
119
|
-
Authorization: `Bearer ${
|
|
118
|
+
"X-Api-Key": u,
|
|
119
|
+
Authorization: `Bearer ${A}`
|
|
120
120
|
},
|
|
121
121
|
credentials: "include",
|
|
122
122
|
body: JSON.stringify(o)
|
|
123
123
|
});
|
|
124
124
|
if (!m.ok) {
|
|
125
125
|
if (m.status === 401 || m.status === 403)
|
|
126
|
-
throw new Error(
|
|
126
|
+
throw new Error(Ie);
|
|
127
127
|
if (m.status === 429) {
|
|
128
128
|
const N = await m.json();
|
|
129
|
-
throw N.code === "USAGE_LIMIT_EXCEEDED" ? new Error(
|
|
129
|
+
throw N.code === "USAGE_LIMIT_EXCEEDED" ? new Error(ye) : new Error(N.error || "Rate limited");
|
|
130
130
|
}
|
|
131
131
|
const C = await m.json();
|
|
132
132
|
throw new Error(C.error || "Failed to send message");
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
134
|
+
const w = m.body?.getReader();
|
|
135
|
+
if (!w)
|
|
136
136
|
throw new Error("Response body is not readable");
|
|
137
137
|
const D = new TextDecoder();
|
|
138
138
|
let v = "", R = !1;
|
|
139
139
|
for (; ; ) {
|
|
140
|
-
const { done: C, value: N } = await
|
|
140
|
+
const { done: C, value: N } = await w.read();
|
|
141
141
|
if (C) break;
|
|
142
142
|
v += D.decode(N, { stream: !0 });
|
|
143
143
|
const T = v.split(`
|
|
@@ -148,33 +148,33 @@ async function Ke(a) {
|
|
|
148
148
|
try {
|
|
149
149
|
const p = JSON.parse(E.slice(6));
|
|
150
150
|
if (p.type === "init")
|
|
151
|
-
p.threadId &&
|
|
151
|
+
p.threadId && d.onInit && d.onInit(p.threadId);
|
|
152
152
|
else if (p.type === "content")
|
|
153
|
-
p.content && (R = !0,
|
|
153
|
+
p.content && (R = !0, d.onContent(p.content));
|
|
154
154
|
else if (p.type === "complete")
|
|
155
|
-
|
|
155
|
+
d.onComplete && d.onComplete(p.sources || []);
|
|
156
156
|
else if (p.type === "done")
|
|
157
|
-
p.humanTakeover && (R = !0),
|
|
157
|
+
p.humanTakeover && (R = !0), d.onDone && d.onDone({ humanTakeover: p.humanTakeover });
|
|
158
158
|
else if (p.type === "error")
|
|
159
|
-
throw new Error(p.error ||
|
|
159
|
+
throw new Error(p.error || te);
|
|
160
160
|
} catch (p) {
|
|
161
161
|
console.error("Error parsing SSE data:", p, E);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
R ||
|
|
165
|
-
} catch (
|
|
166
|
-
const o =
|
|
167
|
-
|
|
164
|
+
R || d.onError(be);
|
|
165
|
+
} catch (A) {
|
|
166
|
+
const o = A instanceof Error ? A.message : te;
|
|
167
|
+
d.onError(o);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
var
|
|
171
|
-
function
|
|
170
|
+
var ae = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
171
|
+
function Ce(a) {
|
|
172
172
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
173
173
|
}
|
|
174
|
-
var
|
|
175
|
-
function
|
|
176
|
-
return
|
|
177
|
-
var
|
|
174
|
+
var K = { exports: {} }, re;
|
|
175
|
+
function ke() {
|
|
176
|
+
return re || (re = 1, (function(a) {
|
|
177
|
+
var u = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
|
|
178
178
|
/**
|
|
179
179
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
180
180
|
*
|
|
@@ -183,8 +183,8 @@ function we() {
|
|
|
183
183
|
* @namespace
|
|
184
184
|
* @public
|
|
185
185
|
*/
|
|
186
|
-
var e = (function(
|
|
187
|
-
var
|
|
186
|
+
var e = (function(l) {
|
|
187
|
+
var d = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, h = 0, A = {}, o = {
|
|
188
188
|
/**
|
|
189
189
|
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
190
190
|
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
@@ -206,7 +206,7 @@ function we() {
|
|
|
206
206
|
* @memberof Prism
|
|
207
207
|
* @public
|
|
208
208
|
*/
|
|
209
|
-
manual:
|
|
209
|
+
manual: l.Prism && l.Prism.manual,
|
|
210
210
|
/**
|
|
211
211
|
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
|
212
212
|
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
|
@@ -228,7 +228,7 @@ function we() {
|
|
|
228
228
|
* @memberof Prism
|
|
229
229
|
* @public
|
|
230
230
|
*/
|
|
231
|
-
disableWorkerMessageHandler:
|
|
231
|
+
disableWorkerMessageHandler: l.Prism && l.Prism.disableWorkerMessageHandler,
|
|
232
232
|
/**
|
|
233
233
|
* A namespace for utility methods.
|
|
234
234
|
*
|
|
@@ -289,8 +289,8 @@ function we() {
|
|
|
289
289
|
return r[i];
|
|
290
290
|
s = /** @type {Record<string, any>} */
|
|
291
291
|
{}, r[i] = s;
|
|
292
|
-
for (var
|
|
293
|
-
t.hasOwnProperty(
|
|
292
|
+
for (var g in t)
|
|
293
|
+
t.hasOwnProperty(g) && (s[g] = n(t[g], r));
|
|
294
294
|
return (
|
|
295
295
|
/** @type {any} */
|
|
296
296
|
s
|
|
@@ -298,8 +298,8 @@ function we() {
|
|
|
298
298
|
case "Array":
|
|
299
299
|
return i = o.util.objId(t), r[i] ? r[i] : (s = [], r[i] = s, /** @type {Array} */
|
|
300
300
|
/** @type {any} */
|
|
301
|
-
t.forEach(function(f,
|
|
302
|
-
s[
|
|
301
|
+
t.forEach(function(f, c) {
|
|
302
|
+
s[c] = n(f, r);
|
|
303
303
|
}), /** @type {any} */
|
|
304
304
|
s);
|
|
305
305
|
default:
|
|
@@ -316,7 +316,7 @@ function we() {
|
|
|
316
316
|
*/
|
|
317
317
|
getLanguage: function(n) {
|
|
318
318
|
for (; n; ) {
|
|
319
|
-
var t =
|
|
319
|
+
var t = d.exec(n.className);
|
|
320
320
|
if (t)
|
|
321
321
|
return t[1].toLowerCase();
|
|
322
322
|
n = n.parentElement;
|
|
@@ -331,7 +331,7 @@ function we() {
|
|
|
331
331
|
* @returns {void}
|
|
332
332
|
*/
|
|
333
333
|
setLanguage: function(n, t) {
|
|
334
|
-
n.className = n.className.replace(RegExp(
|
|
334
|
+
n.className = n.className.replace(RegExp(d, "gi"), ""), n.classList.add("language-" + t);
|
|
335
335
|
},
|
|
336
336
|
/**
|
|
337
337
|
* Returns the script element that is currently executing.
|
|
@@ -403,10 +403,10 @@ function we() {
|
|
|
403
403
|
/**
|
|
404
404
|
* The grammar for plain, unformatted text.
|
|
405
405
|
*/
|
|
406
|
-
plain:
|
|
407
|
-
plaintext:
|
|
408
|
-
text:
|
|
409
|
-
txt:
|
|
406
|
+
plain: A,
|
|
407
|
+
plaintext: A,
|
|
408
|
+
text: A,
|
|
409
|
+
txt: A,
|
|
410
410
|
/**
|
|
411
411
|
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
412
412
|
*
|
|
@@ -519,28 +519,28 @@ function we() {
|
|
|
519
519
|
insertBefore: function(n, t, r, s) {
|
|
520
520
|
s = s || /** @type {any} */
|
|
521
521
|
o.languages;
|
|
522
|
-
var i = s[n],
|
|
522
|
+
var i = s[n], g = {};
|
|
523
523
|
for (var f in i)
|
|
524
524
|
if (i.hasOwnProperty(f)) {
|
|
525
525
|
if (f == t)
|
|
526
|
-
for (var
|
|
527
|
-
r.hasOwnProperty(
|
|
528
|
-
r.hasOwnProperty(f) || (
|
|
526
|
+
for (var c in r)
|
|
527
|
+
r.hasOwnProperty(c) && (g[c] = r[c]);
|
|
528
|
+
r.hasOwnProperty(f) || (g[f] = i[f]);
|
|
529
529
|
}
|
|
530
|
-
var
|
|
531
|
-
return s[n] =
|
|
532
|
-
|
|
533
|
-
}),
|
|
530
|
+
var S = s[n];
|
|
531
|
+
return s[n] = g, o.languages.DFS(o.languages, function(b, F) {
|
|
532
|
+
F === S && b != n && (this[b] = g);
|
|
533
|
+
}), g;
|
|
534
534
|
},
|
|
535
535
|
// Traverse a language definition with Depth First Search
|
|
536
536
|
DFS: function n(t, r, s, i) {
|
|
537
537
|
i = i || {};
|
|
538
|
-
var
|
|
538
|
+
var g = o.util.objId;
|
|
539
539
|
for (var f in t)
|
|
540
540
|
if (t.hasOwnProperty(f)) {
|
|
541
541
|
r.call(t, f, t[f], s || f);
|
|
542
|
-
var
|
|
543
|
-
|
|
542
|
+
var c = t[f], S = o.util.type(c);
|
|
543
|
+
S === "Object" && !i[g(c)] ? (i[g(c)] = !0, n(c, r, null, i)) : S === "Array" && !i[g(c)] && (i[g(c)] = !0, n(c, r, f, i));
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
},
|
|
@@ -582,8 +582,8 @@ function we() {
|
|
|
582
582
|
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
583
583
|
};
|
|
584
584
|
o.hooks.run("before-highlightall", s), s.elements = Array.prototype.slice.apply(s.container.querySelectorAll(s.selector)), o.hooks.run("before-all-elements-highlight", s);
|
|
585
|
-
for (var i = 0,
|
|
586
|
-
o.highlightElement(
|
|
585
|
+
for (var i = 0, g; g = s.elements[i++]; )
|
|
586
|
+
o.highlightElement(g, t === !0, s.callback);
|
|
587
587
|
},
|
|
588
588
|
/**
|
|
589
589
|
* Highlights the code inside a single element.
|
|
@@ -616,36 +616,36 @@ function we() {
|
|
|
616
616
|
highlightElement: function(n, t, r) {
|
|
617
617
|
var s = o.util.getLanguage(n), i = o.languages[s];
|
|
618
618
|
o.util.setLanguage(n, s);
|
|
619
|
-
var
|
|
620
|
-
|
|
621
|
-
var f = n.textContent,
|
|
619
|
+
var g = n.parentElement;
|
|
620
|
+
g && g.nodeName.toLowerCase() === "pre" && o.util.setLanguage(g, s);
|
|
621
|
+
var f = n.textContent, c = {
|
|
622
622
|
element: n,
|
|
623
623
|
language: s,
|
|
624
624
|
grammar: i,
|
|
625
625
|
code: f
|
|
626
626
|
};
|
|
627
|
-
function
|
|
628
|
-
|
|
627
|
+
function S(F) {
|
|
628
|
+
c.highlightedCode = F, o.hooks.run("before-insert", c), c.element.innerHTML = c.highlightedCode, o.hooks.run("after-highlight", c), o.hooks.run("complete", c), r && r.call(c.element);
|
|
629
629
|
}
|
|
630
|
-
if (o.hooks.run("before-sanity-check",
|
|
631
|
-
o.hooks.run("complete",
|
|
630
|
+
if (o.hooks.run("before-sanity-check", c), g = c.element.parentElement, g && g.nodeName.toLowerCase() === "pre" && !g.hasAttribute("tabindex") && g.setAttribute("tabindex", "0"), !c.code) {
|
|
631
|
+
o.hooks.run("complete", c), r && r.call(c.element);
|
|
632
632
|
return;
|
|
633
633
|
}
|
|
634
|
-
if (o.hooks.run("before-highlight",
|
|
635
|
-
|
|
634
|
+
if (o.hooks.run("before-highlight", c), !c.grammar) {
|
|
635
|
+
S(o.util.encode(c.code));
|
|
636
636
|
return;
|
|
637
637
|
}
|
|
638
|
-
if (t &&
|
|
638
|
+
if (t && l.Worker) {
|
|
639
639
|
var b = new Worker(o.filename);
|
|
640
|
-
b.onmessage = function(
|
|
641
|
-
|
|
640
|
+
b.onmessage = function(F) {
|
|
641
|
+
S(F.data);
|
|
642
642
|
}, b.postMessage(JSON.stringify({
|
|
643
|
-
language:
|
|
644
|
-
code:
|
|
643
|
+
language: c.language,
|
|
644
|
+
code: c.code,
|
|
645
645
|
immediateClose: !0
|
|
646
646
|
}));
|
|
647
647
|
} else
|
|
648
|
-
|
|
648
|
+
S(o.highlight(c.code, c.grammar, c.language));
|
|
649
649
|
},
|
|
650
650
|
/**
|
|
651
651
|
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
@@ -752,7 +752,7 @@ function we() {
|
|
|
752
752
|
},
|
|
753
753
|
Token: m
|
|
754
754
|
};
|
|
755
|
-
|
|
755
|
+
l.Prism = o;
|
|
756
756
|
function m(n, t, r, s) {
|
|
757
757
|
this.type = n, this.content = t, this.alias = r, this.length = (s || "").length | 0;
|
|
758
758
|
}
|
|
@@ -761,8 +761,8 @@ function we() {
|
|
|
761
761
|
return t;
|
|
762
762
|
if (Array.isArray(t)) {
|
|
763
763
|
var s = "";
|
|
764
|
-
return t.forEach(function(
|
|
765
|
-
s += n(
|
|
764
|
+
return t.forEach(function(S) {
|
|
765
|
+
s += n(S, r);
|
|
766
766
|
}), s;
|
|
767
767
|
}
|
|
768
768
|
var i = {
|
|
@@ -772,65 +772,65 @@ function we() {
|
|
|
772
772
|
classes: ["token", t.type],
|
|
773
773
|
attributes: {},
|
|
774
774
|
language: r
|
|
775
|
-
},
|
|
776
|
-
|
|
775
|
+
}, g = t.alias;
|
|
776
|
+
g && (Array.isArray(g) ? Array.prototype.push.apply(i.classes, g) : i.classes.push(g)), o.hooks.run("wrap", i);
|
|
777
777
|
var f = "";
|
|
778
|
-
for (var
|
|
779
|
-
f += " " +
|
|
778
|
+
for (var c in i.attributes)
|
|
779
|
+
f += " " + c + '="' + (i.attributes[c] || "").replace(/"/g, """) + '"';
|
|
780
780
|
return "<" + i.tag + ' class="' + i.classes.join(" ") + '"' + f + ">" + i.content + "</" + i.tag + ">";
|
|
781
781
|
};
|
|
782
|
-
function
|
|
782
|
+
function w(n, t, r, s) {
|
|
783
783
|
n.lastIndex = t;
|
|
784
784
|
var i = n.exec(r);
|
|
785
785
|
if (i && s && i[1]) {
|
|
786
|
-
var
|
|
787
|
-
i.index +=
|
|
786
|
+
var g = i[1].length;
|
|
787
|
+
i.index += g, i[0] = i[0].slice(g);
|
|
788
788
|
}
|
|
789
789
|
return i;
|
|
790
790
|
}
|
|
791
|
-
function D(n, t, r, s, i,
|
|
791
|
+
function D(n, t, r, s, i, g) {
|
|
792
792
|
for (var f in r)
|
|
793
793
|
if (!(!r.hasOwnProperty(f) || !r[f])) {
|
|
794
|
-
var
|
|
795
|
-
|
|
796
|
-
for (var
|
|
797
|
-
if (
|
|
794
|
+
var c = r[f];
|
|
795
|
+
c = Array.isArray(c) ? c : [c];
|
|
796
|
+
for (var S = 0; S < c.length; ++S) {
|
|
797
|
+
if (g && g.cause == f + "," + S)
|
|
798
798
|
return;
|
|
799
|
-
var b =
|
|
800
|
-
if (
|
|
801
|
-
var
|
|
802
|
-
b.pattern = RegExp(b.pattern.source,
|
|
799
|
+
var b = c[S], F = b.inside, Z = !!b.lookbehind, J = !!b.greedy, fe = b.alias;
|
|
800
|
+
if (J && !b.pattern.global) {
|
|
801
|
+
var Ee = b.pattern.toString().match(/[imsuy]*$/)[0];
|
|
802
|
+
b.pattern = RegExp(b.pattern.source, Ee + "g");
|
|
803
803
|
}
|
|
804
|
-
for (var
|
|
804
|
+
for (var Q = b.pattern || b, I = s.next, O = i; I !== t.tail && !(g && O >= g.reach); O += I.value.length, I = I.next) {
|
|
805
805
|
var _ = I.value;
|
|
806
806
|
if (t.length > n.length)
|
|
807
807
|
return;
|
|
808
808
|
if (!(_ instanceof m)) {
|
|
809
|
-
var
|
|
810
|
-
if (
|
|
811
|
-
if (y =
|
|
809
|
+
var M = 1, y;
|
|
810
|
+
if (J) {
|
|
811
|
+
if (y = w(Q, O, n, Z), !y || y.index >= n.length)
|
|
812
812
|
break;
|
|
813
|
-
var
|
|
814
|
-
for (
|
|
815
|
-
I = I.next,
|
|
816
|
-
if (
|
|
813
|
+
var $ = y.index, he = y.index + y[0].length, L = O;
|
|
814
|
+
for (L += I.value.length; $ >= L; )
|
|
815
|
+
I = I.next, L += I.value.length;
|
|
816
|
+
if (L -= I.value.length, O = L, I.value instanceof m)
|
|
817
817
|
continue;
|
|
818
|
-
for (var P = I; P !== t.tail && (
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
} else if (y =
|
|
818
|
+
for (var P = I; P !== t.tail && (L < he || typeof P.value == "string"); P = P.next)
|
|
819
|
+
M++, L += P.value.length;
|
|
820
|
+
M--, _ = n.slice(O, L), y.index -= O;
|
|
821
|
+
} else if (y = w(Q, 0, _, Z), !y)
|
|
822
822
|
continue;
|
|
823
|
-
var
|
|
824
|
-
|
|
825
|
-
var
|
|
826
|
-
|
|
827
|
-
var
|
|
828
|
-
if (I = R(t,
|
|
829
|
-
var
|
|
830
|
-
cause: f + "," +
|
|
831
|
-
reach:
|
|
823
|
+
var $ = y.index, G = y[0], z = _.slice(0, $), ee = _.slice($ + G.length), X = O + _.length;
|
|
824
|
+
g && X > g.reach && (g.reach = X);
|
|
825
|
+
var B = I.prev;
|
|
826
|
+
z && (B = R(t, B, z), O += z.length), C(t, B, M);
|
|
827
|
+
var me = new m(f, F ? o.tokenize(G, F) : G, fe, G);
|
|
828
|
+
if (I = R(t, B, me), ee && R(t, I, ee), M > 1) {
|
|
829
|
+
var j = {
|
|
830
|
+
cause: f + "," + S,
|
|
831
|
+
reach: X
|
|
832
832
|
};
|
|
833
|
-
D(n, t, r, I.prev, O,
|
|
833
|
+
D(n, t, r, I.prev, O, j), g && j.reach > g.reach && (g.reach = j.reach);
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
836
|
}
|
|
@@ -855,10 +855,10 @@ function we() {
|
|
|
855
855
|
t.push(r.value), r = r.next;
|
|
856
856
|
return t;
|
|
857
857
|
}
|
|
858
|
-
if (!
|
|
859
|
-
return
|
|
858
|
+
if (!l.document)
|
|
859
|
+
return l.addEventListener && (o.disableWorkerMessageHandler || l.addEventListener("message", function(n) {
|
|
860
860
|
var t = JSON.parse(n.data), r = t.language, s = t.code, i = t.immediateClose;
|
|
861
|
-
|
|
861
|
+
l.postMessage(o.highlight(s, o.languages[r], r)), i && l.close();
|
|
862
862
|
}, !1)), o;
|
|
863
863
|
var T = o.util.currentScript();
|
|
864
864
|
T && (o.filename = T.src, T.hasAttribute("data-manual") && (o.manual = !0));
|
|
@@ -870,8 +870,8 @@ function we() {
|
|
|
870
870
|
p === "loading" || p === "interactive" && T && T.defer ? document.addEventListener("DOMContentLoaded", E) : window.requestAnimationFrame ? window.requestAnimationFrame(E) : window.setTimeout(E, 16);
|
|
871
871
|
}
|
|
872
872
|
return o;
|
|
873
|
-
})(
|
|
874
|
-
a.exports && (a.exports = e), typeof
|
|
873
|
+
})(u);
|
|
874
|
+
a.exports && (a.exports = e), typeof ae < "u" && (ae.Prism = e), e.languages.markup = {
|
|
875
875
|
comment: {
|
|
876
876
|
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
877
877
|
greedy: !0
|
|
@@ -948,8 +948,8 @@ function we() {
|
|
|
948
948
|
},
|
|
949
949
|
/&#x?[\da-f]{1,8};/i
|
|
950
950
|
]
|
|
951
|
-
}, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(
|
|
952
|
-
|
|
951
|
+
}, e.languages.markup.tag.inside["attr-value"].inside.entity = e.languages.markup.entity, e.languages.markup.doctype.inside["internal-subset"].inside = e.languages.markup, e.hooks.add("wrap", function(l) {
|
|
952
|
+
l.type === "entity" && (l.attributes.title = l.content.replace(/&/, "&"));
|
|
953
953
|
}), Object.defineProperty(e.languages.markup.tag, "addInlined", {
|
|
954
954
|
/**
|
|
955
955
|
* Adds an inlined language to markup.
|
|
@@ -962,17 +962,17 @@ function we() {
|
|
|
962
962
|
* @example
|
|
963
963
|
* addInlined('style', 'css');
|
|
964
964
|
*/
|
|
965
|
-
value: function(
|
|
966
|
-
var
|
|
967
|
-
|
|
965
|
+
value: function(d, h) {
|
|
966
|
+
var A = {};
|
|
967
|
+
A["language-" + h] = {
|
|
968
968
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
969
969
|
lookbehind: !0,
|
|
970
970
|
inside: e.languages[h]
|
|
971
|
-
},
|
|
971
|
+
}, A.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
972
972
|
var o = {
|
|
973
973
|
"included-cdata": {
|
|
974
974
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
975
|
-
inside:
|
|
975
|
+
inside: A
|
|
976
976
|
}
|
|
977
977
|
};
|
|
978
978
|
o["language-" + h] = {
|
|
@@ -980,9 +980,9 @@ function we() {
|
|
|
980
980
|
inside: e.languages[h]
|
|
981
981
|
};
|
|
982
982
|
var m = {};
|
|
983
|
-
m[
|
|
983
|
+
m[d] = {
|
|
984
984
|
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
985
|
-
return
|
|
985
|
+
return d;
|
|
986
986
|
}), "i"),
|
|
987
987
|
lookbehind: !0,
|
|
988
988
|
greedy: !0,
|
|
@@ -1001,10 +1001,10 @@ function we() {
|
|
|
1001
1001
|
* @example
|
|
1002
1002
|
* addAttribute('style', 'css');
|
|
1003
1003
|
*/
|
|
1004
|
-
value: function(
|
|
1004
|
+
value: function(l, d) {
|
|
1005
1005
|
e.languages.markup.tag.inside["special-attr"].push({
|
|
1006
1006
|
pattern: RegExp(
|
|
1007
|
-
/(^|["'\s])/.source + "(?:" +
|
|
1007
|
+
/(^|["'\s])/.source + "(?:" + l + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
1008
1008
|
"i"
|
|
1009
1009
|
),
|
|
1010
1010
|
lookbehind: !0,
|
|
@@ -1016,8 +1016,8 @@ function we() {
|
|
|
1016
1016
|
value: {
|
|
1017
1017
|
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1018
1018
|
lookbehind: !0,
|
|
1019
|
-
alias: [
|
|
1020
|
-
inside: e.languages[
|
|
1019
|
+
alias: [d, "language-" + d],
|
|
1020
|
+
inside: e.languages[d]
|
|
1021
1021
|
},
|
|
1022
1022
|
punctuation: [
|
|
1023
1023
|
{
|
|
@@ -1031,12 +1031,12 @@ function we() {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
});
|
|
1033
1033
|
}
|
|
1034
|
-
}), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, (function(
|
|
1035
|
-
var
|
|
1036
|
-
|
|
1034
|
+
}), e.languages.html = e.languages.markup, e.languages.mathml = e.languages.markup, e.languages.svg = e.languages.markup, e.languages.xml = e.languages.extend("markup", {}), e.languages.ssml = e.languages.xml, e.languages.atom = e.languages.xml, e.languages.rss = e.languages.xml, (function(l) {
|
|
1035
|
+
var d = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1036
|
+
l.languages.css = {
|
|
1037
1037
|
comment: /\/\*[\s\S]*?\*\//,
|
|
1038
1038
|
atrule: {
|
|
1039
|
-
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" +
|
|
1039
|
+
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + d.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
1040
1040
|
inside: {
|
|
1041
1041
|
rule: /^@[\w-]+/,
|
|
1042
1042
|
"selector-function-argument": {
|
|
@@ -1053,23 +1053,23 @@ function we() {
|
|
|
1053
1053
|
},
|
|
1054
1054
|
url: {
|
|
1055
1055
|
// https://drafts.csswg.org/css-values-3/#urls
|
|
1056
|
-
pattern: RegExp("\\burl\\((?:" +
|
|
1056
|
+
pattern: RegExp("\\burl\\((?:" + d.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
|
|
1057
1057
|
greedy: !0,
|
|
1058
1058
|
inside: {
|
|
1059
1059
|
function: /^url/i,
|
|
1060
1060
|
punctuation: /^\(|\)$/,
|
|
1061
1061
|
string: {
|
|
1062
|
-
pattern: RegExp("^" +
|
|
1062
|
+
pattern: RegExp("^" + d.source + "$"),
|
|
1063
1063
|
alias: "url"
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
1066
|
},
|
|
1067
1067
|
selector: {
|
|
1068
|
-
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` +
|
|
1068
|
+
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + d.source + ")*(?=\\s*\\{)"),
|
|
1069
1069
|
lookbehind: !0
|
|
1070
1070
|
},
|
|
1071
1071
|
string: {
|
|
1072
|
-
pattern:
|
|
1072
|
+
pattern: d,
|
|
1073
1073
|
greedy: !0
|
|
1074
1074
|
},
|
|
1075
1075
|
property: {
|
|
@@ -1082,8 +1082,8 @@ function we() {
|
|
|
1082
1082
|
lookbehind: !0
|
|
1083
1083
|
},
|
|
1084
1084
|
punctuation: /[(){};:,]/
|
|
1085
|
-
},
|
|
1086
|
-
var h =
|
|
1085
|
+
}, l.languages.css.atrule.inside.rest = l.languages.css;
|
|
1086
|
+
var h = l.languages.markup;
|
|
1087
1087
|
h && (h.tag.addInlined("style", "css"), h.tag.addAttribute("style", "css"));
|
|
1088
1088
|
})(e), e.languages.clike = {
|
|
1089
1089
|
comment: [
|
|
@@ -1249,9 +1249,9 @@ function we() {
|
|
|
1249
1249
|
if (typeof e > "u" || typeof document > "u")
|
|
1250
1250
|
return;
|
|
1251
1251
|
Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector);
|
|
1252
|
-
var
|
|
1252
|
+
var l = "Loading…", d = function(T, E) {
|
|
1253
1253
|
return "✖ Error " + T + " while fetching file: " + E;
|
|
1254
|
-
}, h = "✖ Error: File does not exist or is empty",
|
|
1254
|
+
}, h = "✖ Error: File does not exist or is empty", A = {
|
|
1255
1255
|
js: "javascript",
|
|
1256
1256
|
py: "python",
|
|
1257
1257
|
rb: "ruby",
|
|
@@ -1261,11 +1261,11 @@ function we() {
|
|
|
1261
1261
|
bat: "batch",
|
|
1262
1262
|
h: "c",
|
|
1263
1263
|
tex: "latex"
|
|
1264
|
-
}, o = "data-src-status", m = "loading",
|
|
1264
|
+
}, o = "data-src-status", m = "loading", w = "loaded", D = "failed", v = "pre[data-src]:not([" + o + '="' + w + '"]):not([' + o + '="' + m + '"])';
|
|
1265
1265
|
function R(T, E, p) {
|
|
1266
1266
|
var n = new XMLHttpRequest();
|
|
1267
1267
|
n.open("GET", T, !0), n.onreadystatechange = function() {
|
|
1268
|
-
n.readyState == 4 && (n.status < 400 && n.responseText ? E(n.responseText) : n.status >= 400 ? p(
|
|
1268
|
+
n.readyState == 4 && (n.status < 400 && n.responseText ? E(n.responseText) : n.status >= 400 ? p(d(n.status, n.statusText)) : p(h));
|
|
1269
1269
|
}, n.send(null);
|
|
1270
1270
|
}
|
|
1271
1271
|
function C(T) {
|
|
@@ -1285,23 +1285,23 @@ function we() {
|
|
|
1285
1285
|
if (E.matches(v)) {
|
|
1286
1286
|
T.code = "", E.setAttribute(o, m);
|
|
1287
1287
|
var p = E.appendChild(document.createElement("CODE"));
|
|
1288
|
-
p.textContent =
|
|
1288
|
+
p.textContent = l;
|
|
1289
1289
|
var n = E.getAttribute("data-src"), t = T.language;
|
|
1290
1290
|
if (t === "none") {
|
|
1291
1291
|
var r = (/\.(\w+)$/.exec(n) || [, "none"])[1];
|
|
1292
|
-
t =
|
|
1292
|
+
t = A[r] || r;
|
|
1293
1293
|
}
|
|
1294
1294
|
e.util.setLanguage(p, t), e.util.setLanguage(E, t);
|
|
1295
1295
|
var s = e.plugins.autoloader;
|
|
1296
1296
|
s && s.loadLanguages(t), R(
|
|
1297
1297
|
n,
|
|
1298
1298
|
function(i) {
|
|
1299
|
-
E.setAttribute(o,
|
|
1300
|
-
var
|
|
1301
|
-
if (
|
|
1302
|
-
var f = i.split(/\r\n?|\n/g),
|
|
1303
|
-
|
|
1304
|
-
`), E.hasAttribute("data-start") || E.setAttribute("data-start", String(
|
|
1299
|
+
E.setAttribute(o, w);
|
|
1300
|
+
var g = C(E.getAttribute("data-range"));
|
|
1301
|
+
if (g) {
|
|
1302
|
+
var f = i.split(/\r\n?|\n/g), c = g[0], S = g[1] == null ? f.length : g[1];
|
|
1303
|
+
c < 0 && (c += f.length), c = Math.max(0, Math.min(c - 1, f.length)), S < 0 && (S += f.length), S = Math.max(0, Math.min(S, f.length)), i = f.slice(c, S).join(`
|
|
1304
|
+
`), E.hasAttribute("data-start") || E.setAttribute("data-start", String(c + 1));
|
|
1305
1305
|
}
|
|
1306
1306
|
p.textContent = i, e.highlightElement(p);
|
|
1307
1307
|
},
|
|
@@ -1328,13 +1328,13 @@ function we() {
|
|
|
1328
1328
|
N || (console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."), N = !0), e.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
1329
1329
|
};
|
|
1330
1330
|
})();
|
|
1331
|
-
})(
|
|
1331
|
+
})(K)), K.exports;
|
|
1332
1332
|
}
|
|
1333
|
-
var
|
|
1334
|
-
const
|
|
1335
|
-
var
|
|
1336
|
-
function
|
|
1337
|
-
return
|
|
1333
|
+
var De = ke();
|
|
1334
|
+
const se = /* @__PURE__ */ Ce(De);
|
|
1335
|
+
var ie = {}, oe;
|
|
1336
|
+
function _e() {
|
|
1337
|
+
return oe || (oe = 1, Prism.languages.python = {
|
|
1338
1338
|
comment: {
|
|
1339
1339
|
pattern: /(^|[^\\])#.*/,
|
|
1340
1340
|
lookbehind: !0,
|
|
@@ -1394,12 +1394,12 @@ function ke() {
|
|
|
1394
1394
|
number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
1395
1395
|
operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
1396
1396
|
punctuation: /[{}[\];(),.:]/
|
|
1397
|
-
}, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python),
|
|
1397
|
+
}, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python), ie;
|
|
1398
1398
|
}
|
|
1399
|
-
|
|
1400
|
-
var
|
|
1401
|
-
function
|
|
1402
|
-
return
|
|
1399
|
+
_e();
|
|
1400
|
+
var ue = {}, le;
|
|
1401
|
+
function Pe() {
|
|
1402
|
+
return le || (le = 1, (function(a) {
|
|
1403
1403
|
a.languages.typescript = a.languages.extend("javascript", {
|
|
1404
1404
|
"class-name": {
|
|
1405
1405
|
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
|
|
@@ -1416,8 +1416,8 @@ function De() {
|
|
|
1416
1416
|
// This is for `import type *, {}`
|
|
1417
1417
|
/\btype\b(?=\s*(?:[\{*]|$))/
|
|
1418
1418
|
), delete a.languages.typescript.parameter, delete a.languages.typescript["literal-property"];
|
|
1419
|
-
var
|
|
1420
|
-
delete
|
|
1419
|
+
var u = a.languages.extend("typescript", {});
|
|
1420
|
+
delete u["class-name"], a.languages.typescript["class-name"].inside = u, a.languages.insertBefore("typescript", "function", {
|
|
1421
1421
|
decorator: {
|
|
1422
1422
|
pattern: /@[$\w\xA0-\uFFFF]+/,
|
|
1423
1423
|
inside: {
|
|
@@ -1438,26 +1438,26 @@ function De() {
|
|
|
1438
1438
|
pattern: /<[\s\S]+/,
|
|
1439
1439
|
// everything after the first <
|
|
1440
1440
|
alias: "class-name",
|
|
1441
|
-
inside:
|
|
1441
|
+
inside: u
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
1444
|
}
|
|
1445
1445
|
}), a.languages.ts = a.languages.typescript;
|
|
1446
|
-
})(Prism)),
|
|
1446
|
+
})(Prism)), ue;
|
|
1447
1447
|
}
|
|
1448
|
-
|
|
1448
|
+
Pe();
|
|
1449
1449
|
(function(a) {
|
|
1450
|
-
var
|
|
1450
|
+
var u = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", e = {
|
|
1451
1451
|
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
1452
1452
|
lookbehind: !0,
|
|
1453
1453
|
alias: "punctuation",
|
|
1454
1454
|
// this looks reasonably well in all themes
|
|
1455
1455
|
inside: null
|
|
1456
1456
|
// see below
|
|
1457
|
-
},
|
|
1457
|
+
}, l = {
|
|
1458
1458
|
bash: e,
|
|
1459
1459
|
environment: {
|
|
1460
|
-
pattern: RegExp("\\$" +
|
|
1460
|
+
pattern: RegExp("\\$" + u),
|
|
1461
1461
|
alias: "constant"
|
|
1462
1462
|
},
|
|
1463
1463
|
variable: [
|
|
@@ -1497,7 +1497,7 @@ De();
|
|
|
1497
1497
|
operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
1498
1498
|
punctuation: /[\[\]]/,
|
|
1499
1499
|
environment: {
|
|
1500
|
-
pattern: RegExp("(\\{)" +
|
|
1500
|
+
pattern: RegExp("(\\{)" + u),
|
|
1501
1501
|
lookbehind: !0,
|
|
1502
1502
|
alias: "constant"
|
|
1503
1503
|
}
|
|
@@ -1546,7 +1546,7 @@ De();
|
|
|
1546
1546
|
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
1547
1547
|
inside: {
|
|
1548
1548
|
environment: {
|
|
1549
|
-
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" +
|
|
1549
|
+
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + u),
|
|
1550
1550
|
lookbehind: !0,
|
|
1551
1551
|
alias: "constant"
|
|
1552
1552
|
}
|
|
@@ -1566,7 +1566,7 @@ De();
|
|
|
1566
1566
|
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
|
1567
1567
|
lookbehind: !0,
|
|
1568
1568
|
greedy: !0,
|
|
1569
|
-
inside:
|
|
1569
|
+
inside: l
|
|
1570
1570
|
},
|
|
1571
1571
|
// Here-document with quotes around the tag
|
|
1572
1572
|
// → No expansion (so no “inside”).
|
|
@@ -1584,7 +1584,7 @@ De();
|
|
|
1584
1584
|
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
1585
1585
|
lookbehind: !0,
|
|
1586
1586
|
greedy: !0,
|
|
1587
|
-
inside:
|
|
1587
|
+
inside: l
|
|
1588
1588
|
},
|
|
1589
1589
|
{
|
|
1590
1590
|
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
@@ -1597,15 +1597,15 @@ De();
|
|
|
1597
1597
|
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
1598
1598
|
greedy: !0,
|
|
1599
1599
|
inside: {
|
|
1600
|
-
entity:
|
|
1600
|
+
entity: l.entity
|
|
1601
1601
|
}
|
|
1602
1602
|
}
|
|
1603
1603
|
],
|
|
1604
1604
|
environment: {
|
|
1605
|
-
pattern: RegExp("\\$?" +
|
|
1605
|
+
pattern: RegExp("\\$?" + u),
|
|
1606
1606
|
alias: "constant"
|
|
1607
1607
|
},
|
|
1608
|
-
variable:
|
|
1608
|
+
variable: l.variable,
|
|
1609
1609
|
function: {
|
|
1610
1610
|
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
|
1611
1611
|
lookbehind: !0
|
|
@@ -1645,7 +1645,7 @@ De();
|
|
|
1645
1645
|
lookbehind: !0
|
|
1646
1646
|
}
|
|
1647
1647
|
}, e.inside = a.languages.bash;
|
|
1648
|
-
for (var
|
|
1648
|
+
for (var d = [
|
|
1649
1649
|
"comment",
|
|
1650
1650
|
"function-name",
|
|
1651
1651
|
"for-or-select",
|
|
@@ -1661,8 +1661,8 @@ De();
|
|
|
1661
1661
|
"operator",
|
|
1662
1662
|
"punctuation",
|
|
1663
1663
|
"number"
|
|
1664
|
-
], h =
|
|
1665
|
-
h[
|
|
1664
|
+
], h = l.variable[1].inside, A = 0; A < d.length; A++)
|
|
1665
|
+
h[d[A]] = a.languages.bash[d[A]];
|
|
1666
1666
|
a.languages.sh = a.languages.bash, a.languages.shell = a.languages.bash;
|
|
1667
1667
|
})(Prism);
|
|
1668
1668
|
Prism.languages.json = {
|
|
@@ -1691,11 +1691,11 @@ Prism.languages.json = {
|
|
|
1691
1691
|
};
|
|
1692
1692
|
Prism.languages.webmanifest = Prism.languages.json;
|
|
1693
1693
|
(function(a) {
|
|
1694
|
-
var
|
|
1694
|
+
var u = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
1695
1695
|
a.languages.css = {
|
|
1696
1696
|
comment: /\/\*[\s\S]*?\*\//,
|
|
1697
1697
|
atrule: {
|
|
1698
|
-
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" +
|
|
1698
|
+
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + u.source + ")*?" + /(?:;|(?=\s*\{))/.source),
|
|
1699
1699
|
inside: {
|
|
1700
1700
|
rule: /^@[\w-]+/,
|
|
1701
1701
|
"selector-function-argument": {
|
|
@@ -1712,23 +1712,23 @@ Prism.languages.webmanifest = Prism.languages.json;
|
|
|
1712
1712
|
},
|
|
1713
1713
|
url: {
|
|
1714
1714
|
// https://drafts.csswg.org/css-values-3/#urls
|
|
1715
|
-
pattern: RegExp("\\burl\\((?:" +
|
|
1715
|
+
pattern: RegExp("\\burl\\((?:" + u.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
|
|
1716
1716
|
greedy: !0,
|
|
1717
1717
|
inside: {
|
|
1718
1718
|
function: /^url/i,
|
|
1719
1719
|
punctuation: /^\(|\)$/,
|
|
1720
1720
|
string: {
|
|
1721
|
-
pattern: RegExp("^" +
|
|
1721
|
+
pattern: RegExp("^" + u.source + "$"),
|
|
1722
1722
|
alias: "url"
|
|
1723
1723
|
}
|
|
1724
1724
|
}
|
|
1725
1725
|
},
|
|
1726
1726
|
selector: {
|
|
1727
|
-
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` +
|
|
1727
|
+
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + u.source + ")*(?=\\s*\\{)"),
|
|
1728
1728
|
lookbehind: !0
|
|
1729
1729
|
},
|
|
1730
1730
|
string: {
|
|
1731
|
-
pattern:
|
|
1731
|
+
pattern: u,
|
|
1732
1732
|
greedy: !0
|
|
1733
1733
|
},
|
|
1734
1734
|
property: {
|
|
@@ -1840,31 +1840,31 @@ Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
|
|
|
1840
1840
|
* @example
|
|
1841
1841
|
* addInlined('style', 'css');
|
|
1842
1842
|
*/
|
|
1843
|
-
value: function(
|
|
1844
|
-
var
|
|
1845
|
-
|
|
1843
|
+
value: function(u, e) {
|
|
1844
|
+
var l = {};
|
|
1845
|
+
l["language-" + e] = {
|
|
1846
1846
|
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1847
1847
|
lookbehind: !0,
|
|
1848
1848
|
inside: Prism.languages[e]
|
|
1849
|
-
},
|
|
1850
|
-
var
|
|
1849
|
+
}, l.cdata = /^<!\[CDATA\[|\]\]>$/i;
|
|
1850
|
+
var d = {
|
|
1851
1851
|
"included-cdata": {
|
|
1852
1852
|
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1853
|
-
inside:
|
|
1853
|
+
inside: l
|
|
1854
1854
|
}
|
|
1855
1855
|
};
|
|
1856
|
-
|
|
1856
|
+
d["language-" + e] = {
|
|
1857
1857
|
pattern: /[\s\S]+/,
|
|
1858
1858
|
inside: Prism.languages[e]
|
|
1859
1859
|
};
|
|
1860
1860
|
var h = {};
|
|
1861
|
-
h[
|
|
1861
|
+
h[u] = {
|
|
1862
1862
|
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
|
|
1863
|
-
return
|
|
1863
|
+
return u;
|
|
1864
1864
|
}), "i"),
|
|
1865
1865
|
lookbehind: !0,
|
|
1866
1866
|
greedy: !0,
|
|
1867
|
-
inside:
|
|
1867
|
+
inside: d
|
|
1868
1868
|
}, Prism.languages.insertBefore("markup", "cdata", h);
|
|
1869
1869
|
}
|
|
1870
1870
|
});
|
|
@@ -1880,7 +1880,7 @@ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
|
|
|
1880
1880
|
* @example
|
|
1881
1881
|
* addAttribute('style', 'css');
|
|
1882
1882
|
*/
|
|
1883
|
-
value: function(a,
|
|
1883
|
+
value: function(a, u) {
|
|
1884
1884
|
Prism.languages.markup.tag.inside["special-attr"].push({
|
|
1885
1885
|
pattern: RegExp(
|
|
1886
1886
|
/(^|["'\s])/.source + "(?:" + a + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
@@ -1895,8 +1895,8 @@ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
|
|
|
1895
1895
|
value: {
|
|
1896
1896
|
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
1897
1897
|
lookbehind: !0,
|
|
1898
|
-
alias: [
|
|
1899
|
-
inside: Prism.languages[
|
|
1898
|
+
alias: [u, "language-" + u],
|
|
1899
|
+
inside: Prism.languages[u]
|
|
1900
1900
|
},
|
|
1901
1901
|
punctuation: [
|
|
1902
1902
|
{
|
|
@@ -1951,7 +1951,7 @@ Prism.languages.sql = {
|
|
|
1951
1951
|
operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
|
|
1952
1952
|
punctuation: /[;[\]()`,.]/
|
|
1953
1953
|
};
|
|
1954
|
-
const
|
|
1954
|
+
const xe = {
|
|
1955
1955
|
js: "javascript",
|
|
1956
1956
|
ts: "typescript",
|
|
1957
1957
|
shell: "bash",
|
|
@@ -1959,24 +1959,24 @@ const _e = {
|
|
|
1959
1959
|
html: "markup",
|
|
1960
1960
|
xml: "markup"
|
|
1961
1961
|
};
|
|
1962
|
-
|
|
1962
|
+
W.setOptions({
|
|
1963
1963
|
breaks: !0,
|
|
1964
1964
|
gfm: !0
|
|
1965
1965
|
});
|
|
1966
|
-
const
|
|
1967
|
-
|
|
1968
|
-
const e =
|
|
1969
|
-
if (
|
|
1970
|
-
const h =
|
|
1966
|
+
const pe = new W.Renderer();
|
|
1967
|
+
pe.code = ({ text: a, lang: u }) => {
|
|
1968
|
+
const e = u ? xe[u] || u : "plaintext", l = se.languages[e];
|
|
1969
|
+
if (l) {
|
|
1970
|
+
const h = se.highlight(a, l, e);
|
|
1971
1971
|
return `<pre><code class="language-${e}">${h}</code></pre>`;
|
|
1972
1972
|
}
|
|
1973
1973
|
return `<pre><code>${a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</code></pre>`;
|
|
1974
1974
|
};
|
|
1975
|
-
|
|
1976
|
-
function
|
|
1977
|
-
return
|
|
1975
|
+
W.use({ renderer: pe });
|
|
1976
|
+
function tt(a) {
|
|
1977
|
+
return W.parse(a);
|
|
1978
1978
|
}
|
|
1979
|
-
const
|
|
1979
|
+
const Ue = "https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us.sentry.io/4510472944156672", Me = [
|
|
1980
1980
|
"@useknest",
|
|
1981
1981
|
"useknest",
|
|
1982
1982
|
"widget-core",
|
|
@@ -1986,22 +1986,22 @@ const Pe = "https://005d25250a41bd0071570b0c0a2b2c4d@o4510467570073600.ingest.us
|
|
|
1986
1986
|
"widget.js",
|
|
1987
1987
|
"knest"
|
|
1988
1988
|
];
|
|
1989
|
-
function
|
|
1989
|
+
function $e(a) {
|
|
1990
1990
|
if (a.tags?.source === "knest-widget") return !0;
|
|
1991
|
-
const
|
|
1992
|
-
return !
|
|
1993
|
-
const
|
|
1994
|
-
return
|
|
1991
|
+
const u = a.exception?.values?.[0]?.stacktrace?.frames;
|
|
1992
|
+
return !u || u.length === 0 ? !1 : u.some((e) => {
|
|
1993
|
+
const l = e.filename || "";
|
|
1994
|
+
return Me.some((d) => l.includes(d));
|
|
1995
1995
|
});
|
|
1996
1996
|
}
|
|
1997
|
-
let
|
|
1998
|
-
function
|
|
1999
|
-
|
|
2000
|
-
dsn:
|
|
1997
|
+
let ce = !1;
|
|
1998
|
+
function nt() {
|
|
1999
|
+
ce || (q.init({
|
|
2000
|
+
dsn: Ue,
|
|
2001
2001
|
// Only capture errors, not performance data.
|
|
2002
2002
|
tracesSampleRate: 0,
|
|
2003
2003
|
integrations: [
|
|
2004
|
-
|
|
2004
|
+
q.breadcrumbsIntegration({
|
|
2005
2005
|
console: !1,
|
|
2006
2006
|
dom: !0,
|
|
2007
2007
|
fetch: !0,
|
|
@@ -2017,52 +2017,92 @@ function Ve() {
|
|
|
2017
2017
|
},
|
|
2018
2018
|
// Filter out errors that don't originate from our widget code.
|
|
2019
2019
|
beforeSend(a) {
|
|
2020
|
-
return
|
|
2020
|
+
return $e(a) ? a : null;
|
|
2021
2021
|
}
|
|
2022
|
-
}),
|
|
2022
|
+
}), ce = !0);
|
|
2023
2023
|
}
|
|
2024
|
-
function
|
|
2024
|
+
function at(a, u) {
|
|
2025
2025
|
const e = typeof a == "string" ? new Error(a) : a;
|
|
2026
|
-
|
|
2026
|
+
q.captureException(e, {
|
|
2027
2027
|
tags: { source: "knest-widget" },
|
|
2028
|
-
extra:
|
|
2028
|
+
extra: u
|
|
2029
2029
|
});
|
|
2030
2030
|
}
|
|
2031
|
-
function
|
|
2032
|
-
const e =
|
|
2031
|
+
function rt(a, u) {
|
|
2032
|
+
const e = Le();
|
|
2033
2033
|
if (!e)
|
|
2034
2034
|
return () => {
|
|
2035
2035
|
};
|
|
2036
|
-
const
|
|
2037
|
-
|
|
2036
|
+
const l = e.channel(`thread:${a}`).on("broadcast", { event: "new-message" }, (d) => {
|
|
2037
|
+
u(d.payload);
|
|
2038
2038
|
}).subscribe();
|
|
2039
2039
|
return () => {
|
|
2040
|
-
|
|
2040
|
+
l.unsubscribe();
|
|
2041
2041
|
};
|
|
2042
2042
|
}
|
|
2043
|
+
const Ge = "knest-widget-chat-", Be = 14400 * 1e3, He = 300, U = /* @__PURE__ */ new Map();
|
|
2044
|
+
function Y(a) {
|
|
2045
|
+
return Ge + a;
|
|
2046
|
+
}
|
|
2047
|
+
function st(a) {
|
|
2048
|
+
try {
|
|
2049
|
+
const u = localStorage.getItem(Y(a));
|
|
2050
|
+
if (!u) return null;
|
|
2051
|
+
const e = JSON.parse(u);
|
|
2052
|
+
return Date.now() - e.savedAt > Be ? (localStorage.removeItem(Y(a)), null) : e;
|
|
2053
|
+
} catch {
|
|
2054
|
+
return null;
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
function Ye(a, u) {
|
|
2058
|
+
try {
|
|
2059
|
+
localStorage.setItem(Y(a), JSON.stringify(u));
|
|
2060
|
+
} catch {
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
function it(a, u) {
|
|
2064
|
+
const e = U.get(a);
|
|
2065
|
+
e !== void 0 && clearTimeout(e);
|
|
2066
|
+
const l = setTimeout(() => {
|
|
2067
|
+
Ye(a, u), U.delete(a);
|
|
2068
|
+
}, He);
|
|
2069
|
+
U.set(a, l);
|
|
2070
|
+
}
|
|
2071
|
+
function ot(a) {
|
|
2072
|
+
const u = U.get(a);
|
|
2073
|
+
u !== void 0 && (clearTimeout(u), U.delete(a));
|
|
2074
|
+
try {
|
|
2075
|
+
localStorage.removeItem(Y(a));
|
|
2076
|
+
} catch {
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2043
2079
|
export {
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
Ae as
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2080
|
+
ge as API_PATH,
|
|
2081
|
+
Ie as AUTH_ERROR_MESSAGE,
|
|
2082
|
+
Ke as DEFAULT_AVATAR_URL,
|
|
2083
|
+
de as DEFAULT_BASE_URL,
|
|
2084
|
+
qe as DEFAULT_BRAND_COLOR,
|
|
2085
|
+
te as DEFAULT_ERROR_MESSAGE,
|
|
2086
|
+
Ze as DEFAULT_EXAMPLE_QUESTIONS,
|
|
2087
|
+
Ve as DEFAULT_WELCOME_MESSAGE,
|
|
2088
|
+
be as FALLBACK_ERROR_MESSAGE,
|
|
2089
|
+
je as PUBLIC_SUPABASE_ANON_KEY,
|
|
2090
|
+
Xe as PUBLIC_SUPABASE_URL,
|
|
2091
|
+
ye as USAGE_LIMIT_MESSAGE,
|
|
2092
|
+
at as captureWidgetException,
|
|
2093
|
+
ot as clearChatState,
|
|
2094
|
+
Je as fetchWidgetConfig,
|
|
2095
|
+
tt as formatContent,
|
|
2096
|
+
we as getAccessToken,
|
|
2097
|
+
Ae as getChatApiUrl,
|
|
2098
|
+
Te as getConfigApiUrl,
|
|
2099
|
+
Le as getSupabaseClient,
|
|
2100
|
+
Qe as initWidgetAuth,
|
|
2101
|
+
nt as initWidgetSentry,
|
|
2102
|
+
Fe as isAuthenticated,
|
|
2103
|
+
st as loadChatState,
|
|
2104
|
+
Ye as saveChatState,
|
|
2105
|
+
it as saveChatStateDebounced,
|
|
2106
|
+
et as streamChatMessage,
|
|
2107
|
+
rt as subscribeToThread
|
|
2068
2108
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Message } from './types';
|
|
2
|
+
export interface PersistedChatState {
|
|
3
|
+
threadId: string | undefined;
|
|
4
|
+
messages: Message[];
|
|
5
|
+
input: string;
|
|
6
|
+
savedAt: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Loads persisted chat state from localStorage.
|
|
10
|
+
* Returns null if missing, expired, or corrupt — callers should fall back to a fresh state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadChatState(publishableApiKey: string): PersistedChatState | null;
|
|
13
|
+
/**
|
|
14
|
+
* Writes chat state to localStorage immediately.
|
|
15
|
+
*/
|
|
16
|
+
export declare function saveChatState(publishableApiKey: string, state: PersistedChatState): void;
|
|
17
|
+
/**
|
|
18
|
+
* Debounced variant of saveChatState (300ms trailing).
|
|
19
|
+
* Use during streaming to avoid excessive writes on every onContent callback.
|
|
20
|
+
*/
|
|
21
|
+
export declare function saveChatStateDebounced(publishableApiKey: string, state: PersistedChatState): void;
|
|
22
|
+
/**
|
|
23
|
+
* Removes persisted state and cancels any pending debounced save.
|
|
24
|
+
* Call when the user explicitly resets the chat.
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearChatState(publishableApiKey: string): void;
|
|
27
|
+
//# sourceMappingURL=persistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../src/persistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAOvC,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AASD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAgBlF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAMxF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAUjG;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAW9D"}
|