@commentkit/comment-kit 1.6.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +281 -597
- package/README.md +334 -154
- package/SECURITY.md +47 -46
- package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
- package/dist/node/browser.js +17 -0
- package/dist/node/cli/api.js +226 -0
- package/dist/node/cli/bin.js +18 -0
- package/dist/node/cli/credentials.js +268 -0
- package/dist/node/cli/doctor.js +725 -0
- package/dist/node/cli/format.js +54 -0
- package/dist/node/cli/init.js +372 -0
- package/dist/node/cli/main.js +519 -0
- package/dist/node/cli/mcp.js +114 -0
- package/dist/node/cli/open.js +20 -0
- package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
- package/dist/node/plugins/astro.js +26 -0
- package/dist/node/plugins/git-BIXLbL3f.js +92 -0
- package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
- package/dist/node/plugins/next.js +48 -0
- package/dist/node/plugins/options-THop1K92.js +71 -0
- package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
- package/dist/node/plugins/vite-BdAYUW10.js +74 -0
- package/dist/node/plugins/vite.js +1 -0
- package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
- package/dist/node/plugins/webpack-loader.cjs +21 -0
- package/dist/node/plugins/webpack-loader.js +18 -0
- package/dist/node/plugins/webpack.js +1 -0
- package/dist/node/shared/endpoint.js +26 -0
- package/dist/node/shared/format.js +63 -0
- package/dist/node/types/astro.d.ts +11 -0
- package/dist/node/types/next.d.ts +34 -0
- package/dist/node/types/options.d.ts +59 -0
- package/dist/node/types/vite.d.ts +11 -0
- package/dist/node/types/webpack-loader.d.ts +22 -0
- package/dist/node/types/webpack.d.ts +27 -0
- package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
- package/dist/npm/chunks/AgentSend-DxRJIYiz.js +68 -0
- package/dist/npm/chunks/Checklist-CnlfeSbc.js +282 -0
- package/dist/npm/chunks/Composer-B1bBVszY.js +725 -0
- package/dist/npm/chunks/Guest-vvNPz8h-.js +267 -0
- package/dist/npm/chunks/MarkupEditor-VCOXh9d2.js +338 -0
- package/dist/npm/chunks/Panel-F37vIL1K.js +1206 -0
- package/dist/npm/chunks/Settings-BGoZS2iV.js +231 -0
- package/dist/npm/chunks/Shortcuts-B2OMvczr.js +62 -0
- package/dist/npm/chunks/StyleEditor-CJ_d8Huf.js +46 -0
- package/dist/npm/chunks/StylePanel-yQzHHlY7.js +199 -0
- package/dist/npm/chunks/TaskFields-fmy6_HtK.js +289 -0
- package/dist/npm/chunks/ThreadCard-D51slKST.js +1113 -0
- package/dist/npm/chunks/Viewer-BOBadqmC.js +111 -0
- package/dist/npm/chunks/{agent-BDMQtOzH.js → agent-C1OQzBAm.js} +9 -9
- package/dist/npm/chunks/{anchor-BsradQhn.js → anchor-BsQNVkHj.js} +108 -85
- package/dist/npm/chunks/{ar-8tPch6W4.js → ar-CAJ3XT8e.js} +69 -19
- package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
- package/dist/npm/chunks/{client-EFTWxHbJ.js → client-kNAo2TTG.js} +282 -290
- package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
- package/dist/npm/chunks/context-B8UAzve0.js +20 -0
- package/dist/npm/chunks/context-BuMl7A07.js +48 -0
- package/dist/npm/chunks/{de-C63897uD.js → de-Dl18G48t.js} +60 -18
- package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
- package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
- package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
- package/dist/npm/chunks/{es-CI2bSpvB.js → es-Dxk79lS9.js} +60 -18
- package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
- package/dist/npm/chunks/{extension-BST6LH1q.js → extension-E81hWyiT.js} +20 -12
- package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
- package/dist/npm/chunks/{fr-rsVe-Lqk.js → fr-8BebGKYD.js} +118 -76
- package/dist/npm/chunks/{hi-cvwbSaWP.js → hi-BIN6Yy_p.js} +61 -19
- package/dist/npm/chunks/{i18n-C4v0M-6z.js → i18n-DOBt8e9U.js} +91 -56
- package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
- package/dist/npm/chunks/{it-C8tnV0BF.js → it-Cr6EwpPQ.js} +79 -37
- package/dist/npm/chunks/{ja-BWxDfC2f.js → ja-Iy3s5aur.js} +58 -16
- package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
- package/dist/npm/chunks/live-CelVeZfP.js +85 -0
- package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
- package/dist/npm/chunks/{nl-DNQ6eCht.js → nl-B84WHqqe.js} +61 -19
- package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
- package/dist/npm/chunks/{pick-CLyOdjnD.js → pick-yTyqtxN0.js} +45 -44
- package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
- package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
- package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
- package/dist/npm/chunks/{pt-BR-CkG7vpU2.js → pt-BR-DOkdlfoe.js} +60 -18
- package/dist/npm/chunks/{realtime-DIo-Wth4.js → realtime-C79zF50C.js} +14 -12
- package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
- package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
- package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
- package/dist/npm/chunks/{source-CS7C6wJA.js → source-pXVve2Cx.js} +1 -1
- package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
- package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
- package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
- package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
- package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
- package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
- package/dist/npm/chunks/{zh-CN-BKuZOLBE.js → zh-CN-Z5fQCb7G.js} +59 -17
- package/dist/npm/element.js +58 -21
- package/dist/npm/headless.js +7 -3
- package/dist/npm/index.js +3 -3
- package/dist/npm/react.js +18 -11
- package/dist/npm/svelte.js +28 -12
- package/dist/npm/types/adapters/react.d.ts +4 -1
- package/dist/npm/types/adapters/svelte.d.ts +4 -1
- package/dist/npm/types/adapters/vue.d.ts +35 -2
- package/dist/npm/types/anchor/index.d.ts +19 -0
- package/dist/npm/types/capture/privacy.d.ts +14 -0
- package/dist/npm/types/core/api.d.ts +20 -1
- package/dist/npm/types/core/auth.d.ts +40 -21
- package/dist/npm/types/core/client.d.ts +60 -4
- package/dist/npm/types/core/page-key.d.ts +42 -0
- package/dist/npm/types/core/types.d.ts +87 -4
- package/dist/npm/types/element.d.ts +17 -7
- package/dist/npm/types/headless.d.ts +2 -1
- package/dist/npm/types/index.d.ts +16 -6
- package/dist/npm/vue.js +44 -9
- package/package.json +88 -14
- package/dist/npm/chunks/AgentSend-2JPDseOo.js +0 -63
- package/dist/npm/chunks/Checklist-BpDXQebo.js +0 -257
- package/dist/npm/chunks/Composer-CAyj-c8e.js +0 -677
- package/dist/npm/chunks/Guest-ZdFmTcXI.js +0 -187
- package/dist/npm/chunks/MarkupEditor-BFplZwFy.js +0 -332
- package/dist/npm/chunks/Panel-BhZ4XRDR.js +0 -861
- package/dist/npm/chunks/Settings-SPG9EHUZ.js +0 -204
- package/dist/npm/chunks/Shortcuts-C28HVDw6.js +0 -58
- package/dist/npm/chunks/StyleEditor-ByZMtq10.js +0 -43
- package/dist/npm/chunks/StylePanel-Iwhce2tE.js +0 -197
- package/dist/npm/chunks/TaskFields-BsP_fVJg.js +0 -273
- package/dist/npm/chunks/ThreadCard-BzVZdDCb.js +0 -1030
- package/dist/npm/chunks/Viewer-CqtGrdD8.js +0 -108
- package/dist/npm/chunks/card-bits-Bna-g3Py.js +0 -124
- package/dist/npm/chunks/confetti-DTKpwF3O.js +0 -40
- package/dist/npm/chunks/drafts-akdBsOd0.js +0 -50
- package/dist/npm/chunks/extension-D-V3utTm.js +0 -53
- package/dist/npm/chunks/live-BCpJVBeN.js +0 -33
- package/dist/npm/chunks/report-BBrT3r89.js +0 -27
- package/dist/npm/chunks/src-C4FsVoUp.js +0 -148
- package/dist/npm/chunks/start-i9M-r3aH.js +0 -1800
- package/dist/npm/chunks/upload-DSv7EyBD.js +0 -41
- package/dist/npm/chunks/uploads-I01kdqQF.js +0 -1103
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { b as e, o as t, v as n } from "./client-kNAo2TTG.js";
|
|
2
|
+
import { c as r, d as i, f as a, g as o, n as s, p as c, u as l } from "./i18n-DOBt8e9U.js";
|
|
3
|
+
import { r as u } from "./card-bits-CAnzrqx3.js";
|
|
4
|
+
import { C as d, f, s as p } from "./start-DtVlpt7p.js";
|
|
5
|
+
// src/ui/Guest.tsx
|
|
6
|
+
p(".ck-verify-text{text-wrap:pretty;overflow-wrap:anywhere;margin:0 0 12px;line-height:1.5}.ck-verify .ck-code{height:48px;font-family:var(--ck-mono);font-size:var(--ck-fs-xl);letter-spacing:.32em;text-align:center;font-variant-numeric:tabular-nums;padding-inline-start:calc(12px + .32em);padding-inline-end:12px}.ck-verify .ck-actions .ck-chip{font-variant-numeric:tabular-nums}.ck-verify .ck-chip:disabled{opacity:.5;cursor:default}.ck-verify .ck-note{margin:12px 0 0}@media (hover:hover){.ck-verify .ck-chip:disabled:hover{background:var(--ck-bg);color:var(--ck-text-muted)}}@media (pointer:coarse){.ck-verify .ck-chip{min-height:44px}}");
|
|
7
|
+
async function m(e, i) {
|
|
8
|
+
try {
|
|
9
|
+
let n = await e.api.request("/guest/start", {
|
|
10
|
+
method: "POST",
|
|
11
|
+
anonymous: !0,
|
|
12
|
+
proof: !0,
|
|
13
|
+
body: {
|
|
14
|
+
client_id: e.options.project,
|
|
15
|
+
share: i.share,
|
|
16
|
+
name: i.name.trim(),
|
|
17
|
+
email: i.email.trim(),
|
|
18
|
+
locale: s(),
|
|
19
|
+
page_url: t()
|
|
20
|
+
}
|
|
21
|
+
}), r = Date.parse(n.pending_session.expires_at);
|
|
22
|
+
return e.auth.setPending({
|
|
23
|
+
token: n.access_token,
|
|
24
|
+
email: n.pending_session.email,
|
|
25
|
+
expiresAt: Number.isFinite(r) ? r : Date.now() + n.expires_in * 1e3
|
|
26
|
+
}), "started";
|
|
27
|
+
} catch (e) {
|
|
28
|
+
if (e instanceof n && e.code === "origin_not_allowed") return "popup";
|
|
29
|
+
throw e instanceof n && (e.code === "share_expired" || e.status === 410 || e.errors?.share) ? new n(410, "share_expired", r("shareExpired")) : e;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function h() {
|
|
33
|
+
let e;
|
|
34
|
+
try {
|
|
35
|
+
e = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
36
|
+
} catch {
|
|
37
|
+
e = void 0;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...e && e.length <= 64 ? { timezone: e } : {},
|
|
41
|
+
locale: s()
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function g({ client: t, email: s, onDone: p, onDifferentEmail: m, onClose: g }) {
|
|
45
|
+
let [y, b] = o(""), [x, S] = o(!1), [C, w] = o(null), [T, E] = o(null), D = c(null);
|
|
46
|
+
a(() => D.current?.focus({ preventScroll: !0 }), []);
|
|
47
|
+
let O = c({}), [k, A] = o(_);
|
|
48
|
+
i(() => {
|
|
49
|
+
if (k <= 0) return;
|
|
50
|
+
let e = setTimeout(() => A((e) => e - 1), 1e3);
|
|
51
|
+
return () => clearTimeout(e);
|
|
52
|
+
}, [k]);
|
|
53
|
+
let j = async (i = y) => {
|
|
54
|
+
if (/^\d{6}$/.test(i) && !x) {
|
|
55
|
+
S(!0), w(null);
|
|
56
|
+
try {
|
|
57
|
+
var a;
|
|
58
|
+
let n = {
|
|
59
|
+
code: i,
|
|
60
|
+
...h()
|
|
61
|
+
}, r = await t.api.request("/guest/verify", {
|
|
62
|
+
method: "POST",
|
|
63
|
+
body: n,
|
|
64
|
+
idempotencyKey: (a = O.current)[i] ?? (a[i] = e(16))
|
|
65
|
+
});
|
|
66
|
+
t.auth.adopt(r), await t.loadSession().catch(() => null), p(r.published_thread_ids ?? []);
|
|
67
|
+
} catch (e) {
|
|
68
|
+
if ((e instanceof n ? e.status : 0) === 422) return b(""), D.current?.focus({ preventScroll: !0 }), w({
|
|
69
|
+
text: r("verifyWrong"),
|
|
70
|
+
tone: "warning"
|
|
71
|
+
});
|
|
72
|
+
let i = v(e);
|
|
73
|
+
i && (t.auth.setPending(null), E(i === "expired" ? "again" : "stop")), w({
|
|
74
|
+
text: i ? r(i === "link" ? "verifyLinkExpired" : i === "removed" ? "verifyRemoved" : "verifyExpired") : f(e),
|
|
75
|
+
tone: "warning"
|
|
76
|
+
});
|
|
77
|
+
} finally {
|
|
78
|
+
S(!1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, M = async () => {
|
|
82
|
+
let i = { "Idempotency-Key": e(16) }, a = () => t.api.request("/guest/resend", {
|
|
83
|
+
method: "POST",
|
|
84
|
+
headers: i
|
|
85
|
+
});
|
|
86
|
+
try {
|
|
87
|
+
await a().catch((e) => {
|
|
88
|
+
if (e instanceof n && e.status === 0) return a();
|
|
89
|
+
throw e;
|
|
90
|
+
}), w({ text: r("verifyResent") }), A(_);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
let t = e instanceof n && e.code === "guest_codes_paused";
|
|
93
|
+
w({
|
|
94
|
+
text: t ? r("guestCodesPaused") : e instanceof n && e.status === 429 ? r("verifyWait") : r("errorGeneric"),
|
|
95
|
+
tone: "warning"
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
return /* @__PURE__ */ l("div", {
|
|
100
|
+
class: "ck-card ck-verify",
|
|
101
|
+
style: u({
|
|
102
|
+
x: innerWidth / 2 - 190,
|
|
103
|
+
y: 80
|
|
104
|
+
}),
|
|
105
|
+
role: "region",
|
|
106
|
+
"aria-labelledby": "ck-verify-title",
|
|
107
|
+
"data-commentkit-ui": !0,
|
|
108
|
+
onKeyDown: (e) => e.key === "Escape" && g(!0),
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ l("div", {
|
|
111
|
+
class: "ck-card-head",
|
|
112
|
+
children: [/* @__PURE__ */ l("h2", {
|
|
113
|
+
class: "ck-card-title",
|
|
114
|
+
id: "ck-verify-title",
|
|
115
|
+
children: r("verifyTitle")
|
|
116
|
+
}), /* @__PURE__ */ l("button", {
|
|
117
|
+
class: "ck-ghost",
|
|
118
|
+
"aria-label": r("close"),
|
|
119
|
+
title: r("close"),
|
|
120
|
+
onClick: () => g(),
|
|
121
|
+
children: /* @__PURE__ */ l(d, { name: "close" })
|
|
122
|
+
})]
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ l("div", {
|
|
125
|
+
class: "ck-card-body",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ l("p", {
|
|
128
|
+
class: "ck-verify-text",
|
|
129
|
+
children: r("verifyBody", { email: s })
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ l("p", {
|
|
132
|
+
class: "ck-verify-text",
|
|
133
|
+
children: r("verifyLookFor", { website: t.state.get().config?.project?.name ?? "" })
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ l("label", {
|
|
136
|
+
class: "ck-field",
|
|
137
|
+
children: [/* @__PURE__ */ l("span", { children: r("verifyCode") }), /* @__PURE__ */ l("input", {
|
|
138
|
+
ref: D,
|
|
139
|
+
class: "ck-input ck-code",
|
|
140
|
+
"aria-invalid": C?.tone === "warning" || void 0,
|
|
141
|
+
"aria-describedby": C ? "ck-verify-note" : void 0,
|
|
142
|
+
inputMode: "numeric",
|
|
143
|
+
autoComplete: "one-time-code",
|
|
144
|
+
pattern: "[0-9]*",
|
|
145
|
+
maxLength: 6,
|
|
146
|
+
value: y,
|
|
147
|
+
onInput: (e) => {
|
|
148
|
+
let t = e.target.value.replace(/\D/g, "").slice(0, 6);
|
|
149
|
+
b(t), C?.tone && w(null), t.length === 6 && t !== y && j(t);
|
|
150
|
+
},
|
|
151
|
+
onKeyDown: (e) => {
|
|
152
|
+
e.stopPropagation(), e.key === "Enter" && j(), e.key === "Escape" && g(!0);
|
|
153
|
+
}
|
|
154
|
+
})]
|
|
155
|
+
}),
|
|
156
|
+
C ? /* @__PURE__ */ l("div", {
|
|
157
|
+
class: "ck-note",
|
|
158
|
+
id: "ck-verify-note",
|
|
159
|
+
role: C.tone ? "alert" : "status",
|
|
160
|
+
"data-tone": C.tone,
|
|
161
|
+
children: C.text
|
|
162
|
+
}) : null,
|
|
163
|
+
T ? null : /* @__PURE__ */ l("div", {
|
|
164
|
+
class: "ck-actions",
|
|
165
|
+
children: [/* @__PURE__ */ l("button", {
|
|
166
|
+
class: "ck-chip",
|
|
167
|
+
"aria-disabled": k > 0 || void 0,
|
|
168
|
+
onClick: () => k > 0 || void M(),
|
|
169
|
+
children: k > 0 ? r("verifyResendIn", { n: k }) : r("verifyResend")
|
|
170
|
+
}), /* @__PURE__ */ l("button", {
|
|
171
|
+
class: "ck-chip",
|
|
172
|
+
onClick: () => {
|
|
173
|
+
t.auth.setPending(null), m();
|
|
174
|
+
},
|
|
175
|
+
children: r("verifyDifferent")
|
|
176
|
+
})]
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}),
|
|
180
|
+
/* @__PURE__ */ l("div", {
|
|
181
|
+
class: "ck-card-foot",
|
|
182
|
+
children: [/* @__PURE__ */ l("span", { class: "ck-spacer" }), T === "again" ? /* @__PURE__ */ l("button", {
|
|
183
|
+
class: "ck-btn ck-primary",
|
|
184
|
+
onClick: m,
|
|
185
|
+
children: r("writeAgain")
|
|
186
|
+
}) : T === "stop" ? /* @__PURE__ */ l("button", {
|
|
187
|
+
class: "ck-btn",
|
|
188
|
+
onClick: () => g(),
|
|
189
|
+
children: r("close")
|
|
190
|
+
}) : /* @__PURE__ */ l("button", {
|
|
191
|
+
class: "ck-btn ck-primary",
|
|
192
|
+
"aria-disabled": x || y.length !== 6 || void 0,
|
|
193
|
+
"aria-busy": x || void 0,
|
|
194
|
+
onClick: () => void j(),
|
|
195
|
+
children: r(x ? "sending" : "verifyPublish")
|
|
196
|
+
})]
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
var _ = 60;
|
|
202
|
+
function v(e) {
|
|
203
|
+
return e instanceof n ? e.code === "share_expired" || e.status === 410 ? "link" : e.code === "guest_removed" ? "removed" : e.status === 403 ? /\blink\b/i.test(e.message) ? "link" : "removed" : e.status === 409 || e.status === 401 ? "expired" : null : null;
|
|
204
|
+
}
|
|
205
|
+
function y({ client: e, position: t, notify: i, onOpen: a }) {
|
|
206
|
+
let [s, c] = o(e.auth.finishLink), [u, d] = o(!1), [p, m] = o(null);
|
|
207
|
+
if (!s) return null;
|
|
208
|
+
let g = () => {
|
|
209
|
+
e.auth.finishLink = null, c(null);
|
|
210
|
+
}, _ = async () => {
|
|
211
|
+
if (!u) {
|
|
212
|
+
d(!0);
|
|
213
|
+
try {
|
|
214
|
+
let t = await e.api.request("/guest/finish", {
|
|
215
|
+
method: "POST",
|
|
216
|
+
anonymous: !0,
|
|
217
|
+
proof: !0,
|
|
218
|
+
body: {
|
|
219
|
+
client_id: e.options.project,
|
|
220
|
+
link: s,
|
|
221
|
+
...h()
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
g(), e.auth.adopt(t), await e.loadSession().catch(() => null), i({
|
|
225
|
+
text: r("sentGuest"),
|
|
226
|
+
tone: "success"
|
|
227
|
+
}), t.published_thread_ids?.[0] && a(t.published_thread_ids[0]);
|
|
228
|
+
} catch (t) {
|
|
229
|
+
let i = t instanceof n ? t.code : "";
|
|
230
|
+
[
|
|
231
|
+
402,
|
|
232
|
+
403,
|
|
233
|
+
410,
|
|
234
|
+
422
|
|
235
|
+
].includes(t instanceof n ? t.status : 0) && (e.auth.finishLink = null), m(i === "finish_link_expired" ? r("finishExpired") : f(t)), d(!1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
return /* @__PURE__ */ l("div", {
|
|
240
|
+
class: "ck-welcome",
|
|
241
|
+
"data-pos": t,
|
|
242
|
+
role: "region",
|
|
243
|
+
"aria-labelledby": "ck-finish-title",
|
|
244
|
+
"data-commentkit-ui": !0,
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ l("h2", {
|
|
247
|
+
id: "ck-finish-title",
|
|
248
|
+
children: r("finishTitle")
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ l("p", { children: p ?? r("finishBody") }),
|
|
251
|
+
/* @__PURE__ */ l("div", {
|
|
252
|
+
class: "ck-actions",
|
|
253
|
+
children: p && !e.auth.finishLink ? /* @__PURE__ */ l("button", {
|
|
254
|
+
class: "ck-btn",
|
|
255
|
+
onClick: g,
|
|
256
|
+
children: r("close")
|
|
257
|
+
}) : /* @__PURE__ */ l("button", {
|
|
258
|
+
class: "ck-btn ck-primary",
|
|
259
|
+
"aria-busy": u || void 0,
|
|
260
|
+
onClick: () => void _(),
|
|
261
|
+
children: r(u ? "sending" : "finishSend")
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
export { y as GuestFinish, g as GuestVerify, m as startGuest };
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { c as e, d as t, f as n, g as r, p as i, u as a } from "./i18n-DOBt8e9U.js";
|
|
2
|
+
import { O as o, m as s, s as c } from "./start-DtVlpt7p.js";
|
|
3
|
+
// src/ui/MarkupEditor.tsx
|
|
4
|
+
c(".ck-markup{z-index:calc(var(--ck-z) + 2);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);background:#0a0a0c4d;flex-direction:column;justify-content:center;align-items:center;gap:12px;padding:16px;display:flex;position:fixed;top:0;bottom:0;left:0;right:0}.ck-markup canvas{border-radius:var(--ck-radius-md);cursor:crosshair;touch-action:none;background:#fff;max-width:min(100%,1100px);max-height:calc(100dvh - 110px);box-shadow:0 0 0 1px #0000000d,0 20px 50px #00000040}.ck-label-box .ck-input{width:200px;font-weight:600}.ck-markup .ck-markup-tools{background:var(--ck-bg);border-radius:var(--ck-radius-pill);max-width:100%;box-shadow:var(--ck-shadow);border:1px solid #0000;flex-wrap:wrap;justify-content:center;align-items:center;gap:4px;padding:4px;display:flex}.ck-markup .ck-markup-group{align-items:center;gap:4px;padding:0 4px;display:flex}.ck-markup .ck-markup-group+.ck-markup-group{border-inline-start:1px solid var(--ck-hairline);margin-inline-start:4px;padding-inline-start:8px}.ck-markup .ck-tool{border-radius:var(--ck-radius-pill);width:32px;height:32px;color:var(--ck-text-muted);transition:background-color var(--ck-fast), color var(--ck-fast), scale var(--ck-fast) ease-out;background:0 0;border:0;place-items:center;padding:0;display:grid}.ck-markup .ck-tool[aria-pressed=true]{background:var(--ck-accent-soft);color:var(--ck-accent-text)}.ck-markup .ck-tool:active,.ck-markup .ck-icon-btn:active:not([aria-disabled=true]){scale:.96}.ck-markup .ck-dot{width:16px;height:16px;box-shadow:inset 0 0 0 1px var(--ck-hairline);border-radius:50%;display:block}.ck-markup .ck-tool[aria-pressed=true] .ck-dot{box-shadow:0 0 0 2px var(--ck-bg), 0 0 0 4px currentColor}.ck-markup .ck-width{gap:8px;width:152px}.ck-markup .ck-width input{min-width:0;accent-color:var(--ck-accent-text);cursor:pointer;flex:1}.ck-markup .ck-width span{width:32px;font-size:var(--ck-fs-sm);color:var(--ck-text-muted);font-variant-numeric:tabular-nums;text-align:end;flex:none}.ck-markup .ck-btn-group{display:inline-flex}.ck-markup .ck-icon-btn{border:1px solid var(--ck-border);background:var(--ck-bg);width:32px;height:32px;color:var(--ck-text);transition:background-color var(--ck-fast), scale var(--ck-fast) ease-out;place-items:center;padding:0;display:grid}.ck-markup .ck-icon-btn+.ck-icon-btn{margin-inline-start:-1px}.ck-markup .ck-icon-btn:first-child:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--ck-radius-sm);border-bottom-left-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:first-child:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--ck-radius-sm);border-bottom-left-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:first-child:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ck-radius-sm);border-bottom-right-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:first-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--ck-radius-sm);border-bottom-right-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:last-child:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--ck-radius-sm);border-bottom-right-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:last-child:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--ck-radius-sm);border-bottom-right-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:last-child:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ck-radius-sm);border-bottom-left-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:last-child:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--ck-radius-sm);border-bottom-left-radius:var(--ck-radius-sm)}.ck-markup .ck-icon-btn:focus-visible{z-index:1;position:relative}.ck-markup .ck-icon-btn[aria-disabled=true]{opacity:.5;cursor:default}.ck-markup .ck-icon-btn.ck-primary{border-color:var(--ck-accent);background:var(--ck-accent);color:var(--ck-accent-ink);position:relative}.ck-markup .ck-label-box{z-index:1;border-radius:var(--ck-radius-md);background:var(--ck-bg);box-shadow:var(--ck-shadow);border:1px solid #0000;align-items:center;gap:4px;padding:4px;display:flex;position:fixed}.ck-markup .ck-label-box .ck-input{border-radius:var(--ck-radius-xs);height:32px}.ck-markup .ck-label-box .ck-chip{flex:none;height:32px}@media (hover:hover){.ck-markup .ck-icon-btn:hover:not([aria-disabled=true]):not(.ck-primary){background:var(--ck-bg-hover)}.ck-markup .ck-tool:hover{background:var(--ck-bg-hover);color:var(--ck-text)}}@media (forced-colors:active){.ck-markup .ck-tool[aria-pressed=true]{color:highlighttext;background:highlight}}@media (pointer:coarse){.ck-markup .ck-tool,.ck-markup .ck-icon-btn{width:44px;height:44px}}@media (max-width:520px){.ck-markup .ck-markup-tools{border-radius:var(--ck-radius)}}");
|
|
5
|
+
var l = /* @__PURE__ */ new WeakSet(), u = [
|
|
6
|
+
"pen",
|
|
7
|
+
"line",
|
|
8
|
+
"rect",
|
|
9
|
+
"ellipse",
|
|
10
|
+
"arrow",
|
|
11
|
+
"blur",
|
|
12
|
+
"text"
|
|
13
|
+
], d = [
|
|
14
|
+
"#ef4444",
|
|
15
|
+
"#f97316",
|
|
16
|
+
"#eab308",
|
|
17
|
+
"#22c55e",
|
|
18
|
+
"#3b82f6",
|
|
19
|
+
"#8b5cf6",
|
|
20
|
+
"#ec4899"
|
|
21
|
+
], f = [
|
|
22
|
+
"color_red",
|
|
23
|
+
"color_orange",
|
|
24
|
+
"color_yellow",
|
|
25
|
+
"color_green",
|
|
26
|
+
"color_blue",
|
|
27
|
+
"color_purple",
|
|
28
|
+
"color_pink"
|
|
29
|
+
], p = {
|
|
30
|
+
arrow: "M5 19L19 5M10 5h9v9",
|
|
31
|
+
line: "M5 19L19 5",
|
|
32
|
+
rect: "M5 6h14v12H5z",
|
|
33
|
+
ellipse: "M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16z",
|
|
34
|
+
pen: "M4 20l4-1 11-11-3-3L5 16z",
|
|
35
|
+
blur: "M4 4h4v4H4zM10 4h4v4h-4zM16 4h4v4h-4zM4 10h4v4H4zM16 10h4v4h-4zM4 16h4v4H4zM10 16h4v4h-4zM16 16h4v4h-4zM10 10h4v4h-4z",
|
|
36
|
+
text: "M5 6V5h14v1M12 5v14M9 19h6"
|
|
37
|
+
}, m = {
|
|
38
|
+
undo: "M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3",
|
|
39
|
+
redo: "M15 14l5-5-5-5M20 9H10a6 6 0 0 0 0 12h3",
|
|
40
|
+
clear: "M5 7h14M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3",
|
|
41
|
+
cancel: "M6 6l12 12M18 6L6 18",
|
|
42
|
+
save: "M5 12l5 5L20 7"
|
|
43
|
+
};
|
|
44
|
+
function h({ d: e }) {
|
|
45
|
+
return /* @__PURE__ */ a("svg", {
|
|
46
|
+
width: "16",
|
|
47
|
+
height: "16",
|
|
48
|
+
viewBox: "0 0 24 24",
|
|
49
|
+
fill: "none",
|
|
50
|
+
stroke: "currentColor",
|
|
51
|
+
"stroke-width": "2",
|
|
52
|
+
"stroke-linecap": "round",
|
|
53
|
+
"stroke-linejoin": "round",
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
children: /* @__PURE__ */ a("path", { d: e })
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function g({ image: s, onDone: c, onCancel: g }) {
|
|
59
|
+
let b = i(null), [x, S] = r(null), [C, w] = r("pen"), [T, E] = r(d[0]), [D, O] = r(3), [k, A] = r({
|
|
60
|
+
steps: [[]],
|
|
61
|
+
at: 0
|
|
62
|
+
}), j = k.steps[k.at], M = (e) => A((t) => ({
|
|
63
|
+
steps: [...t.steps.slice(0, t.at + 1), e],
|
|
64
|
+
at: t.at + 1
|
|
65
|
+
})), N = () => A((e) => ({
|
|
66
|
+
...e,
|
|
67
|
+
at: Math.max(0, e.at - 1)
|
|
68
|
+
})), P = () => A((e) => ({
|
|
69
|
+
...e,
|
|
70
|
+
at: Math.min(e.steps.length - 1, e.at + 1)
|
|
71
|
+
})), F = i(null), [I, L] = r(null), R = i(null), z = i(null);
|
|
72
|
+
n(() => (R.current ?? z.current)?.focus({ preventScroll: !0 }), [!!I]);
|
|
73
|
+
let B = () => {
|
|
74
|
+
let e = I?.text.trim().slice(0, 500);
|
|
75
|
+
I && e && M([...j, {
|
|
76
|
+
tool: "text",
|
|
77
|
+
color: T,
|
|
78
|
+
points: [I.x, I.y],
|
|
79
|
+
text: e,
|
|
80
|
+
width: _(b.current, D)
|
|
81
|
+
}]), z.current?.focus({ preventScroll: !0 }), L(null);
|
|
82
|
+
};
|
|
83
|
+
t(() => {
|
|
84
|
+
let e = !0, t = null;
|
|
85
|
+
return createImageBitmap(s).then((n) => e ? S(t = n) : n.close()), () => {
|
|
86
|
+
if (e = !1, t) {
|
|
87
|
+
let e = t;
|
|
88
|
+
S((t) => t === e ? null : t), l.add(e), e.close();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}, [s]), t(() => V(), [x, j]);
|
|
92
|
+
let V = (e) => {
|
|
93
|
+
let t = b.current;
|
|
94
|
+
if (!t || !x || l.has(x)) return;
|
|
95
|
+
(t.width !== x.width || t.height !== x.height) && (t.width = x.width, t.height = x.height);
|
|
96
|
+
let n = t.getContext("2d");
|
|
97
|
+
n.clearRect(0, 0, t.width, t.height), n.drawImage(x, 0, 0);
|
|
98
|
+
for (let t of e ? [...j, e] : j) y(n, t, x);
|
|
99
|
+
}, H = (e) => {
|
|
100
|
+
let t = b.current, n = t.getBoundingClientRect();
|
|
101
|
+
return [Math.round((e.clientX - n.left) / n.width * t.width), Math.round((e.clientY - n.top) / n.height * t.height)];
|
|
102
|
+
}, U = (e) => {
|
|
103
|
+
let [t, n] = H(e);
|
|
104
|
+
C === "text" ? (e.preventDefault(), B(), L({
|
|
105
|
+
x: t,
|
|
106
|
+
y: n,
|
|
107
|
+
left: Math.min(e.clientX, innerWidth - 240),
|
|
108
|
+
top: Math.max(8, e.clientY - 18),
|
|
109
|
+
text: ""
|
|
110
|
+
})) : (F.current = {
|
|
111
|
+
tool: C,
|
|
112
|
+
color: T,
|
|
113
|
+
points: [
|
|
114
|
+
t,
|
|
115
|
+
n,
|
|
116
|
+
t,
|
|
117
|
+
n
|
|
118
|
+
],
|
|
119
|
+
width: _(b.current, D)
|
|
120
|
+
}, b.current?.setPointerCapture(e.pointerId));
|
|
121
|
+
}, W = (e) => {
|
|
122
|
+
let t = F.current;
|
|
123
|
+
if (!t?.points) return;
|
|
124
|
+
let [n, r] = H(e);
|
|
125
|
+
t.tool === "pen" ? t.points.length < 4e3 && t.points.push(n, r) : (t.points[2] = n, t.points[3] = r), V(t);
|
|
126
|
+
}, G = () => {
|
|
127
|
+
F.current && M([...j, F.current]), F.current = null;
|
|
128
|
+
}, K = () => {
|
|
129
|
+
let e = I?.text.trim().slice(0, 500), t = I && e ? {
|
|
130
|
+
tool: "text",
|
|
131
|
+
color: T,
|
|
132
|
+
points: [I.x, I.y],
|
|
133
|
+
text: e,
|
|
134
|
+
width: _(b.current, D)
|
|
135
|
+
} : null;
|
|
136
|
+
t && V(t), b.current?.toBlob((e) => e && c(e, t ? [...j, t] : j), "image/webp", .88);
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ a("div", {
|
|
139
|
+
class: "ck-markup",
|
|
140
|
+
ref: z,
|
|
141
|
+
tabIndex: -1,
|
|
142
|
+
role: "dialog",
|
|
143
|
+
"aria-modal": "true",
|
|
144
|
+
"aria-label": e("markup"),
|
|
145
|
+
"data-commentkit-ui": !0,
|
|
146
|
+
onKeyDown: (e) => {
|
|
147
|
+
if (e.key === "Tab") {
|
|
148
|
+
let t = [...z.current.querySelectorAll("button, input")], n = t.indexOf(z.current.getRootNode().activeElement);
|
|
149
|
+
e.preventDefault(), t[n < 0 ? e.shiftKey ? t.length - 1 : 0 : (n + (e.shiftKey ? -1 : 1) + t.length) % t.length]?.focus();
|
|
150
|
+
} else {
|
|
151
|
+
if ((e.metaKey || e.ctrlKey) && !I && (e.key.toLowerCase() === "z" || e.key.toLowerCase() === "y")) return e.preventDefault(), e.stopPropagation(), e.key.toLowerCase() === "y" || e.shiftKey ? P() : N();
|
|
152
|
+
e.key === "Escape" && (e.stopPropagation(), I ? (z.current?.focus({ preventScroll: !0 }), L(null)) : g());
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ a("div", {
|
|
157
|
+
class: "ck-markup-tools",
|
|
158
|
+
role: "group",
|
|
159
|
+
"aria-label": e("markup"),
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ a("div", {
|
|
162
|
+
class: "ck-markup-group",
|
|
163
|
+
role: "group",
|
|
164
|
+
"aria-label": e("markupTools"),
|
|
165
|
+
children: u.map((t) => /* @__PURE__ */ a("button", {
|
|
166
|
+
class: "ck-tool",
|
|
167
|
+
"aria-pressed": C === t,
|
|
168
|
+
"aria-label": e(`tool_${t}`),
|
|
169
|
+
title: e(`tool_${t}`),
|
|
170
|
+
onClick: () => w(t),
|
|
171
|
+
children: /* @__PURE__ */ a(h, { d: p[t] })
|
|
172
|
+
}))
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ a("div", {
|
|
175
|
+
class: "ck-markup-group",
|
|
176
|
+
role: "group",
|
|
177
|
+
"aria-label": e("markupColors"),
|
|
178
|
+
children: d.map((t, n) => /* @__PURE__ */ a("button", {
|
|
179
|
+
class: "ck-tool",
|
|
180
|
+
"aria-pressed": T === t,
|
|
181
|
+
"aria-label": e(f[n]),
|
|
182
|
+
title: e(f[n]),
|
|
183
|
+
onClick: () => E(t),
|
|
184
|
+
children: /* @__PURE__ */ a("span", {
|
|
185
|
+
class: "ck-dot",
|
|
186
|
+
style: { background: t }
|
|
187
|
+
})
|
|
188
|
+
}))
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ a("label", {
|
|
191
|
+
class: "ck-markup-group ck-width",
|
|
192
|
+
children: [/* @__PURE__ */ a("input", {
|
|
193
|
+
type: "range",
|
|
194
|
+
min: 1,
|
|
195
|
+
max: 12,
|
|
196
|
+
step: 1,
|
|
197
|
+
value: D,
|
|
198
|
+
"aria-label": e("markupSize"),
|
|
199
|
+
onInput: (e) => O(Number(e.target.value))
|
|
200
|
+
}), /* @__PURE__ */ a("span", { children: [D, "px"] })]
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ a("div", {
|
|
203
|
+
class: "ck-markup-group",
|
|
204
|
+
role: "group",
|
|
205
|
+
"aria-label": e("markupHistory"),
|
|
206
|
+
children: /* @__PURE__ */ a("span", {
|
|
207
|
+
class: "ck-btn-group",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ a("button", {
|
|
210
|
+
class: "ck-icon-btn",
|
|
211
|
+
"aria-disabled": k.at === 0 || void 0,
|
|
212
|
+
"aria-label": e("undo"),
|
|
213
|
+
title: `${e("undo")} (${v()} Z)`,
|
|
214
|
+
"aria-keyshortcuts": "Meta+Z",
|
|
215
|
+
onClick: N,
|
|
216
|
+
children: /* @__PURE__ */ a(h, { d: m.undo })
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ a("button", {
|
|
219
|
+
class: "ck-icon-btn",
|
|
220
|
+
"aria-disabled": k.at === k.steps.length - 1 || void 0,
|
|
221
|
+
"aria-label": e("redo"),
|
|
222
|
+
title: `${e("redo")} (${v()} Shift Z)`,
|
|
223
|
+
"aria-keyshortcuts": "Meta+Shift+Z",
|
|
224
|
+
onClick: P,
|
|
225
|
+
children: /* @__PURE__ */ a(h, { d: m.redo })
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ a("button", {
|
|
228
|
+
class: "ck-icon-btn",
|
|
229
|
+
"aria-disabled": !j.length || void 0,
|
|
230
|
+
"aria-label": e("clearAll"),
|
|
231
|
+
title: e("clearAll"),
|
|
232
|
+
onClick: () => j.length && M([]),
|
|
233
|
+
children: /* @__PURE__ */ a(h, { d: m.clear })
|
|
234
|
+
})
|
|
235
|
+
]
|
|
236
|
+
})
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ a("div", {
|
|
239
|
+
class: "ck-markup-group",
|
|
240
|
+
children: /* @__PURE__ */ a("span", {
|
|
241
|
+
class: "ck-btn-group",
|
|
242
|
+
children: [/* @__PURE__ */ a("button", {
|
|
243
|
+
class: "ck-icon-btn",
|
|
244
|
+
"aria-label": e("cancel"),
|
|
245
|
+
title: `${e("cancel")} (Esc)`,
|
|
246
|
+
onClick: g,
|
|
247
|
+
children: /* @__PURE__ */ a(h, { d: m.cancel })
|
|
248
|
+
}), /* @__PURE__ */ a("button", {
|
|
249
|
+
class: "ck-icon-btn ck-primary",
|
|
250
|
+
"aria-disabled": !j.length && !I?.text.trim() || void 0,
|
|
251
|
+
"aria-label": e("markupDone"),
|
|
252
|
+
title: !j.length && !I?.text.trim() ? e("markupEmpty") : e("markupDone"),
|
|
253
|
+
onClick: () => (j.length || I?.text.trim()) && K(),
|
|
254
|
+
children: /* @__PURE__ */ a(h, { d: m.save })
|
|
255
|
+
})]
|
|
256
|
+
})
|
|
257
|
+
})
|
|
258
|
+
]
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ a("canvas", {
|
|
261
|
+
ref: b,
|
|
262
|
+
onPointerDown: U,
|
|
263
|
+
onPointerMove: W,
|
|
264
|
+
onPointerUp: G
|
|
265
|
+
}),
|
|
266
|
+
I ? /* @__PURE__ */ a("div", {
|
|
267
|
+
class: "ck-label-box",
|
|
268
|
+
style: o(I.left, I.top),
|
|
269
|
+
children: [/* @__PURE__ */ a("input", {
|
|
270
|
+
ref: R,
|
|
271
|
+
class: "ck-input",
|
|
272
|
+
maxLength: 500,
|
|
273
|
+
value: I.text,
|
|
274
|
+
placeholder: e("markupTextPrompt"),
|
|
275
|
+
"aria-label": e("markupTextPrompt"),
|
|
276
|
+
style: { color: T },
|
|
277
|
+
onInput: (e) => L({
|
|
278
|
+
...I,
|
|
279
|
+
text: e.target.value
|
|
280
|
+
}),
|
|
281
|
+
onKeyDown: (e) => {
|
|
282
|
+
e.key === "Enter" && (e.preventDefault(), B());
|
|
283
|
+
}
|
|
284
|
+
}), /* @__PURE__ */ a("button", {
|
|
285
|
+
class: "ck-chip ck-primary",
|
|
286
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
287
|
+
onClick: B,
|
|
288
|
+
children: e("markupTextAdd")
|
|
289
|
+
})]
|
|
290
|
+
}) : null
|
|
291
|
+
]
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function _(e, t) {
|
|
295
|
+
let n = e?.getBoundingClientRect().width || e?.width || 1;
|
|
296
|
+
return Math.max(1, Math.min(64, Math.round(t * ((e?.width ?? n) / n))));
|
|
297
|
+
}
|
|
298
|
+
var v = () => s() ? "⌘" : "Ctrl";
|
|
299
|
+
function y(e, t, n) {
|
|
300
|
+
let r = t.points ?? [], i = t.width ?? Math.max(3, Math.round(n.width / 300));
|
|
301
|
+
e.save(), e.strokeStyle = e.fillStyle = t.color ?? "#ff3b30", e.lineWidth = i, e.lineCap = e.lineJoin = "round";
|
|
302
|
+
let [a = 0, o = 0, s = 0, c = 0] = r;
|
|
303
|
+
switch (t.tool) {
|
|
304
|
+
case "rect":
|
|
305
|
+
e.strokeRect(Math.min(a, s), Math.min(o, c), Math.abs(s - a), Math.abs(c - o));
|
|
306
|
+
break;
|
|
307
|
+
case "ellipse":
|
|
308
|
+
e.beginPath(), e.ellipse((a + s) / 2, (o + c) / 2, Math.abs(s - a) / 2, Math.abs(c - o) / 2, 0, 0, Math.PI * 2), e.stroke();
|
|
309
|
+
break;
|
|
310
|
+
case "line":
|
|
311
|
+
e.beginPath(), e.moveTo(a, o), e.lineTo(s, c), e.stroke();
|
|
312
|
+
break;
|
|
313
|
+
case "arrow": {
|
|
314
|
+
let t = Math.atan2(c - o, s - a), n = i * 5;
|
|
315
|
+
e.beginPath(), e.moveTo(a, o), e.lineTo(s, c), e.stroke(), e.beginPath(), e.moveTo(s, c), e.lineTo(s - n * Math.cos(t - .45), c - n * Math.sin(t - .45)), e.lineTo(s - n * Math.cos(t + .45), c - n * Math.sin(t + .45)), e.closePath(), e.fill();
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
case "pen":
|
|
319
|
+
e.beginPath();
|
|
320
|
+
for (let t = 0; t < r.length; t += 2) (t ? e.lineTo : e.moveTo).call(e, r[t], r[t + 1]);
|
|
321
|
+
e.stroke();
|
|
322
|
+
break;
|
|
323
|
+
case "blur": {
|
|
324
|
+
let t = Math.min(a, s), n = Math.min(o, c), r = Math.abs(s - a), i = Math.abs(c - o);
|
|
325
|
+
if (r > 2 && i > 2) {
|
|
326
|
+
let a = Math.max(8, Math.round(Math.min(r, i) / 6)), o = e.getImageData(t, n, r, i);
|
|
327
|
+
for (let s = 0; s < i; s += a) for (let i = 0; i < r; i += a) {
|
|
328
|
+
let c = (s * r + i) * 4;
|
|
329
|
+
e.fillStyle = `rgb(${o.data[c]},${o.data[c + 1]},${o.data[c + 2]})`, e.fillRect(t + i, n + s, a, a);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
case "text": e.font = `bold ${Math.max(14, i * 6)}px system-ui, sans-serif`, e.lineWidth = i * 1.5, e.strokeStyle = "#ffffff", e.strokeText(t.text ?? "", a, o), e.fillText(t.text ?? "", a, o);
|
|
335
|
+
}
|
|
336
|
+
e.restore();
|
|
337
|
+
}
|
|
338
|
+
export { g as MarkupEditor };
|