@hanzo/dev 4.2.0 → 4.2.2
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/{BinaryViewer-CmFUK4zZ.js → BinaryViewer-CeQaKnXQ.js} +19 -19
- package/dist/{ChatMarkdown-nvEI7iCv.js → ChatMarkdown-DqKVAYd6.js} +2460 -2460
- package/dist/{DevicePanel-v5e3sEIf.js → DevicePanel-D-pksK3r.js} +532 -532
- package/dist/{DeviceStreamView-CCIfmbxH.js → DeviceStreamView-DsCoOzDV.js} +377 -377
- package/dist/{DiffCommentAnnotation-BPTN_2a6.js → DiffCommentAnnotation-CCtanhmq.js} +227 -227
- package/dist/{DiffFileTree-B_br90vY.js → DiffFileTree-BhEDIwzm.js} +13 -13
- package/dist/{DiffPanel-V5R5TPuK.js → DiffPanel-BPZ6Ru_G.js} +328 -328
- package/dist/{DiffWorkerPoolProvider-BwFR-Fc9.js → DiffWorkerPoolProvider-8Qh-Y5iP.js} +3 -3
- package/dist/{DocumentPages-VSn83vty.js → DocumentPages-MN1xyIRb.js} +3 -3
- package/dist/{ExpandedImageDialog-CAorLacL.js → ExpandedImageDialog-tCY2TFXU.js} +404 -404
- package/dist/{FileExplorerPane-CeHulcPz.js → FileExplorerPane-BgJw-BA4.js} +4 -4
- package/dist/{FilePreviewPanel-BVNLvWOc.js → FilePreviewPanel-DHteid8j.js} +1089 -1089
- package/dist/{FontFilePreview-Dj8Blcay.js → FontFilePreview-COxgoDy5.js} +2 -2
- package/dist/{FontViewer-CLDdwhSr.js → FontViewer-jxARaj1f.js} +5 -5
- package/dist/{HanzoConnectAccountPages-BEzYfu2l.js → HanzoConnectAccountPages-BM2mB27b.js} +357 -357
- package/dist/{HanzoConnectSidebarSignIn-BhD6-Up5.js → HanzoConnectSidebarSignIn-BSOkKAjH.js} +3 -3
- package/dist/{Icons-CvSmt8vD.js → Icons-CdegMw5l.js} +1 -1
- package/dist/{LargeTextViewer-DfFnYGCw.js → LargeTextViewer-BX5-yWcy.js} +8 -8
- package/dist/{MermaidDiagram-CTolIzQD.js → MermaidDiagram-sVLnox7j.js} +8 -8
- package/dist/{MermaidFilePreview-CP2zP4FU.js → MermaidFilePreview-BqB2exZU.js} +2 -2
- package/dist/{MermaidViewer-BDfYkS9E.js → MermaidViewer-B0WYx1jk.js} +3 -3
- package/dist/{NotebookPreview-Cybs5uM0.js → NotebookPreview-B_7pSd7A.js} +10 -10
- package/dist/{OfficeFilePreview-7JsmSoKU.js → OfficeFilePreview-BJsNoaju.js} +2 -2
- package/dist/{OfficeViewer-CJoojlJK.js → OfficeViewer-TgdFnOtV.js} +10 -10
- package/dist/{OpenInPicker-BIMWUxBP.js → OpenInPicker-B3gPcFs6.js} +287 -287
- package/dist/{OpenXmlOfficeViewer-C24Kj8DM.js → OpenXmlOfficeViewer-C18a0NFP.js} +4 -4
- package/dist/{PdfViewer-Cf1iD759.js → PdfViewer-BanXvPmz.js} +16 -16
- package/dist/{PreviewFaviconIcon-zFOuzIxe.js → PreviewFaviconIcon-Dzjf4QXZ.js} +892 -892
- package/dist/{PreviewImage-oY5YnuTr.js → PreviewImage-Ct8eWJb8.js} +3 -3
- package/dist/{PreviewImageContent-n6eLzY99.js → PreviewImageContent-Dd8dzt9u.js} +3 -3
- package/dist/{PreviewPanel-Bo4Lt02m.js → PreviewPanel-BnsoHObW.js} +489 -489
- package/dist/{PreviewPanelShell-DhXLeN5j.js → PreviewPanelShell-Dezxjg0T.js} +71 -71
- package/dist/{ProjectIconPickerDialog-D0kFzt8f.js → ProjectIconPickerDialog-LomrzROv.js} +29 -29
- package/dist/{ProjectMonogram-D35xrrXQ.js → ProjectMonogram-D21--FQY.js} +1 -1
- package/dist/{ProviderAuthTerminal-DfsXnu7A.js → ProviderAuthTerminal-CYalqlUB.js} +3 -3
- package/dist/{PullRequestCodeTab-Dv_0kVad.js → PullRequestCodeTab-Jt9jdq55.js} +476 -476
- package/dist/{PullRequestReviewAnnotation-LeuwO-iH.js → PullRequestReviewAnnotation-xg3n0doV.js} +334 -334
- package/dist/{ReadOnlySourcePreview-D__IA5g1.js → ReadOnlySourcePreview-BYlRPbKI.js} +5 -5
- package/dist/{RelativeTime-BMRprQS8.js → RelativeTime-DQhoNsWZ.js} +2 -2
- package/dist/{RightPanelResizeHandle-BLbSz-gk.js → RightPanelResizeHandle-PumvYb9P.js} +2 -2
- package/dist/{ThemeEditorPanel-CUDdsRsE.js → ThemeEditorPanel-BmXXpaCI.js} +196 -196
- package/dist/{ThreadTerminalDrawer-BF3Ix0q_.js → ThreadTerminalDrawer-Cf4l2axO.js} +461 -461
- package/dist/{VirtualTablePreview-dajviAfu.js → VirtualTablePreview-mA6DOFwb.js} +1 -1
- package/dist/{anchoredCopyToast-DnUtg1n_.js → anchoredCopyToast-BVa_dlBU.js} +2 -2
- package/dist/{assetUrls-DkY7vXfM.js → assetUrls-D8lRk7Xd.js} +45 -45
- package/dist/{browserLinkTarget-CA46wnQC.js → browserLinkTarget-CCzAioAu.js} +18 -18
- package/dist/builder/api/models.d.ts +2 -0
- package/dist/builder/api/models.js +6 -1
- package/dist/builder/api/sandbox.d.ts +2 -0
- package/dist/builder/api/sandbox.js +3 -1
- package/dist/builder/desk.d.ts +6 -0
- package/dist/builder/desk.js +79 -14
- package/dist/builder/mind.d.ts +5 -5
- package/dist/builder/mind.js +35 -14
- package/dist/builder/pane.d.ts +1 -1
- package/dist/builder/pane.js +1 -1
- package/dist/builder/panel.js +5 -5
- package/dist/builder/preview-fallback.d.ts +47 -0
- package/dist/builder/preview-fallback.js +341 -0
- package/dist/{changedFileKind-D6QYvIez.js → changedFileKind-OIp-fuQd.js} +5 -5
- package/dist/{collapsible-DFT41MdC.js → collapsible-CDT6JKbk.js} +1 -1
- package/dist/{color-picker-CshqBbpY.js → color-picker-kSVcH92L.js} +16 -16
- package/dist/core.d.ts +38 -0
- package/dist/core.js +1 -1
- package/dist/{decodeImagePreview-DnfFEjhw.js → decodeImagePreview-DbkSuh7q.js} +2 -2
- package/dist/{delimitedPreview-BiEpdYOj.js → delimitedPreview-DbbXcqOT.js} +1 -1
- package/dist/{dialog-DhQtWGRa.js → dialog-EmpqFZiK.js} +40 -40
- package/dist/{embed-c030vUqM.js → embed-CzXFS50X.js} +39626 -38922
- package/dist/{empty-Bm5EzcG8.js → empty-ChM6gdzn.js} +1 -1
- package/dist/{errors-DrFQSJW3.js → errors-D8_Zn8KN.js} +2 -2
- package/dist/{fileContextMenu-BBo91omq.js → fileContextMenu-hdALQktP.js} +54 -54
- package/dist/{fileExplorerLabel-AikEChiS.js → fileExplorerLabel-DMdkA7jY.js} +507 -507
- package/dist/{fileSurfaceChrome-Cqkvn8RQ.js → fileSurfaceChrome-BDyKklTq.js} +26 -26
- package/dist/{hanzoWebAnalytics-CCxpTzcI.js → hanzoWebAnalytics-B1eETW-7.js} +1 -1
- package/dist/index.css +1 -1
- package/dist/{input-group-DEJEuwc9.js → input-group-BZ_QN-y7.js} +1 -1
- package/dist/{keybindings-C5tK_GAk.js → keybindings-D0pBlT1k.js} +7812 -7806
- package/dist/keymap.js +1 -1
- package/dist/{lucideIconByName-DUaXKH0V.js → lucideIconByName-CXY44V8P.js} +6835 -6848
- package/dist/{mediaReference-Bt_mh-ag.js → mediaReference-3wc4ZfY8.js} +95 -95
- package/dist/mediaSource-jW5c7b4r.js +70 -0
- package/dist/{modelPickerVisibility-Jue3CLfc.js → modelPickerVisibility-DBTc5r1G.js} +1 -1
- package/dist/{network-BbwqRm8c.js → network-wuXD7-is.js} +1 -1
- package/dist/{popover-anNQdce7.js → popover-BAyP2Tdr.js} +1 -1
- package/dist/{presentation-D9mVPBHm.js → presentation-68y8EAuH.js} +299 -299
- package/dist/{previewFailureMessages-BKpsSGX5.js → previewFailureMessages-CFguipaK.js} +3 -3
- package/dist/query-BPk2W3QN.js +63 -0
- package/dist/{readBinaryPreview-BAQ4fFjm.js → readBinaryPreview-DgDAUfzQ.js} +2 -2
- package/dist/{refresh-icon-BYx64to1.js → refresh-icon-Vo5ImiQL.js} +1 -1
- package/dist/{scroll-area-ChvX8uOh.js → scroll-area-CEoyjC7h.js} +1 -1
- package/dist/{select-DumYjny_.js → select-DLFnkZsI.js} +2 -2
- package/dist/{session-_kmiSv2A.js → session-Decc4Fo5.js} +1063 -1063
- package/dist/{skeleton-CJqwfMSF.js → skeleton-BOKpAZv6.js} +1 -1
- package/dist/{switch-COwevwaq.js → switch-DjpPjtQN.js} +2 -2
- package/dist/{themePalette-Dl_7omVL.js → themePalette-C-GtwwqV.js} +977 -977
- package/dist/{threadSearch-BHyWwcV3.js → threadSearch-sHEENLiT.js} +162 -162
- package/dist/{toggle-CEO6qTxB.js → toggle-B4F0EEtI.js} +1 -1
- package/dist/{toggle-group-BHovdMDl.js → toggle-group-l8hRPswr.js} +2 -2
- package/dist/{use-atom-command-ByoYq_K6.js → use-atom-command-XemtT1Gv.js} +1 -1
- package/dist/{useAriaLabelledBy-DPSISlnL.js → useAriaLabelledBy-CibvSz-b.js} +1 -1
- package/dist/{useFileMetadata-e7zsixVX.js → useFileMetadata-ChvPTfBY.js} +33 -33
- package/dist/{useFloatingRootContext-CJ9stHca.js → useFloatingRootContext-ppoGvqar.js} +1 -1
- package/dist/{useLiveRefresh-BkKJKXhH.js → useLiveRefresh-aHkPuz6N.js} +172 -172
- package/dist/{useNextRenderData-CyUmSAgz.js → useNextRenderData-Jm142a1q.js} +1 -1
- package/dist/{useSettings-DYG9Dmro.js → useSettings-Due4XCTB.js} +139 -139
- package/dist/{useTextFieldSpeech-COa9XcRx.js → useTextFieldSpeech-XN9r-f-r.js} +1404 -1404
- package/dist/useTheme-B9hvAuzL.js +411 -0
- package/dist/{utils-515nQ17G.js → utils-DtKQl-D3.js} +6184 -6172
- package/dist/{wizard-i86ViMRc.js → wizard-DjD4UNew.js} +3 -3
- package/dist/{workspaceFocus-BV1_9KiH.js → workspaceFocus-MR1plm6A.js} +144 -144
- package/dist/{zap-e0OsRjBR.js → zap-iwsUKtvA.js} +30 -17
- package/package.json +17 -17
- package/dist/mediaSource-zI7JWid4.js +0 -70
- package/dist/query-BxrrBAp6.js +0 -63
- package/dist/useTheme-D2ZM1gvV.js +0 -376
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { nr as e } from "./session-Decc4Fo5.js";
|
|
2
|
+
import { pp as t } from "./utils-DtKQl-D3.js";
|
|
3
|
+
import { cd as n, ff as r, hd as i, kd as a, nf as o, rb as s, wd as ee } from "./keybindings-D0pBlT1k.js";
|
|
4
|
+
import { F as c, H as l, I as u, L as te, T as ne, b as d, c as re, i as f, k as ie, l as ae, n as p, o as m, r as oe, w as se, x as h } from "./themePalette-C-GtwwqV.js";
|
|
5
|
+
import "./errors-D8_Zn8KN.js";
|
|
6
|
+
import { useSyncExternalStore as g } from "react";
|
|
7
|
+
import { c as ce } from "react/compiler-runtime";
|
|
8
|
+
// src/hooks/useTheme.ts
|
|
9
|
+
var _ = "hanzodev:theme", v = "(prefers-color-scheme: dark)", y = {
|
|
10
|
+
theme: "dark",
|
|
11
|
+
resolvedTheme: "dark",
|
|
12
|
+
systemDark: !0,
|
|
13
|
+
followSystem: !1,
|
|
14
|
+
appearanceMode: "dark",
|
|
15
|
+
themeHalves: null
|
|
16
|
+
};
|
|
17
|
+
function le() {
|
|
18
|
+
return b();
|
|
19
|
+
}
|
|
20
|
+
function ue() {
|
|
21
|
+
return typeof window > "u" ? {} : x();
|
|
22
|
+
}
|
|
23
|
+
function b() {
|
|
24
|
+
if (typeof window > "u") return null;
|
|
25
|
+
try {
|
|
26
|
+
return ie(window.localStorage.getItem(f));
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function x() {
|
|
32
|
+
try {
|
|
33
|
+
let e = JSON.parse(window.localStorage.getItem("hanzodev:theme-halves:v1") ?? "null");
|
|
34
|
+
if (typeof e != "object" || !e) return {};
|
|
35
|
+
let t = {};
|
|
36
|
+
for (let n of ["light", "dark"]) {
|
|
37
|
+
let r = e[n];
|
|
38
|
+
typeof r == "string" && (t[n] = r);
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
} catch {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function S(e) {
|
|
46
|
+
return `${e?.light ?? ""}|${e?.dark ?? ""}`;
|
|
47
|
+
}
|
|
48
|
+
var C = "theme-color", de = `meta[name="${C}"][data-dynamic-theme-color="true"]`, w = class extends a()("ThemeStorageError", {
|
|
49
|
+
operation: i(["read", "write"]),
|
|
50
|
+
storageKey: ee,
|
|
51
|
+
theme: r(m),
|
|
52
|
+
cause: n()
|
|
53
|
+
}) {
|
|
54
|
+
get message() {
|
|
55
|
+
return `Failed to ${this.operation} theme preference for ${this.storageKey}.`;
|
|
56
|
+
}
|
|
57
|
+
}, T = o(w), E = class extends a()("DesktopThemeSyncError", {
|
|
58
|
+
theme: m,
|
|
59
|
+
cause: n()
|
|
60
|
+
}) {
|
|
61
|
+
get message() {
|
|
62
|
+
return `Failed to sync the ${this.theme} theme to the desktop shell.`;
|
|
63
|
+
}
|
|
64
|
+
}, fe = o(E), D = [], O = null, k = !0, A = null, j = null, M = null;
|
|
65
|
+
function N() {
|
|
66
|
+
k = !0;
|
|
67
|
+
for (let e of D) e();
|
|
68
|
+
}
|
|
69
|
+
function P() {
|
|
70
|
+
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(v).matches;
|
|
71
|
+
}
|
|
72
|
+
function pe(e) {
|
|
73
|
+
if (typeof window > "u") return e === "system";
|
|
74
|
+
try {
|
|
75
|
+
let e = window.localStorage.getItem(oe);
|
|
76
|
+
if (e === "true") return !0;
|
|
77
|
+
if (e === "false") return !1;
|
|
78
|
+
} catch {}
|
|
79
|
+
return e === "system";
|
|
80
|
+
}
|
|
81
|
+
function me(e) {
|
|
82
|
+
return e === "light" || e === "dark" || e === "system";
|
|
83
|
+
}
|
|
84
|
+
function F(e) {
|
|
85
|
+
if (typeof window < "u") try {
|
|
86
|
+
let e = window.localStorage.getItem(p);
|
|
87
|
+
if (me(e)) return e;
|
|
88
|
+
} catch {}
|
|
89
|
+
return pe(e) ? "system" : d(e) ?? "light";
|
|
90
|
+
}
|
|
91
|
+
function I(e) {
|
|
92
|
+
if (typeof window < "u") try {
|
|
93
|
+
window.localStorage.setItem(p, e);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
throw new w({
|
|
96
|
+
operation: "write",
|
|
97
|
+
storageKey: p,
|
|
98
|
+
cause: e
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function he() {
|
|
103
|
+
if (typeof window > "u" || !e()) return null;
|
|
104
|
+
try {
|
|
105
|
+
let e = window.localStorage.getItem("hanzo.appearance");
|
|
106
|
+
if (e) {
|
|
107
|
+
let t = JSON.parse(e);
|
|
108
|
+
if (t.theme === "light" || t.theme === "dark" || t.theme === "system") return t.theme;
|
|
109
|
+
if (t.profile === "light") return "light";
|
|
110
|
+
if (t.profile === "zen" || t.profile === "clay" || t.profile === "lelouch") return "dark";
|
|
111
|
+
}
|
|
112
|
+
} catch {}
|
|
113
|
+
return typeof document < "u" && (document.documentElement.classList.contains("light") || document.documentElement.classList.contains("t_light")) ? "light" : null;
|
|
114
|
+
}
|
|
115
|
+
function L(t, n) {
|
|
116
|
+
if (typeof window > "u" || typeof document > "u" || !e()) return;
|
|
117
|
+
let r = document.documentElement;
|
|
118
|
+
r.classList.toggle("light", n === "light"), r.classList.toggle("dark", n === "dark"), r.classList.toggle("t_light", n === "light"), r.classList.toggle("t_dark", n === "dark"), r.dataset.theme = n, r.style.colorScheme = n;
|
|
119
|
+
try {
|
|
120
|
+
let e = window.localStorage.getItem("hanzo.appearance"), r = e ? JSON.parse(e) : {}, i = {
|
|
121
|
+
...r,
|
|
122
|
+
theme: t,
|
|
123
|
+
profile: n === "light" ? "light" : r.profile === "clay" ? "clay" : "zen",
|
|
124
|
+
userSelected: !0
|
|
125
|
+
};
|
|
126
|
+
window.localStorage.setItem("hanzo.appearance", JSON.stringify(i)), window.dispatchEvent(new CustomEvent("hanzo:appearance-change", { detail: {
|
|
127
|
+
theme: t,
|
|
128
|
+
profile: i.profile
|
|
129
|
+
} })), window.dispatchEvent(new Event("hanzo:appearance"));
|
|
130
|
+
} catch {}
|
|
131
|
+
}
|
|
132
|
+
function R() {
|
|
133
|
+
if (typeof window > "u") return y.theme;
|
|
134
|
+
let e;
|
|
135
|
+
try {
|
|
136
|
+
e = window.localStorage.getItem(_);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
throw new w({
|
|
139
|
+
operation: "read",
|
|
140
|
+
storageKey: _,
|
|
141
|
+
cause: e
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return e !== null && ne(e) ? ae(e) : he() ?? y.theme;
|
|
145
|
+
}
|
|
146
|
+
function ge(e) {
|
|
147
|
+
if (typeof window < "u") try {
|
|
148
|
+
window.localStorage.setItem(_, e), M = null;
|
|
149
|
+
} catch (t) {
|
|
150
|
+
throw new w({
|
|
151
|
+
operation: "write",
|
|
152
|
+
storageKey: _,
|
|
153
|
+
theme: e,
|
|
154
|
+
cause: t
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function z() {
|
|
159
|
+
if (M !== null) return y.theme;
|
|
160
|
+
try {
|
|
161
|
+
return R();
|
|
162
|
+
} catch (e) {
|
|
163
|
+
let n = T(e) ? e : new w({
|
|
164
|
+
operation: "read",
|
|
165
|
+
storageKey: _,
|
|
166
|
+
cause: e
|
|
167
|
+
});
|
|
168
|
+
return M = n, console.error(n.message, {
|
|
169
|
+
operation: n.operation,
|
|
170
|
+
storageKey: n.storageKey,
|
|
171
|
+
...t(n)
|
|
172
|
+
}), y.theme;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function B() {
|
|
176
|
+
let e = document.querySelector(de);
|
|
177
|
+
return e || (e = document.createElement("meta"), e.name = C, e.setAttribute("data-dynamic-theme-color", "true"), document.head.append(e), e);
|
|
178
|
+
}
|
|
179
|
+
function V(e) {
|
|
180
|
+
let t = e?.trim().toLowerCase();
|
|
181
|
+
return !t || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "rgba(0 0 0 / 0)" ? null : e?.trim() ?? null;
|
|
182
|
+
}
|
|
183
|
+
function _e() {
|
|
184
|
+
return document.querySelector("main[data-slot='sidebar-inset']") ?? document.querySelector("[data-slot='sidebar-inner']") ?? document.body;
|
|
185
|
+
}
|
|
186
|
+
function H() {
|
|
187
|
+
if (typeof document > "u" || typeof getComputedStyle > "u") return;
|
|
188
|
+
let e = getComputedStyle(document.documentElement), t = document.documentElement.dataset.themeId ? V(e.getPropertyValue("--app-chrome-background")) : null, n = V(getComputedStyle(_e()).backgroundColor), r = V(getComputedStyle(document.body).backgroundColor), i = t ?? n ?? r;
|
|
189
|
+
if (!i) return;
|
|
190
|
+
document.documentElement.style.backgroundColor = i, document.body.style.backgroundColor = i;
|
|
191
|
+
let a = document.querySelectorAll(`meta[name="${C}"]`);
|
|
192
|
+
if (a.length === 0) B().setAttribute("content", i);
|
|
193
|
+
else for (let e of a) e.setAttribute("content", i);
|
|
194
|
+
}
|
|
195
|
+
function U(e, { suppressTransitions: t = !1, preservePreview: n = !0 } = {}) {
|
|
196
|
+
if (typeof document > "u" || typeof window > "u" || n && document.documentElement.dataset?.themeId === "__preview") return;
|
|
197
|
+
let r = F(e), i = r === "system", a = i ? P() : !1, o = b();
|
|
198
|
+
if (j?.theme === e && j.systemDark === a && j.followSystem === i && j.appearanceMode === r && S(j.themeHalves) === S(o)) {
|
|
199
|
+
W(e, i, r);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
t && document.documentElement.classList.add("no-transitions");
|
|
203
|
+
let s = u(e, a, i, r, o);
|
|
204
|
+
re(te(e, o, s), s), document.documentElement.classList.toggle("dark", s === "dark"), j = {
|
|
205
|
+
theme: e,
|
|
206
|
+
systemDark: a,
|
|
207
|
+
followSystem: i,
|
|
208
|
+
appearanceMode: r,
|
|
209
|
+
themeHalves: o
|
|
210
|
+
}, H(), W(e, i, r), t && (document.documentElement.offsetHeight, requestAnimationFrame(() => {
|
|
211
|
+
document.documentElement.classList.remove("no-transitions");
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
async function ve(e, t, n, r, i = b()) {
|
|
215
|
+
try {
|
|
216
|
+
await e.setTheme(c(t, n, r, i));
|
|
217
|
+
} catch (e) {
|
|
218
|
+
throw new E({
|
|
219
|
+
theme: t,
|
|
220
|
+
cause: e
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function W(e, n, r) {
|
|
225
|
+
if (typeof window > "u") return;
|
|
226
|
+
let i = window.desktopBridge, a = b(), o = c(e, n, r, a);
|
|
227
|
+
i && typeof i.setTheme == "function" && A !== o && (A = o, ve(i, e, n, r, a).catch((n) => {
|
|
228
|
+
let r = fe(n) ? n : new E({
|
|
229
|
+
theme: e,
|
|
230
|
+
cause: n
|
|
231
|
+
});
|
|
232
|
+
console.error(r.message, {
|
|
233
|
+
theme: r.theme,
|
|
234
|
+
...t(r)
|
|
235
|
+
}), A === o && (A = null);
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
typeof document < "u" && typeof window < "u" && U(z());
|
|
239
|
+
function G() {
|
|
240
|
+
if (typeof window > "u") return y;
|
|
241
|
+
if (!k && O) return O;
|
|
242
|
+
k = !1;
|
|
243
|
+
let e = z(), t = F(e), n = t === "system", r = n ? P() : !1, i = b(), a = u(e, r, n, t, i);
|
|
244
|
+
return O && O.theme === e && O.resolvedTheme === a && O.systemDark === r && O.followSystem === n && O.appearanceMode === t && S(O.themeHalves) === S(i) || (O = {
|
|
245
|
+
theme: e,
|
|
246
|
+
resolvedTheme: a,
|
|
247
|
+
systemDark: r,
|
|
248
|
+
followSystem: n,
|
|
249
|
+
appearanceMode: t,
|
|
250
|
+
themeHalves: i
|
|
251
|
+
}), O;
|
|
252
|
+
}
|
|
253
|
+
function K() {
|
|
254
|
+
return y;
|
|
255
|
+
}
|
|
256
|
+
function q() {
|
|
257
|
+
let e = z();
|
|
258
|
+
F(e) === "system" && U(e, { suppressTransitions: !0 }), N();
|
|
259
|
+
}
|
|
260
|
+
function J(e) {
|
|
261
|
+
e.key === _ ? (M = null, U(z(), { suppressTransitions: !0 }), N()) : e.key === "hanzodev:theme-follow-system" || e.key === "hanzodev:theme-appearance-mode" || e.key === "hanzodev:theme-halves:v1" ? (U(z(), { suppressTransitions: !0 }), N()) : (e.key === "hanzodev:themes:v1" || e.key === null) && (e.key === null && (M = null), se(), j = null, U(z(), { suppressTransitions: !0 }), N());
|
|
262
|
+
}
|
|
263
|
+
var Y = null;
|
|
264
|
+
function X(e) {
|
|
265
|
+
if (typeof window > "u") return () => {};
|
|
266
|
+
if (D.push(e), !Y) {
|
|
267
|
+
let e = typeof window.matchMedia == "function" ? window.matchMedia(v) : null;
|
|
268
|
+
e?.addEventListener("change", q), window.addEventListener("storage", J), Y = () => {
|
|
269
|
+
e?.removeEventListener("change", q), window.removeEventListener("storage", J);
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
return () => {
|
|
273
|
+
D = D.filter((t) => t !== e), D.length === 0 && (Y?.(), Y = null);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function ye() {
|
|
277
|
+
return G();
|
|
278
|
+
}
|
|
279
|
+
function be(e) {
|
|
280
|
+
let t = X(e), n = l(e);
|
|
281
|
+
return () => {
|
|
282
|
+
t(), n();
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function xe() {
|
|
286
|
+
return h() ?? G().resolvedTheme;
|
|
287
|
+
}
|
|
288
|
+
function Se() {
|
|
289
|
+
let { resolvedTheme: e } = g(X, G, K);
|
|
290
|
+
return g(l, h, Ce) ?? e;
|
|
291
|
+
}
|
|
292
|
+
function Ce() {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
function Z(e) {
|
|
296
|
+
if (typeof window > "u") return !1;
|
|
297
|
+
try {
|
|
298
|
+
s(z(), F, I);
|
|
299
|
+
let t = window.localStorage.getItem(f);
|
|
300
|
+
window.localStorage.removeItem(f);
|
|
301
|
+
try {
|
|
302
|
+
ge(e);
|
|
303
|
+
} catch (e) {
|
|
304
|
+
if (t !== null) try {
|
|
305
|
+
window.localStorage.setItem(f, t);
|
|
306
|
+
} catch {}
|
|
307
|
+
throw e;
|
|
308
|
+
}
|
|
309
|
+
} catch (n) {
|
|
310
|
+
let r = T(n) ? n : new w({
|
|
311
|
+
operation: "write",
|
|
312
|
+
storageKey: _,
|
|
313
|
+
theme: e,
|
|
314
|
+
cause: n
|
|
315
|
+
});
|
|
316
|
+
return console.error(r.message, {
|
|
317
|
+
operation: r.operation,
|
|
318
|
+
storageKey: r.storageKey,
|
|
319
|
+
theme: e,
|
|
320
|
+
...t(r)
|
|
321
|
+
}), !1;
|
|
322
|
+
}
|
|
323
|
+
U(e, { suppressTransitions: !0 });
|
|
324
|
+
let n = F(e);
|
|
325
|
+
return L(n, u(e, n === "system" && P(), n === "system", n, b())), N(), !0;
|
|
326
|
+
}
|
|
327
|
+
function Q(e) {
|
|
328
|
+
if (typeof window > "u") return !1;
|
|
329
|
+
try {
|
|
330
|
+
I(e);
|
|
331
|
+
} catch (e) {
|
|
332
|
+
let n = T(e) ? e : new w({
|
|
333
|
+
operation: "write",
|
|
334
|
+
storageKey: p,
|
|
335
|
+
cause: e
|
|
336
|
+
});
|
|
337
|
+
return console.error(n.message, {
|
|
338
|
+
operation: n.operation,
|
|
339
|
+
storageKey: n.storageKey,
|
|
340
|
+
...t(n)
|
|
341
|
+
}), !1;
|
|
342
|
+
}
|
|
343
|
+
M = null;
|
|
344
|
+
let n = z();
|
|
345
|
+
return U(n, { suppressTransitions: !0 }), L(e, u(n, e === "system" && P(), e === "system", e, b())), N(), !0;
|
|
346
|
+
}
|
|
347
|
+
function we(e, n) {
|
|
348
|
+
if (typeof window > "u") return !1;
|
|
349
|
+
try {
|
|
350
|
+
let t = { ...x() };
|
|
351
|
+
n === null ? delete t[e] : t[e] = n, t.light === void 0 && t.dark === void 0 ? window.localStorage.removeItem(f) : window.localStorage.setItem(f, JSON.stringify(t));
|
|
352
|
+
} catch (e) {
|
|
353
|
+
let n = new w({
|
|
354
|
+
operation: "write",
|
|
355
|
+
storageKey: f,
|
|
356
|
+
cause: e
|
|
357
|
+
});
|
|
358
|
+
return console.error(n.message, {
|
|
359
|
+
operation: n.operation,
|
|
360
|
+
storageKey: n.storageKey,
|
|
361
|
+
...t(n)
|
|
362
|
+
}), !1;
|
|
363
|
+
}
|
|
364
|
+
return U(z(), { suppressTransitions: !0 }), N(), !0;
|
|
365
|
+
}
|
|
366
|
+
function Te() {
|
|
367
|
+
if (typeof window > "u") return !1;
|
|
368
|
+
try {
|
|
369
|
+
window.localStorage.removeItem(f);
|
|
370
|
+
} catch (e) {
|
|
371
|
+
let n = new w({
|
|
372
|
+
operation: "write",
|
|
373
|
+
storageKey: f,
|
|
374
|
+
cause: e
|
|
375
|
+
});
|
|
376
|
+
return console.error(n.message, {
|
|
377
|
+
operation: n.operation,
|
|
378
|
+
storageKey: n.storageKey,
|
|
379
|
+
...t(n)
|
|
380
|
+
}), !1;
|
|
381
|
+
}
|
|
382
|
+
return U(z(), { suppressTransitions: !0 }), N(), !0;
|
|
383
|
+
}
|
|
384
|
+
function $({ preservePreview: e = !1 } = {}) {
|
|
385
|
+
typeof window < "u" && (j = null, U(z(), {
|
|
386
|
+
suppressTransitions: !0,
|
|
387
|
+
preservePreview: e
|
|
388
|
+
}), N());
|
|
389
|
+
}
|
|
390
|
+
function Ee() {
|
|
391
|
+
let e = ce(9), t = g(X, G, K), { theme: n, resolvedTheme: r } = t, i;
|
|
392
|
+
e[0] === n ? i = e[1] : (i = (e) => {
|
|
393
|
+
let t = F(n);
|
|
394
|
+
return Q(e ? "system" : t === "system" ? d(n) ?? "light" : t);
|
|
395
|
+
}, e[0] = n, e[1] = i);
|
|
396
|
+
let a = i, o;
|
|
397
|
+
return e[2] !== r || e[3] !== a || e[4] !== t.appearanceMode || e[5] !== t.followSystem || e[6] !== t.themeHalves || e[7] !== n ? (o = {
|
|
398
|
+
theme: n,
|
|
399
|
+
setTheme: Z,
|
|
400
|
+
setAppearanceMode: Q,
|
|
401
|
+
setFollowSystem: a,
|
|
402
|
+
setThemeHalf: we,
|
|
403
|
+
clearThemeHalves: Te,
|
|
404
|
+
refreshTheme: $,
|
|
405
|
+
followSystem: t.followSystem,
|
|
406
|
+
appearanceMode: t.appearanceMode,
|
|
407
|
+
resolvedTheme: r,
|
|
408
|
+
themeHalves: t.themeHalves
|
|
409
|
+
}, e[2] = r, e[3] = a, e[4] = t.appearanceMode, e[5] = t.followSystem, e[6] = t.themeHalves, e[7] = n, e[8] = o) : o = e[8], o;
|
|
410
|
+
}
|
|
411
|
+
export { ue as a, Q as c, H as d, Se as f, le as i, Z as l, ye as n, R as o, Ee as p, F as r, $ as s, xe as t, be as u };
|