@levo-so/site-runtime 0.3.1 → 0.3.7
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/{DateTimeWidget-C1jHOtz7.js → DateTimeWidget-Cctsvcrs.js} +2 -2
- package/Dialog-DVB4WpBS.js +130 -0
- package/{KBChatWidget-D7F9LRwI.js → KBChatWidget-Cnq0DCOQ.js} +383 -435
- package/LevoProvider-nmIbMlsk.js +20 -0
- package/{PhoneWidget-_nw97rkI.js → PhoneWidget-J3VTMWJH.js} +2 -2
- package/{PopupRenderer-Bncp54gB-DuCULkBK.js → PopupBody-DZVwDLkg-yrot8Uqb.js} +201 -910
- package/PopupRenderer-BjW1jg70-Biwj2bIc.js +387 -0
- package/{RichTextWidget-D-mGlES0.js → RichTextWidget-BOrVIR2j.js} +10 -9
- package/{VerifyButton-BkP98H17.js → VerifyButton-CA1GtEZJ.js} +20 -19
- package/{theme.cssm-2YTdd8Yh.js → createThemeExtension-DhGk81nV.js} +2 -2
- package/{dist-DBbiX2ST.js → dist-C8gLeklT.js} +601 -598
- package/{dist-CJknSbJK.js → dist-Cb6sb7nO.js} +21 -22
- package/{inlineCollectionTheme-D2w17LHX.js → generateRadiusScale-54mE9ikx.js} +4 -19
- package/index.d.ts +15 -0
- package/index.js +295 -290
- package/{inlineBaseTheme-DS-AfUHi.js → inlineBaseTheme-B6E9zzyp.js} +2 -2
- package/inlineCollectionTheme-DYYMrmcE.js +19 -0
- package/{kbChat-AUJxjURc.js → kbChat-DIb4AS7E.js} +31 -26
- package/{nodeAlignment-Cn6xNtOP.js → nodeAlignment-D70kOcui.js} +13 -13
- package/package.json +9 -9
- package/pillChrome-BAu5AfCT.js +30 -0
- package/popupState-JmpeKzgM-qhNTV79U.js +229 -0
- package/popups.js +1 -1
- package/react-6kO0cqgr.js +74 -0
- package/rteTheme.cssm-xg0gJ28J.js +4 -0
- package/styles.css +1 -1
- package/theme.cssm-mkQwezuj.js +4 -0
- package/usePopupRedirect-BThP_YPW-DoixMAB9.js +80 -0
- package/Dialog-CzVhHLEY.js +0 -145
- package/pillChrome-AhXOWXIb.js +0 -20
- /package/{CollectionField-CzS-34zx.js → CollectionField-C59pmeQw.js} +0 -0
- /package/{Popover-q5dL7y0W.js → Popover-C7zZHBIc.js} +0 -0
- /package/{es-iCqKQf1c.js → es-CztjLuNy.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n } from "./
|
|
1
|
+
import { n as e, t } from "./generateRadiusScale-54mE9ikx.js";
|
|
2
|
+
import { t as n } from "./createThemeExtension-DhGk81nV.js";
|
|
3
3
|
//#region ../../libraries/levocn/dist/styles/inlineBaseTheme.js
|
|
4
4
|
var r = n(e), i = (e) => e ? e.radius && !e.radiusScale ? r({
|
|
5
5
|
...e,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as e } from "./createThemeExtension-DhGk81nV.js";
|
|
2
|
+
//#region ../../libraries/react-collection/dist/theme/collectionThemeVars.cssm.js
|
|
3
|
+
var t = {
|
|
4
|
+
form: {
|
|
5
|
+
maxWidth: "var(--_1092q7b0)",
|
|
6
|
+
gap: "var(--_1092q7b1)",
|
|
7
|
+
borderRadius: "var(--_1092q7b2)",
|
|
8
|
+
labelFontSize: "var(--_1092q7b3)",
|
|
9
|
+
helpFontSize: "var(--_1092q7b4)"
|
|
10
|
+
},
|
|
11
|
+
input: {
|
|
12
|
+
fontSize: "var(--_1092q7b5)",
|
|
13
|
+
height: "var(--_1092q7b6)",
|
|
14
|
+
borderRadius: "var(--_1092q7b7)"
|
|
15
|
+
},
|
|
16
|
+
checkbox: { labelFontSize: "var(--_1092q7b8)" }
|
|
17
|
+
}, n = e(t);
|
|
18
|
+
//#endregion
|
|
19
|
+
export { t as n, n as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as e, c as t, f as n, h as r, l as i, m as a, n as o, o as s, p as c, r as l, t as u, u as d,
|
|
2
|
+
import { a as e, c as t, f as n, h as r, l as i, m as a, n as o, o as s, p as c, r as l, t as u, u as d, y as f } from "./pillChrome-BAu5AfCT.js";
|
|
3
3
|
import { useEffect as p, useRef as m, useState as h } from "react";
|
|
4
4
|
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
5
5
|
import { ArrowUp as v, Sparkles as y } from "lucide-react";
|
|
@@ -20,47 +20,51 @@ var b = (e) => f("active_agent", e), x = (e) => {
|
|
|
20
20
|
if (!(!n || typeof window > "u")) try {
|
|
21
21
|
t === null ? window.sessionStorage.removeItem(n) : window.sessionStorage.setItem(n, JSON.stringify(t));
|
|
22
22
|
} catch {}
|
|
23
|
-
}, C = ({ url: e, workspaceId: t, headers: n }) => {
|
|
24
|
-
let [
|
|
23
|
+
}, C = ({ url: e, workspaceId: t, headers: n, path: r }) => {
|
|
24
|
+
let [i, a] = h({ status: "loading" });
|
|
25
25
|
p(() => {
|
|
26
26
|
let e = x(t);
|
|
27
|
-
|
|
27
|
+
a(e ? {
|
|
28
28
|
status: "ready",
|
|
29
29
|
agent: e
|
|
30
30
|
} : (e) => e.status === "ready" ? { status: "loading" } : e);
|
|
31
31
|
}, [t]);
|
|
32
|
-
let
|
|
33
|
-
return
|
|
32
|
+
let o = m(n);
|
|
33
|
+
return o.current = n, p(() => {
|
|
34
34
|
if (!t || !e) return;
|
|
35
|
-
let n = new AbortController();
|
|
35
|
+
let n = r ? `${e}${e.includes("?") ? "&" : "?"}path=${encodeURIComponent(r)}` : e, i = new AbortController();
|
|
36
36
|
return (async () => {
|
|
37
37
|
try {
|
|
38
|
-
let
|
|
38
|
+
let e = await fetch(n, {
|
|
39
39
|
method: "GET",
|
|
40
40
|
credentials: "include",
|
|
41
|
-
headers:
|
|
42
|
-
signal:
|
|
41
|
+
headers: o.current,
|
|
42
|
+
signal: i.signal
|
|
43
43
|
});
|
|
44
|
-
if (!
|
|
45
|
-
S(t, null),
|
|
44
|
+
if (!e.ok) {
|
|
45
|
+
S(t, null), a({ status: "missing" });
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
let
|
|
49
|
-
if (!
|
|
50
|
-
S(t, null),
|
|
48
|
+
let r = (await e.json())?.content?.data;
|
|
49
|
+
if (!r || typeof r.id != "string" || r.id.length === 0) {
|
|
50
|
+
S(t, null), a({ status: "missing" });
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
S(t,
|
|
53
|
+
S(t, r), a({
|
|
54
54
|
status: "ready",
|
|
55
|
-
agent:
|
|
55
|
+
agent: r
|
|
56
56
|
});
|
|
57
57
|
} catch (e) {
|
|
58
58
|
if (e?.name === "AbortError") return;
|
|
59
|
-
console.warn("[levo-kb-chat] active-agent boot failed:", e),
|
|
59
|
+
console.warn("[levo-kb-chat] active-agent boot failed:", e), a({ status: "error" });
|
|
60
60
|
}
|
|
61
|
-
})(), () =>
|
|
62
|
-
}, [
|
|
63
|
-
|
|
61
|
+
})(), () => i.abort();
|
|
62
|
+
}, [
|
|
63
|
+
t,
|
|
64
|
+
e,
|
|
65
|
+
r
|
|
66
|
+
]), i;
|
|
67
|
+
}, w = (...e) => e.filter(Boolean).join(" "), T = () => import("./KBChatWidget-Cnq0DCOQ.js"), E = (e) => {
|
|
64
68
|
let [t, n] = h(null), [r, i] = h(!1), [a, o] = h("");
|
|
65
69
|
return t ? /* @__PURE__ */ g(t, {
|
|
66
70
|
initialOpen: !0,
|
|
@@ -140,23 +144,24 @@ var b = (e) => f("active_agent", e), x = (e) => {
|
|
|
140
144
|
})
|
|
141
145
|
})
|
|
142
146
|
});
|
|
143
|
-
}, k = "/.levo/public/api/v1/agents/kb-chat/public", A = (e) => e.replace(/\/v1\/agents\/kb-chat\/public\/?$/, ""), j = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, apiBaseUrl: i = k, authHeaders: a, showBranding: o, siteSlug: s }) => {
|
|
144
|
-
let
|
|
147
|
+
}, k = "/.levo/public/api/v1/agents/kb-chat/public", A = (e) => e.replace(/\/v1\/agents\/kb-chat\/public\/?$/, ""), j = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, apiBaseUrl: i = k, authHeaders: a, showBranding: o, siteSlug: s, path: c }) => {
|
|
148
|
+
let l = C({
|
|
145
149
|
url: `${A(i)}/v1/intelligence/site-agent/get-active`,
|
|
146
150
|
workspaceId: e,
|
|
147
151
|
headers: e ? {
|
|
148
152
|
...a,
|
|
149
153
|
"Levo-Workspace": e
|
|
150
|
-
} : a
|
|
154
|
+
} : a,
|
|
155
|
+
path: c
|
|
151
156
|
});
|
|
152
|
-
return
|
|
157
|
+
return l.status === "ready" ? /* @__PURE__ */ g("div", {
|
|
153
158
|
"data-ai-chat-root": !0,
|
|
154
159
|
children: /* @__PURE__ */ g(E, {
|
|
155
160
|
workspaceId: e,
|
|
156
161
|
siteName: t,
|
|
157
162
|
siteLogo: n,
|
|
158
163
|
siteIcon: r,
|
|
159
|
-
agentId:
|
|
164
|
+
agentId: l.agent.id,
|
|
160
165
|
apiBaseUrl: i,
|
|
161
166
|
authHeaders: a,
|
|
162
167
|
showBranding: o,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "./createThemeExtension-DhGk81nV.js";
|
|
2
2
|
import { Extension as t, findParentNodeClosestToPos as n } from "@tiptap/core";
|
|
3
3
|
import { NodeSelection as r } from "@tiptap/pm/state";
|
|
4
4
|
import { CellSelection as i, cellAround as a } from "@tiptap/pm/tables";
|
|
5
5
|
//#region ../../libraries/editor-core/dist/styles/content.cssm.js
|
|
6
|
-
var o = "_12oclrg0", s =
|
|
6
|
+
var o = "_12oclrg0", s = e({
|
|
7
7
|
baseSpacing: "var(--_1q6hy0o0)",
|
|
8
8
|
highlight: "var(--_1q6hy0o1)",
|
|
9
9
|
highlightForeground: "var(--_1q6hy0o2)"
|
|
10
10
|
});
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region ../../libraries/editor-core/dist/utils/getSelectedNodeOfType.js
|
|
13
|
-
function
|
|
13
|
+
function c(e, t) {
|
|
14
14
|
let o = [], s = new Set(t);
|
|
15
15
|
if (e instanceof i) return e.forEachCell((e, t) => {
|
|
16
16
|
s.has(e.type.name) && o.push({
|
|
@@ -41,7 +41,7 @@ function l(e, t) {
|
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region ../../libraries/editor-core/dist/utils/updateNodesAttr.js
|
|
44
|
-
function
|
|
44
|
+
function l(e, t, n, r) {
|
|
45
45
|
if (!t.length) return !1;
|
|
46
46
|
let i = !1;
|
|
47
47
|
for (let { pos: a } of t) {
|
|
@@ -56,12 +56,12 @@ function u(e, t, n, r) {
|
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region ../../libraries/editor-core/dist/extensions/nodeStyling/nodeAlignment.js
|
|
59
|
-
function
|
|
59
|
+
function u(e, t, n) {
|
|
60
60
|
if (e.length === 0) return null;
|
|
61
61
|
for (let r of e) if ((r.node.attrs?.[t] ?? null) !== n) return n;
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
|
-
var
|
|
64
|
+
var d = t.create({
|
|
65
65
|
name: "textAlign",
|
|
66
66
|
addOptions() {
|
|
67
67
|
return {
|
|
@@ -122,18 +122,18 @@ var f = t.create({
|
|
|
122
122
|
},
|
|
123
123
|
addCommands() {
|
|
124
124
|
let e = (e, t) => (n) => ({ state: r, tr: i }) => {
|
|
125
|
-
let a =
|
|
126
|
-
return a.length === 0 ? !1 :
|
|
125
|
+
let a = c(r.selection, this.options.types);
|
|
126
|
+
return a.length === 0 ? !1 : l(i, a, e, t(a, n));
|
|
127
127
|
};
|
|
128
128
|
return {
|
|
129
129
|
setNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null : t),
|
|
130
130
|
unsetNodeTextAlign: e("textAlign", () => null),
|
|
131
|
-
toggleNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null :
|
|
131
|
+
toggleNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null : u(e, "textAlign", t)),
|
|
132
132
|
setNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null : t),
|
|
133
133
|
unsetNodeVAlign: e("nodeVerticalAlign", () => null),
|
|
134
|
-
toggleNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null :
|
|
134
|
+
toggleNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null : u(e, "nodeVerticalAlign", t)),
|
|
135
135
|
setNodeAlignment: (e, t) => ({ state: n, tr: r }) => {
|
|
136
|
-
let i =
|
|
136
|
+
let i = c(n.selection, this.options.types);
|
|
137
137
|
if (i.length === 0) return !1;
|
|
138
138
|
let a = !1;
|
|
139
139
|
for (let { node: n, pos: o } of i) {
|
|
@@ -143,7 +143,7 @@ var f = t.create({
|
|
|
143
143
|
return a;
|
|
144
144
|
},
|
|
145
145
|
unsetNodeAlignment: () => ({ state: e, tr: t }) => {
|
|
146
|
-
let n =
|
|
146
|
+
let n = c(e.selection, this.options.types);
|
|
147
147
|
if (n.length === 0) return !1;
|
|
148
148
|
let r = !1;
|
|
149
149
|
for (let { node: e, pos: i } of n) {
|
|
@@ -163,4 +163,4 @@ var f = t.create({
|
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
//#endregion
|
|
166
|
-
export {
|
|
166
|
+
export { s as n, o as r, d as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levo-so/site-runtime",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Runtime for Levo Studio v3 sites — the editor preview inspector, page head metadata, and the Levo data client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -67,18 +67,18 @@
|
|
|
67
67
|
"lowlight": "3.1.0",
|
|
68
68
|
"@vanilla-extract/dynamic": "2.1.5",
|
|
69
69
|
"sonner": "2.0.7",
|
|
70
|
-
"@assistant-ui/react": "0.
|
|
71
|
-
"@assistant-ui/react-ai-sdk": "1.
|
|
72
|
-
"@assistant-ui/react-markdown": "0.
|
|
73
|
-
"@assistant-ui/core": "0.
|
|
74
|
-
"@assistant-ui/store": "0.
|
|
75
|
-
"@assistant-ui/tap": "0.
|
|
70
|
+
"@assistant-ui/react": "0.15.10",
|
|
71
|
+
"@assistant-ui/react-ai-sdk": "1.4.4",
|
|
72
|
+
"@assistant-ui/react-markdown": "0.14.9",
|
|
73
|
+
"@assistant-ui/core": "0.3.9",
|
|
74
|
+
"@assistant-ui/store": "0.3.7",
|
|
75
|
+
"@assistant-ui/tap": "0.9.10",
|
|
76
76
|
"remark-gfm": "4.0.1",
|
|
77
77
|
"@stripe/react-stripe-js": "^3.1.1",
|
|
78
78
|
"@stripe/stripe-js": "^5.5.0",
|
|
79
79
|
"react-razorpay": "^3.0.1",
|
|
80
|
-
"@levo-so/core": "0.
|
|
81
|
-
"@levo-so/insights": "0.
|
|
80
|
+
"@levo-so/core": "0.3.7",
|
|
81
|
+
"@levo-so/insights": "0.3.7"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"@base-ui/react": "^1.5.0",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../../libraries/ai-chat/src/helpers.ts
|
|
2
|
+
var e = (e, t = {
|
|
3
|
+
hour: "numeric",
|
|
4
|
+
minute: "2-digit"
|
|
5
|
+
}) => {
|
|
6
|
+
if (!e) return "";
|
|
7
|
+
let n = e instanceof Date ? e : new Date(e);
|
|
8
|
+
return Number.isNaN(n.getTime()) ? "" : n.toLocaleTimeString([], t);
|
|
9
|
+
}, t = (e, t) => t ? `levo.site_chat.${e}.${t}` : null, n = (e, t) => {
|
|
10
|
+
e.style.height = "auto", e.style.height = t === void 0 ? `${e.scrollHeight}px` : `${Math.min(e.scrollHeight, t)}px`;
|
|
11
|
+
}, r = (e, t) => {
|
|
12
|
+
e.setText(t);
|
|
13
|
+
let n = document.activeElement?.closest("[data-ai-chat-root]") ?? document;
|
|
14
|
+
requestAnimationFrame(() => {
|
|
15
|
+
let e = n.querySelector("textarea[data-ai-chat-composer]");
|
|
16
|
+
if (!e) return;
|
|
17
|
+
e.focus();
|
|
18
|
+
let t = e.value.length;
|
|
19
|
+
e.setSelectionRange(t, t);
|
|
20
|
+
});
|
|
21
|
+
}, i = "w-72", a = "ai-chat-pill-gradient relative rounded-[30px] p-[2px] transition-shadow duration-300", o = "shadow-lg shadow-zinc-950/10", s = "shadow-md", c = "ai-chat-pill-surface min-h-14 w-full rounded-[28px] bg-white p-1.5", l = "ai-chat-pill-surface--stacked", u = "ai-chat-pill-input relative min-w-0", d = "ai-chat-pill-actions flex items-center gap-1.5", f = "ai-chat-pill-spark flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full text-blue-500 transition-[background-color,transform] duration-150 hover:bg-zinc-50 active:scale-95", p = "flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-[transform,box-shadow] duration-150 hover:scale-105 hover:shadow-md active:scale-95", m = "block h-6 max-h-[120px] w-full resize-none overflow-y-auto bg-transparent text-base text-zinc-900 leading-6 placeholder:text-zinc-400 focus:outline-none", h = 24, g = (e, t) => {
|
|
22
|
+
e.classList.remove(l), t.style.height = "auto";
|
|
23
|
+
let r = t.scrollHeight > h + 4;
|
|
24
|
+
return e.classList.toggle(l, r), n(t, 120), r;
|
|
25
|
+
}, _ = "ai-chat-pill-label pointer-events-none absolute inset-y-0 left-0 flex max-w-full items-center truncate bg-clip-text font-semibold text-[15px] text-transparent", v = {
|
|
26
|
+
backgroundColor: "var(--color-brand, #0a0a0a)",
|
|
27
|
+
color: "var(--color-brand-foreground, #fff)"
|
|
28
|
+
}, y = (e) => e ? `Ask ${e}` : "Ask AI";
|
|
29
|
+
//#endregion
|
|
30
|
+
export { r as _, p as a, o as c, l as d, m as f, n as g, y as h, _ as i, f as l, g as m, a as n, v as o, i as p, u as r, s, d as t, c as u, e as v, t as y };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/clean-stores/index.js
|
|
2
|
+
var e = Symbol("clean"), t = [], n = 0, r = 4, i = 0, a = (a) => {
|
|
3
|
+
let o = [], s = {
|
|
4
|
+
get() {
|
|
5
|
+
return s.lc || s.listen(() => {})(), s.value;
|
|
6
|
+
},
|
|
7
|
+
lc: 0,
|
|
8
|
+
listen(e) {
|
|
9
|
+
return s.lc = o.push(e), () => {
|
|
10
|
+
for (let i = n + r; i < t.length;) t[i] === e ? t.splice(i, r) : i += r;
|
|
11
|
+
let i = o.indexOf(e);
|
|
12
|
+
~i && (o.splice(i, 1), --s.lc || s.off());
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
notify(e, a) {
|
|
16
|
+
i++;
|
|
17
|
+
let c = !t.length;
|
|
18
|
+
for (let n of o) t.push(n, s.value, e, a);
|
|
19
|
+
if (c) {
|
|
20
|
+
for (n = 0; n < t.length; n += r) t[n](t[n + 1], t[n + 2], t[n + 3]);
|
|
21
|
+
t.length = 0;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
off() {},
|
|
25
|
+
set(e) {
|
|
26
|
+
let t = s.value;
|
|
27
|
+
t !== e && (s.value = e, s.notify(t));
|
|
28
|
+
},
|
|
29
|
+
subscribe(e) {
|
|
30
|
+
let t = s.listen(e);
|
|
31
|
+
return e(s.value), t;
|
|
32
|
+
},
|
|
33
|
+
value: a
|
|
34
|
+
};
|
|
35
|
+
return process.env.NODE_ENV !== "production" && (s[e] = () => {
|
|
36
|
+
o = [], s.lc = 0, s.off();
|
|
37
|
+
}), s;
|
|
38
|
+
}, o = 5, s = 6, c = 10, l = (e, t, n, r) => (e.events = e.events || {}, e.events[n + c] || (e.events[n + c] = r((t) => {
|
|
39
|
+
e.events[n].reduceRight((e, t) => (t(e), e), {
|
|
40
|
+
shared: {},
|
|
41
|
+
...t
|
|
42
|
+
});
|
|
43
|
+
})), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
|
|
44
|
+
let r = e.events[n], i = r.indexOf(t);
|
|
45
|
+
r.splice(i, 1), r.length || (delete e.events[n], e.events[n + c](), delete e.events[n + c]);
|
|
46
|
+
}), u = 1e3, d = (t, n) => l(t, (e) => {
|
|
47
|
+
let r = n(e);
|
|
48
|
+
r && t.events[s].push(r);
|
|
49
|
+
}, o, (n) => {
|
|
50
|
+
let r = t.listen;
|
|
51
|
+
t.listen = (...e) => (!t.lc && !t.active && (t.active = !0, n()), r(...e));
|
|
52
|
+
let i = t.off;
|
|
53
|
+
if (t.events[s] = [], t.off = () => {
|
|
54
|
+
i(), setTimeout(() => {
|
|
55
|
+
if (t.active && !t.lc) {
|
|
56
|
+
t.active = !1;
|
|
57
|
+
for (let e of t.events[s]) e();
|
|
58
|
+
t.events[s] = [];
|
|
59
|
+
}
|
|
60
|
+
}, u);
|
|
61
|
+
}, process.env.NODE_ENV !== "production") {
|
|
62
|
+
let n = t[e];
|
|
63
|
+
t[e] = () => {
|
|
64
|
+
for (let e of t.events[s]) e();
|
|
65
|
+
t.events[s] = [], t.active = !1, n();
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return () => {
|
|
69
|
+
t.listen = r, t.off = i;
|
|
70
|
+
};
|
|
71
|
+
}), f = (e, t, n) => {
|
|
72
|
+
Array.isArray(e) || (e = [e]);
|
|
73
|
+
let r, o, s = () => {
|
|
74
|
+
if (o === i) return;
|
|
75
|
+
o = i;
|
|
76
|
+
let n = e.map((e) => e.get());
|
|
77
|
+
if (!r || n.some((e, t) => e !== r[t])) {
|
|
78
|
+
r = n;
|
|
79
|
+
let e = t(...n);
|
|
80
|
+
e && e.then && e.t ? e.then((e) => {
|
|
81
|
+
r === n && c.set(e);
|
|
82
|
+
}) : (c.set(e), o = i);
|
|
83
|
+
}
|
|
84
|
+
}, c = a(void 0), l = c.get;
|
|
85
|
+
c.get = () => (s(), l());
|
|
86
|
+
let u, f = n ? () => {
|
|
87
|
+
clearTimeout(u), u = setTimeout(s);
|
|
88
|
+
} : s;
|
|
89
|
+
return d(c, () => {
|
|
90
|
+
let t = e.map((e) => e.listen(f));
|
|
91
|
+
return s(), () => {
|
|
92
|
+
for (let e of t) e();
|
|
93
|
+
};
|
|
94
|
+
}), c;
|
|
95
|
+
}, p = (e, t) => f(e, t), m = (e) => e, h = {}, g = {
|
|
96
|
+
addEventListener() {},
|
|
97
|
+
removeEventListener() {}
|
|
98
|
+
};
|
|
99
|
+
function _() {
|
|
100
|
+
try {
|
|
101
|
+
return typeof localStorage < "u";
|
|
102
|
+
} catch {
|
|
103
|
+
return !1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
_() && (h = localStorage), typeof window < "u" && (g = {
|
|
107
|
+
addEventListener(e, t, n) {
|
|
108
|
+
window.addEventListener("storage", t), window.addEventListener("pageshow", n);
|
|
109
|
+
},
|
|
110
|
+
removeEventListener(e, t, n) {
|
|
111
|
+
window.removeEventListener("storage", t), window.removeEventListener("pageshow", n);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
function v(e, t = void 0, n = {}) {
|
|
115
|
+
let r = n.encode || m, i = n.decode || m, o = h[e], s = a(e in h ? i(o) : t), c = s.set;
|
|
116
|
+
s.set = (t) => {
|
|
117
|
+
o = r(t), o === void 0 ? delete h[e] : h[e] = o, c(t);
|
|
118
|
+
};
|
|
119
|
+
function l(n) {
|
|
120
|
+
n.key === e ? n.newValue === null ? c(t) : c(i(n.newValue)) : h[e] || c(t);
|
|
121
|
+
}
|
|
122
|
+
function u() {
|
|
123
|
+
o !== h[e] && s.set(e in h ? i(h[e]) : t);
|
|
124
|
+
}
|
|
125
|
+
return d(s, () => {
|
|
126
|
+
if (u(), n.listen !== !1) return g.addEventListener(e, l, u), () => {
|
|
127
|
+
g.removeEventListener(e, l, u);
|
|
128
|
+
};
|
|
129
|
+
}), s;
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region ../../libraries/popups/dist/popupState-JmpeKzgM.js
|
|
133
|
+
var y = 6e4, b = "lv_popups_session", x = {
|
|
134
|
+
active_popup_id: null,
|
|
135
|
+
shown_popup_ids: [],
|
|
136
|
+
last_closed_at: null
|
|
137
|
+
}, S = v("lv_popups_state", {}, {
|
|
138
|
+
encode: JSON.stringify,
|
|
139
|
+
decode: JSON.parse
|
|
140
|
+
}), C = (e) => {
|
|
141
|
+
if (!e) return x;
|
|
142
|
+
try {
|
|
143
|
+
return {
|
|
144
|
+
...JSON.parse(e),
|
|
145
|
+
active_popup_id: null
|
|
146
|
+
};
|
|
147
|
+
} catch {
|
|
148
|
+
return x;
|
|
149
|
+
}
|
|
150
|
+
}, w = a((() => {
|
|
151
|
+
if (typeof sessionStorage > "u") return x;
|
|
152
|
+
try {
|
|
153
|
+
return C(sessionStorage.getItem(b));
|
|
154
|
+
} catch {
|
|
155
|
+
return x;
|
|
156
|
+
}
|
|
157
|
+
})()), T = w.set;
|
|
158
|
+
w.set = (e) => {
|
|
159
|
+
T(e);
|
|
160
|
+
try {
|
|
161
|
+
sessionStorage.setItem(b, JSON.stringify(e));
|
|
162
|
+
} catch {}
|
|
163
|
+
};
|
|
164
|
+
var E = p([w, S], (e, t) => ({
|
|
165
|
+
active_popup_id: e.active_popup_id,
|
|
166
|
+
shown_popup_ids: e.shown_popup_ids,
|
|
167
|
+
last_closed_at: e.last_closed_at,
|
|
168
|
+
previous_popups: t
|
|
169
|
+
})), D = a([]), O = (e) => {
|
|
170
|
+
D.set(e);
|
|
171
|
+
}, k = a(!0), A = (e) => {
|
|
172
|
+
k.set(e);
|
|
173
|
+
}, j = () => E.get(), M = (e, t) => e.includes(t) ? e : [...e, t], N = "manual", P = () => N, F = null, I = () => F, L = [], R = null, z = () => {
|
|
174
|
+
if (R) return;
|
|
175
|
+
let { last_closed_at: e } = w.get();
|
|
176
|
+
if (!e) return;
|
|
177
|
+
let t = y - (Date.now() - e);
|
|
178
|
+
if (t <= 0) {
|
|
179
|
+
B();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
R = setTimeout(() => {
|
|
183
|
+
R = null, B();
|
|
184
|
+
}, t);
|
|
185
|
+
}, B = () => {
|
|
186
|
+
let e = w.get();
|
|
187
|
+
if (!e.active_popup_id) {
|
|
188
|
+
if (e.last_closed_at && Date.now() - e.last_closed_at < 6e4) {
|
|
189
|
+
z();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
for (; L.length > 0;) {
|
|
193
|
+
let e = L.shift();
|
|
194
|
+
if (U(e.popup, { trigger_type: e.trigger_type })) return;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}, V = (e, t) => {
|
|
198
|
+
L.some((t) => t.popup.id === e.id) || (L.push({
|
|
199
|
+
popup: e,
|
|
200
|
+
trigger_type: t
|
|
201
|
+
}), z());
|
|
202
|
+
}, H = (e, t) => {
|
|
203
|
+
let n = j();
|
|
204
|
+
if (t?.type === "always") return !n.shown_popup_ids.includes(e);
|
|
205
|
+
let r = n.previous_popups[e];
|
|
206
|
+
return r ? !t || t.type === "once" ? !1 : t.type === "interval" && t.interval_ms ? Date.now() - r.triggered_at >= t.interval_ms : !0 : !0;
|
|
207
|
+
}, U = (e, t = {}) => {
|
|
208
|
+
let { force: n = !1, trigger_type: r = "manual" } = t, i = e.id, a = e.settings?.display_frequency, o = w.get();
|
|
209
|
+
return o.active_popup_id === i ? !0 : !n && (o.active_popup_id || o.last_closed_at && Date.now() - o.last_closed_at < 6e4 || !H(i, a)) ? !1 : (R &&= (clearTimeout(R), null), N = r, F = Date.now(), w.set({
|
|
210
|
+
active_popup_id: i,
|
|
211
|
+
shown_popup_ids: M(o.shown_popup_ids, i),
|
|
212
|
+
last_closed_at: o.last_closed_at
|
|
213
|
+
}), a?.type !== "always" && S.set({
|
|
214
|
+
...S.get(),
|
|
215
|
+
[i]: { triggered_at: Date.now() }
|
|
216
|
+
}), !0);
|
|
217
|
+
}, W = (e, t = {}) => {
|
|
218
|
+
let { trigger_type: n = "manual" } = t;
|
|
219
|
+
return U(e, { trigger_type: n }) ? !0 : (H(e.id, e.settings?.display_frequency) && V(e, n), !1);
|
|
220
|
+
}, G = (e) => {
|
|
221
|
+
let t = w.get();
|
|
222
|
+
t.active_popup_id === e && (N = "manual", F = null, w.set({
|
|
223
|
+
...t,
|
|
224
|
+
active_popup_id: null,
|
|
225
|
+
last_closed_at: Date.now()
|
|
226
|
+
}), setTimeout(B, 0));
|
|
227
|
+
};
|
|
228
|
+
//#endregion
|
|
229
|
+
export { D as a, G as c, E as d, P as f, w as i, A as l, W as n, O as o, I as r, j as s, U as t, k as u };
|
package/popups.js
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { t as e } from "./inlineBaseTheme-B6E9zzyp.js";
|
|
2
|
+
import { useCallback as t, useRef as n, useSyncExternalStore as r } from "react";
|
|
3
|
+
//#region ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/listen-keys/index.js
|
|
4
|
+
function i(e, t, n) {
|
|
5
|
+
let r = new Set(t).add(void 0);
|
|
6
|
+
return e.listen((e, t, i) => {
|
|
7
|
+
r.has(i) && n(e, t, i);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../../libraries/popups/dist/themeMapping-Bi9Rcr5G.js
|
|
12
|
+
var a = (e) => {
|
|
13
|
+
if (e == null) return;
|
|
14
|
+
if (typeof e == "string") return e;
|
|
15
|
+
if (typeof e != "object") return;
|
|
16
|
+
let t = e;
|
|
17
|
+
if (typeof t.l != "number" || typeof t.c != "number" || typeof t.h != "number") return;
|
|
18
|
+
let n = (e) => Math.round(e * 1e4) / 1e4, r = n(t.l), i = n(t.c), a = n(t.h), o = typeof t.alpha == "number" ? n(t.alpha) : 1;
|
|
19
|
+
return o < 1 ? `oklch(${r} ${i} ${a} / ${o})` : `oklch(${r} ${i} ${a})`;
|
|
20
|
+
}, o = (e) => {
|
|
21
|
+
let t = e.colors;
|
|
22
|
+
return !t || typeof t != "object" ? !1 : Object.values(t).some((e) => e != null);
|
|
23
|
+
}, s = (e) => {
|
|
24
|
+
if (!e || !o(e)) return null;
|
|
25
|
+
let t = e.colors, n = t?.brand ?? {}, r = e.fonts, i = e.sizes;
|
|
26
|
+
return {
|
|
27
|
+
colors: {
|
|
28
|
+
brand: {
|
|
29
|
+
main: a(n.main) ?? "",
|
|
30
|
+
foreground: a(n.foreground) ?? ""
|
|
31
|
+
},
|
|
32
|
+
text1: a(t.text1) ?? "",
|
|
33
|
+
text2: a(t.text2) ?? "",
|
|
34
|
+
page: a(t.page) ?? "",
|
|
35
|
+
border: a(t.border) ?? ""
|
|
36
|
+
},
|
|
37
|
+
fonts: {
|
|
38
|
+
heading: r?.heading ?? "inherit",
|
|
39
|
+
body: r?.body ?? "inherit"
|
|
40
|
+
},
|
|
41
|
+
sizes: { radius: i?.radius ?? "4px" }
|
|
42
|
+
};
|
|
43
|
+
}, c = (e) => {
|
|
44
|
+
if (e) return {
|
|
45
|
+
colors: {
|
|
46
|
+
primary: e.colors?.brand?.main,
|
|
47
|
+
primaryForeground: e.colors?.brand?.foreground,
|
|
48
|
+
foreground: e.colors?.text1,
|
|
49
|
+
text: e.colors?.text1,
|
|
50
|
+
heading: e.colors?.text1,
|
|
51
|
+
mutedForeground: e.colors?.text2,
|
|
52
|
+
background: e.colors?.page,
|
|
53
|
+
card: e.colors?.page,
|
|
54
|
+
cardForeground: e.colors?.text1,
|
|
55
|
+
popover: e.colors?.page,
|
|
56
|
+
popoverForeground: e.colors?.text1,
|
|
57
|
+
border: e.colors?.border,
|
|
58
|
+
input: e.colors?.page,
|
|
59
|
+
inputForeground: e.colors?.text1
|
|
60
|
+
},
|
|
61
|
+
fonts: e.fonts,
|
|
62
|
+
radius: e.sizes?.radius
|
|
63
|
+
};
|
|
64
|
+
}, l = (t) => e(c(t)), u = (e, t) => (n) => {
|
|
65
|
+
e.current !== n && (e.current = n, t());
|
|
66
|
+
};
|
|
67
|
+
function d(e, { keys: a, deps: o = [e, a] } = {}) {
|
|
68
|
+
let s = n();
|
|
69
|
+
s.current = e.get();
|
|
70
|
+
let c = t((t) => (u(s, t)(e.value), a?.length > 0 ? i(e, a, u(s, t)) : e.listen(u(s, t))), o), l = () => s.current;
|
|
71
|
+
return r(c, l, l);
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { l as n, s as r, d as t };
|