pagecast 0.1.0 → 0.1.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/.codex/skills/publish-report/SKILL.md +15 -7
- package/feedback/worker.js +234 -0
- package/package.json +2 -1
- package/plugin/.claude-plugin/plugin.json +2 -2
- package/plugin/hooks/detect-report.mjs +8 -5
- package/plugin/skills/publish-report/SKILL.md +25 -16
- package/public/assets/{code-mirror-html-CwFouvGT.js → code-mirror-html-DFn3DH5h.js} +1 -1
- package/public/assets/dnd-vendor-BmyNMol4.js +5 -0
- package/public/assets/index-Ci9snOW8.css +1 -0
- package/public/assets/index-DThD-nOy.js +60 -0
- package/public/assets/motion-vendor-CqvjzA30.js +1 -0
- package/public/index.html +4 -4
- package/src/cli.js +49 -0
- package/src/markdown.js +0 -0
- package/src/server.js +402 -14
- package/public/assets/dnd-vendor-BtfBOykZ.js +0 -1
- package/public/assets/index-BTCh8CIt.js +0 -54
- package/public/assets/index-XOrnLHdD.css +0 -1
- package/public/assets/motion-vendor-CDgKLzlB.js +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: publish-report
|
|
3
|
-
description: Publish
|
|
3
|
+
description: Publish local HTML, Markdown, or built static web projects with Pagecast as shareable public URLs. Use whenever Codex creates or finishes an .html, .htm, .md, .markdown, or static build output that a person could share (a report, plan, doc, dashboard, or analysis) — proactively offer to publish it without being asked — and whenever the user asks to publish, share, make a public link for, or send a local report/doc/dashboard/web project from terminal, Codex CLI, or Codex desktop.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Publish With Pagecast
|
|
@@ -16,21 +16,29 @@ Cloudflare Pages project.
|
|
|
16
16
|
Never publish without explicit confirmation. Publishing makes the selected
|
|
17
17
|
artifact publicly reachable.
|
|
18
18
|
|
|
19
|
+
## Be Proactive
|
|
20
|
+
|
|
21
|
+
**Default to offering.** Right after you create or finish a shareable file, offer
|
|
22
|
+
once to publish it — do not wait for the user to ask, and do not stay silent
|
|
23
|
+
because you are unsure it is "worth it." If it could be shared, offer. When it is
|
|
24
|
+
borderline, offer anyway; the user can say no.
|
|
25
|
+
|
|
19
26
|
## What To Publish
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
Proactively offer once for any shareable artifact you produce:
|
|
22
29
|
|
|
23
30
|
- HTML reports, dashboards, coverage reports, Playwright/Lighthouse output, or
|
|
24
31
|
static single-page mini apps.
|
|
25
|
-
- Markdown reports, plans, docs, proposals, release notes, or summaries
|
|
26
|
-
be read by someone else.
|
|
32
|
+
- Markdown reports, plans, docs, proposals, release notes, analyses, or summaries
|
|
33
|
+
meant to be read by someone else.
|
|
27
34
|
- Static web projects after they are built. Publish the generated entry file,
|
|
28
35
|
usually `dist/index.html`, `build/index.html`, `out/index.html`, or
|
|
29
36
|
`public/index.html`; Pagecast stages sibling assets from that output folder.
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
Only skip (do not offer) clearly non-shareable files: scratch/draft notes the
|
|
39
|
+
user is keeping private, source files, repo metadata (README/CHANGELOG,
|
|
40
|
+
AGENTS.md/CLAUDE.md), task files, secrets, config files, dependency/build
|
|
41
|
+
folders, and hidden files.
|
|
34
42
|
|
|
35
43
|
## Confirmation
|
|
36
44
|
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// Pagecast feedback Worker.
|
|
2
|
+
//
|
|
3
|
+
// One small Cloudflare Worker, deployed once to the user's own account, that
|
|
4
|
+
// backs every published page's reactions + view analytics. Published static
|
|
5
|
+
// pages embed `widget.js` (served from this Worker); the widget beacons a view
|
|
6
|
+
// and posts reactions here, and the Pagecast admin reads aggregate stats back.
|
|
7
|
+
//
|
|
8
|
+
// Storage: a single JSON aggregate per page slug in KV (binding PAGECAST_FEEDBACK),
|
|
9
|
+
// key `stats:<slug>`. Reads are one KV get; writes are get -> mutate -> put.
|
|
10
|
+
// Counts are best-effort under heavy concurrency (KV has no atomic increment) —
|
|
11
|
+
// acceptable for view/reaction analytics, and avoids the cost/complexity of D1.
|
|
12
|
+
//
|
|
13
|
+
// Privacy: only coarse, aggregate signals are stored — country (from Cloudflare's
|
|
14
|
+
// request.cf.country), referrer HOST (not full URL), and device class (from the
|
|
15
|
+
// User-Agent). No IP addresses, no cookies, no per-visitor records, no PII.
|
|
16
|
+
//
|
|
17
|
+
// The pure helpers below are exported so they can be unit-tested under Node
|
|
18
|
+
// without a Workers runtime (see test/feedback.test.js).
|
|
19
|
+
|
|
20
|
+
// The reactions a viewer can leave. Anything outside this allowlist is ignored,
|
|
21
|
+
// so the endpoint can't be used to store arbitrary attacker-controlled strings.
|
|
22
|
+
export const REACTIONS = ["👍", "❤️", "🎉", "🚀", "👀"];
|
|
23
|
+
|
|
24
|
+
export function emptyStats() {
|
|
25
|
+
return { views: 0, reactions: {}, countries: {}, referrers: {}, devices: {} };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Coarse device class from a User-Agent string. Intentionally simple — we only
|
|
29
|
+
// want mobile / tablet / desktop buckets, not fingerprinting.
|
|
30
|
+
export function parseDevice(userAgent) {
|
|
31
|
+
const ua = String(userAgent || "").toLowerCase();
|
|
32
|
+
if (/ipad|tablet|playbook|silk|(android(?!.*mobile))/.test(ua)) {
|
|
33
|
+
return "tablet";
|
|
34
|
+
}
|
|
35
|
+
if (/mobi|iphone|ipod|android.*mobile|windows phone/.test(ua)) {
|
|
36
|
+
return "mobile";
|
|
37
|
+
}
|
|
38
|
+
return "desktop";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Reduce a referrer to a host bucket. Unknown / same-origin / missing referrers
|
|
42
|
+
// collapse to "direct" so the breakdown stays meaningful.
|
|
43
|
+
export function refHost(referrer, selfHost = "") {
|
|
44
|
+
const raw = String(referrer || "").trim();
|
|
45
|
+
if (raw === "") {
|
|
46
|
+
return "direct";
|
|
47
|
+
}
|
|
48
|
+
let host;
|
|
49
|
+
try {
|
|
50
|
+
host = new URL(raw).hostname.toLowerCase();
|
|
51
|
+
} catch {
|
|
52
|
+
return "direct";
|
|
53
|
+
}
|
|
54
|
+
if (!host || (selfHost && host === String(selfHost).toLowerCase())) {
|
|
55
|
+
return "direct";
|
|
56
|
+
}
|
|
57
|
+
// Drop a leading www. so example.com and www.example.com aggregate together.
|
|
58
|
+
return host.replace(/^www\./, "");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function bump(map, key) {
|
|
62
|
+
const k = key || "unknown";
|
|
63
|
+
return { ...map, [k]: (map[k] || 0) + 1 };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Apply a single view to an aggregate, returning a new aggregate.
|
|
67
|
+
export function applyView(stats, { country, ref, device } = {}) {
|
|
68
|
+
const base = stats || emptyStats();
|
|
69
|
+
return {
|
|
70
|
+
...base,
|
|
71
|
+
views: (base.views || 0) + 1,
|
|
72
|
+
countries: bump(base.countries || {}, (country || "XX").toUpperCase()),
|
|
73
|
+
referrers: bump(base.referrers || {}, ref || "direct"),
|
|
74
|
+
devices: bump(base.devices || {}, device || "desktop")
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Apply a single reaction. Non-allowlisted emojis are ignored (returns the
|
|
79
|
+
// aggregate unchanged) so the store can't be polluted.
|
|
80
|
+
export function applyReaction(stats, emoji) {
|
|
81
|
+
const base = stats || emptyStats();
|
|
82
|
+
if (!REACTIONS.includes(emoji)) {
|
|
83
|
+
return base;
|
|
84
|
+
}
|
|
85
|
+
return { ...base, reactions: bump(base.reactions || {}, emoji) };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// --- Worker runtime (not exercised by the Node tests) ----------------------
|
|
89
|
+
|
|
90
|
+
const CORS = {
|
|
91
|
+
"Access-Control-Allow-Origin": "*",
|
|
92
|
+
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
93
|
+
"Access-Control-Allow-Headers": "Content-Type",
|
|
94
|
+
"Access-Control-Max-Age": "86400"
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function json(body, status = 200, extraHeaders = {}) {
|
|
98
|
+
return new Response(JSON.stringify(body), {
|
|
99
|
+
status,
|
|
100
|
+
headers: { "Content-Type": "application/json", ...CORS, ...extraHeaders }
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Slugs come from the embedding page; keep them tame so they can't be abused as
|
|
105
|
+
// KV key injection or unbounded cardinality.
|
|
106
|
+
function cleanSlug(value) {
|
|
107
|
+
const slug = String(value || "").trim().toLowerCase();
|
|
108
|
+
return /^[a-z0-9][a-z0-9_-]{0,128}$/.test(slug) ? slug : null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function readStats(env, slug) {
|
|
112
|
+
const raw = await env.PAGECAST_FEEDBACK.get(`stats:${slug}`);
|
|
113
|
+
if (!raw) return emptyStats();
|
|
114
|
+
try {
|
|
115
|
+
return { ...emptyStats(), ...JSON.parse(raw) };
|
|
116
|
+
} catch {
|
|
117
|
+
return emptyStats();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async function writeStats(env, slug, stats) {
|
|
122
|
+
await env.PAGECAST_FEEDBACK.put(`stats:${slug}`, JSON.stringify(stats));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default {
|
|
126
|
+
async fetch(request, env) {
|
|
127
|
+
const url = new URL(request.url);
|
|
128
|
+
if (request.method === "OPTIONS") {
|
|
129
|
+
return new Response(null, { status: 204, headers: CORS });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// widget.js — the client script every published page embeds.
|
|
133
|
+
if (request.method === "GET" && url.pathname === "/widget.js") {
|
|
134
|
+
return new Response(WIDGET_SOURCE, {
|
|
135
|
+
headers: {
|
|
136
|
+
"Content-Type": "application/javascript; charset=utf-8",
|
|
137
|
+
"Cache-Control": "public, max-age=300",
|
|
138
|
+
...CORS
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (request.method === "POST" && url.pathname === "/api/v1/view") {
|
|
144
|
+
const body = await request.json().catch(() => ({}));
|
|
145
|
+
const slug = cleanSlug(body.slug);
|
|
146
|
+
if (!slug) return json({ ok: false, error: "bad slug" }, 400);
|
|
147
|
+
const stats = applyView(await readStats(env, slug), {
|
|
148
|
+
country: request.cf?.country,
|
|
149
|
+
ref: refHost(request.headers.get("referer"), url.hostname),
|
|
150
|
+
device: parseDevice(request.headers.get("user-agent"))
|
|
151
|
+
});
|
|
152
|
+
await writeStats(env, slug, stats);
|
|
153
|
+
return json({ ok: true, views: stats.views, reactions: stats.reactions });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (request.method === "POST" && url.pathname === "/api/v1/react") {
|
|
157
|
+
const body = await request.json().catch(() => ({}));
|
|
158
|
+
const slug = cleanSlug(body.slug);
|
|
159
|
+
if (!slug) return json({ ok: false, error: "bad slug" }, 400);
|
|
160
|
+
if (!REACTIONS.includes(body.emoji)) {
|
|
161
|
+
return json({ ok: false, error: "bad emoji" }, 400);
|
|
162
|
+
}
|
|
163
|
+
const stats = applyReaction(await readStats(env, slug), body.emoji);
|
|
164
|
+
await writeStats(env, slug, stats);
|
|
165
|
+
return json({ ok: true, reactions: stats.reactions });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Aggregate stats for the admin. Gated by a shared secret so a page's slug
|
|
169
|
+
// alone doesn't expose its analytics to the public.
|
|
170
|
+
if (request.method === "GET" && url.pathname === "/api/v1/stats") {
|
|
171
|
+
const token = env.PAGECAST_STATS_TOKEN;
|
|
172
|
+
if (token && url.searchParams.get("token") !== token) {
|
|
173
|
+
return json({ ok: false, error: "unauthorized" }, 401);
|
|
174
|
+
}
|
|
175
|
+
const slug = cleanSlug(url.searchParams.get("slug"));
|
|
176
|
+
if (!slug) return json({ ok: false, error: "bad slug" }, 400);
|
|
177
|
+
return json({ ok: true, slug, stats: await readStats(env, slug) });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return json({ ok: false, error: "not found" }, 404);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// The client widget is written as a real function and serialized with
|
|
185
|
+
// toString(), so the Worker stays a single self-contained file (no bundler
|
|
186
|
+
// needed at deploy time) while the widget remains readable, lint-able source.
|
|
187
|
+
const WIDGET_SOURCE = `(${clientWidget.toString()})();`;
|
|
188
|
+
|
|
189
|
+
function clientWidget() {
|
|
190
|
+
// NOTE: this function is serialized to a string and shipped to browsers, so it
|
|
191
|
+
// must not reference anything outside its own scope (no imports, no closures).
|
|
192
|
+
var s = document.currentScript;
|
|
193
|
+
var base = s ? s.src.replace(/\/widget\.js.*$/, "") : "";
|
|
194
|
+
var slug = (s && s.getAttribute("data-slug")) || "";
|
|
195
|
+
if (!slug) return;
|
|
196
|
+
var REACTIONS = ["👍", "❤️", "🎉", "🚀", "👀"];
|
|
197
|
+
|
|
198
|
+
function post(path, body) {
|
|
199
|
+
return fetch(base + path, {
|
|
200
|
+
method: "POST",
|
|
201
|
+
headers: { "Content-Type": "application/json" },
|
|
202
|
+
body: JSON.stringify(body),
|
|
203
|
+
keepalive: true
|
|
204
|
+
}).then(function (r) { return r.json(); }).catch(function () { return null; });
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
var counts = {};
|
|
208
|
+
function render(bar) {
|
|
209
|
+
bar.innerHTML = "";
|
|
210
|
+
REACTIONS.forEach(function (emoji) {
|
|
211
|
+
var b = document.createElement("button");
|
|
212
|
+
b.type = "button";
|
|
213
|
+
b.textContent = emoji + (counts[emoji] ? " " + counts[emoji] : "");
|
|
214
|
+
b.style.cssText =
|
|
215
|
+
"font:14px system-ui;border:1px solid #e4e4e7;background:#fff;border-radius:999px;padding:4px 10px;cursor:pointer;line-height:1";
|
|
216
|
+
b.onclick = function () {
|
|
217
|
+
post("/api/v1/react", { slug: slug, emoji: emoji }).then(function (d) {
|
|
218
|
+
if (d && d.reactions) { counts = d.reactions; render(bar); }
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
bar.appendChild(b);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
var wrap = document.createElement("div");
|
|
226
|
+
wrap.style.cssText =
|
|
227
|
+
"position:fixed;right:16px;bottom:16px;display:flex;gap:6px;padding:6px;background:#fafafa;border:1px solid #e4e4e7;border-radius:999px;box-shadow:0 4px 14px rgba(0,0,0,.08);z-index:2147483647";
|
|
228
|
+
render(wrap);
|
|
229
|
+
document.body.appendChild(wrap);
|
|
230
|
+
|
|
231
|
+
post("/api/v1/view", { slug: slug }).then(function (d) {
|
|
232
|
+
if (d && d.reactions) { counts = d.reactions; render(wrap); }
|
|
233
|
+
});
|
|
234
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pagecast",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Preview local HTML reports and static mini apps, then publish them to shareable URLs.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"src/",
|
|
35
35
|
"public/",
|
|
36
36
|
"plugin/",
|
|
37
|
+
"feedback/",
|
|
37
38
|
".codex/skills/publish-report/",
|
|
38
39
|
"llms.txt"
|
|
39
40
|
],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pagecast",
|
|
3
3
|
"displayName": "Pagecast",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "When your agent finishes an HTML or Markdown report, plan, or doc, it offers to publish it to a shareable public URL with Pagecast.",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"description": "When your agent finishes an HTML or Markdown report, plan, or doc, it proactively offers to publish it to a shareable public URL with Pagecast.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Pagecast"
|
|
8
8
|
},
|
|
@@ -85,11 +85,14 @@ async function main() {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
const additionalContext =
|
|
88
|
-
`
|
|
89
|
-
`
|
|
90
|
-
`
|
|
91
|
-
`
|
|
92
|
-
`
|
|
88
|
+
`A shareable HTML/Markdown file was just written at "${filePath}". ` +
|
|
89
|
+
`Default action: when you finish this turn, proactively offer ONCE to publish it — ` +
|
|
90
|
+
`ask the user exactly "Want me to publish this with Pagecast? It'll create a shareable public link." ` +
|
|
91
|
+
`Offer unless the file is clearly internal/scratch (a draft note, a config/source file, or repo meta ` +
|
|
92
|
+
`like README/CHANGELOG/TODO — those were already filtered, so lean toward offering). ` +
|
|
93
|
+
`Do not stay silent just because you are unsure. ` +
|
|
94
|
+
`Only on an explicit yes, run \`npx pagecast publish "${filePath}" --json\` and return the URL. ` +
|
|
95
|
+
`Never publish without an explicit yes, and ask at most once for this file.`;
|
|
93
96
|
|
|
94
97
|
process.stdout.write(
|
|
95
98
|
JSON.stringify({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: publish-report
|
|
3
|
-
description: Use
|
|
4
|
-
version: 0.
|
|
3
|
+
description: Use right after an HTML or Markdown report, plan, doc, dashboard, or built static web project is created (or when the user wants to share one). Proactively offer to publish it with Pagecast as a shareable public link, then return the URL. Default to offering; only skip clearly internal/scratch files.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Publish with Pagecast
|
|
@@ -12,22 +12,31 @@ right moment, then do it on a yes.
|
|
|
12
12
|
|
|
13
13
|
## When to offer
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**Default to offering.** Whenever you produce an `.html`/`.htm` or
|
|
16
|
+
`.md`/`.markdown` file that a person could reasonably share, proactively offer to
|
|
17
|
+
publish it — once, right after you finish making it. Do **not** wait to be asked,
|
|
18
|
+
and do **not** stay silent because you are unsure whether it is "worth it." If it
|
|
19
|
+
could be shared, offer.
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- A
|
|
21
|
+
This includes:
|
|
22
|
+
|
|
23
|
+
- A report you generated — test/coverage/Lighthouse/Playwright output, a data
|
|
24
|
+
dashboard, an analysis, a "here's what I built/found" summary.
|
|
25
|
+
- A written plan, proposal, design doc, spec, release notes, or doc.
|
|
26
|
+
- A static web project that was just built, with a generated entry file such as
|
|
22
27
|
`dist/index.html`, `build/index.html`, `out/index.html`, or `public/index.html`.
|
|
23
|
-
-
|
|
24
|
-
- A `PostToolUse` hint
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
- Any time the user says "share", "publish", "make a link for", or "send" a doc.
|
|
29
|
+
- A `PostToolUse` hint fired saying an HTML/Markdown file was created — treat that
|
|
30
|
+
as a cue to offer.
|
|
31
|
+
|
|
32
|
+
**The only files to skip** (don't offer): scratch/draft notes the user is clearly
|
|
33
|
+
keeping private, source code, config files, secrets, and repo-meta files (README,
|
|
34
|
+
CHANGELOG, CONTRIBUTING, LICENSE, AGENTS.md, CLAUDE.md, TODO/tasks), or anything
|
|
35
|
+
under `node_modules`/`dist` build internals. When it is borderline, **offer** —
|
|
36
|
+
the user can just say no.
|
|
37
|
+
|
|
38
|
+
Ask **at most once per file.** If the user declines or ignores the offer, drop it
|
|
39
|
+
and don't re-ask for that file. Never nag across multiple turns.
|
|
31
40
|
|
|
32
41
|
## The one question to ask
|
|
33
42
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as xe,j as lc}from"./motion-vendor-
|
|
1
|
+
import{a as xe,j as lc}from"./motion-vendor-CqvjzA30.js";function qs(){return qs=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},qs.apply(null,arguments)}function Ud(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}let Bs=[],ac=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?ac:Bs).push(t=t+n[e])})();function Fd(n){if(n<768)return!1;for(let e=0,t=Bs.length;;){let i=e+t>>1;if(n<Bs[i])t=i;else if(n>=ac[i])e=i+1;else return!0;if(e==t)return!1}}function _l(n){return n>=127462&&n<=127487}const zl=8205;function Hd(n,e,t=!0,i=!0){return(t?hc:Kd)(n,e,i)}function hc(n,e,t){if(e==n.length)return e;e&&cc(n.charCodeAt(e))&&fc(n.charCodeAt(e-1))&&e--;let i=rs(n,e);for(e+=El(i);e<n.length;){let r=rs(n,e);if(i==zl||r==zl||t&&Fd(r))e+=El(r),i=r;else if(_l(r)){let s=0,o=e-2;for(;o>=0&&_l(rs(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Kd(n,e,t){for(;e>0;){let i=hc(n,e-2,t);if(i<e)return i;e--}return 0}function rs(n,e){let t=n.charCodeAt(e);if(!fc(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return cc(i)?(t-55296<<10)+(i-56320)+65536:t}function cc(n){return n>=56320&&n<57344}function fc(n){return n>=55296&&n<56320}function El(n){return n<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=gi(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),ot.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=gi(this,e,t);let i=[];return this.decompose(e,t,i,0),ot.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new qi(this),s=new qi(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new qi(this,e)}iterRange(e,t=this.length){return new uc(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new dc(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new re(e):ot.from(re.split(e,[]))}}class re extends D{constructor(e,t=Jd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new eO(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new re(Yl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=Fn(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new re(l,o.length+s.length));else{let a=l.length>>1;i.push(new re(l.slice(0,a)),new re(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);[e,t]=gi(this,e,t);let r=Fn(this.text,Fn(i.text,Yl(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new re(r,s):ot.from(re.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=gi(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new re(i,r)),i=[],r=-1);return r>-1&&t.push(new re(i,r)),t}}class ot extends D{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=gi(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new ot(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=gi(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ot))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new re(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let O;if(d.lines>s&&d instanceof ot)for(let p of d.children)f(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof re&&a&&(O=c[c.length-1])instanceof re&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new re(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:ot.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new ot(l,t)}}D.empty=new re([""],0);function Jd(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Fn(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function Yl(n,e,t){return Fn(n,[""],e,t)}class qi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof re?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof re?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(r instanceof re){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof re?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class uc{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new qi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class dc{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(D.prototype[Symbol.iterator]=function(){return this.iter()},qi.prototype[Symbol.iterator]=uc.prototype[Symbol.iterator]=dc.prototype[Symbol.iterator]=function(){return this});class eO{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function gi(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function he(n,e,t=!0,i=!0){return Hd(n,e,t,i)}function tO(n){return n>=56320&&n<57344}function iO(n){return n>=55296&&n<56320}function Pe(n,e){let t=n.charCodeAt(e);if(!iO(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return tO(i)?(t-55296<<10)+(i-56320)+65536:t}function Lo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function lt(n){return n<65536?1:2}const Is=/\r\n?|\n/;var Oe=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Oe||(Oe={}));class dt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){Ns(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new dt(e)}composeDesc(e){return this.empty?e:e.empty?this:Oc(this,e)}mapDesc(e,t=!1){return e.empty?this:Gs(this,e,t)}mapPos(e,t=-1,i=Oe.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=Oe.Simple&&h>=e&&(i==Oe.TrackDel&&r<e&&h>e||i==Oe.TrackBefore&&r<e||i==Oe.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new dt(e)}static create(e){return new dt(e)}}class oe extends dt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ns(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Gs(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(D.empty);i.push(o?e.slice(s,s+o):D.empty)}s+=o}return new oe(t,i)}compose(e){return this.empty?e:e.empty?this:Oc(this,e,!0)}map(e,t=!1){return e.empty?this:Gs(this,e,t,!0)}iterChanges(e,t=!1){Ns(this,e,t)}get desc(){return dt.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new Hi(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);ge(r,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ge(t,c,f),f>0&&Tt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);ge(t,c,-1),ge(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new oe(t,i),filtered:dt.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<t&&ge(r,t-o,-1);let f=new oe(r,s);l=l?l.compose(f.map(l)):f,r=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof oe){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let O=d?typeof d=="string"?D.of(d.split(i||Is)):d:D.empty,p=O.length;if(f==u&&p==0)return;f<o&&a(),f>o&&ge(r,f-o,-1),ge(r,u-f,p),Tt(s,r,O),o=u}}return h(e),a(!l),l}static empty(e){return new oe(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(D.empty);i[r]=D.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new oe(t,i)}static createSet(e,t){return new oe(e,t)}}function ge(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function Tt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(D.empty);n.push(t)}}function Ns(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,f=D.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function Gs(n,e,t,i=!1){let r=[],s=i?[]:null,o=new Hi(n),l=new Hi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ge(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(ge(r,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ge(r,0,o.ins),s&&Tt(s,r,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;ge(r,h,a<o.i?o.ins:0),s&&a<o.i&&Tt(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?oe.createSet(r,s):dt.create(r);throw new Error("Mismatched change set lengths")}}}function Oc(n,e,t=!1){let i=[],r=t?[]:null,s=new Hi(n),o=new Hi(e);for(let l=!1;;){if(s.done&&o.done)return r?oe.createSet(i,r):dt.create(i);if(s.ins==0)ge(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)ge(i,0,o.ins,l),r&&Tt(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;ge(i,a,c,l),r&&c&&Tt(r,i,o.text)}else o.ins==-1?(ge(i,s.off?0:s.len,a,l),r&&Tt(r,i,s.textBit(a))):(ge(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&Tt(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class Hi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?D.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?D.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class It{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new It(i,r,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return y.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return y.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(e.anchor,e.head)}static create(e,t,i){return new It(e,t,i)}}class y{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:y.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new y([this.main],0)}addRange(e,t=!0){return y.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,y.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(e.ranges.map(t=>It.fromJSON(t)),e.main)}static single(e,t=e){return new y([y.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return y.normalized(e.slice(),t);i=s.to}return new y(e,t)}static cursor(e,t=0,i,r){return It.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(r??16777215)<<6)}static range(e,t,i,r,s){let o=(i??16777215)<<6|(r==null?7:Math.min(6,r));return!s&&e!=t&&(s=t<e?1:-1),t<e?It.create(t,e,48|o):It.create(e,t,(s?s<0?8:16:0)|o)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?y.range(a,l):y.range(l,a))}}return new y(e,t)}}function pc(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let qo=0;class T{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=qo++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new T(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Bo),!!e.static,e.enables)}of(e){return new Hn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Hn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Bo(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Hn{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=qo++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Us(f,c)){let d=i(f);if(l?!Vl(d,f.values[o],r):!r(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,O=u.config.address[s];if(O!=null){let p=hr(u,O);if(this.dependencies.every(g=>g instanceof T?u.facet(g)===f.facet(g):g instanceof me?u.field(g,!1)==f.field(g,!1):!0)||(l?Vl(d=i(f),p,r):r(d=i(f),p)))return f.values[o]=p,0}else d=i(f);return f.values[o]=d,1}}}}function Vl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Us(n,e){let t=!1;for(let i of e)Bi(n,i)&1&&(t=!0);return t}function nO(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=hr(a,i[c]);if(r[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)Bi(a,h);return a.values[o]=l(a),1},update(a,h){if(!Us(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=Us(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Bo(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const Pn=T.define({static:!0});class me{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new me(qo++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Pn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(Pn),o=r.facet(Pn),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Pn.of({field:this,create:e})]}get extension(){return this}}const qt={lowest:4,low:3,default:2,high:1,highest:0};function Ri(n){return e=>new mc(e,n)}const _t={highest:Ri(qt.highest),high:Ri(qt.high),default:Ri(qt.default),low:Ri(qt.low),lowest:Ri(qt.lowest)};class mc{constructor(e,t){this.inner=e,this.prec=t}}class Er{of(e){return new Fs(this,e)}reconfigure(e){return Er.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Fs{constructor(e,t){this.compartment=e,this.inner=t}}class ar{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let u of rO(e,t,o))u instanceof me?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in s){let d=s[u],O=d[0].facet,p=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[O.id]=a.length<<1|1,Bo(p,d))a.push(i.facet(O));else{let g=O.combine(d.map(S=>S.value));a.push(i&&O.compare(g,i.facet(O))?i.facet(O):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(S=>g.dynamicSlot(S)));l[O.id]=h.length<<1,h.push(g=>nO(g,O,d))}}let f=h.map(u=>u(l));return new ar(e,o,f,l,a,s)}}function rO(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Fs&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof Fs){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof mc)s(o.inner,o.prec);else if(o instanceof me)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Hn)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,qt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,qt.default),i.reduce((o,l)=>o.concat(l))}function Bi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function hr(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const gc=T.define(),Hs=T.define({combine:n=>n.some(e=>e),static:!0}),Sc=T.define({combine:n=>n.length?n[0]:void 0,static:!0}),yc=T.define(),bc=T.define(),Qc=T.define(),xc=T.define({combine:n=>n.length?n[0]:!1});class pt{constructor(e,t){this.type=e,this.value=t}static define(){return new sO}}class sO{of(e){return new pt(this,e)}}class oO{constructor(e){this.map=e}of(e){return new M(this,e)}}class M{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new M(this.type,t)}is(e){return this.type==e}static define(e={}){return new oO(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}M.reconfigure=M.define();M.appendConfig=M.define();class se{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&pc(i,t.newLength),s.some(l=>l.type==se.time)||(this.annotations=s.concat(se.time.of(Date.now())))}static create(e,t,i,r,s,o){return new se(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(se.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}se.time=pt.define();se.userEvent=pt.define();se.addToHistory=pt.define();se.remote=pt.define();function lO(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function wc(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=oe.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:M.mapEffects(n.effects,r).concat(M.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Ks(n,e,t){let i=e.selection,r=hi(e.annotations);return e.userEvent&&(r=r.concat(se.userEvent.of(e.userEvent))),{changes:e.changes instanceof oe?e.changes:oe.of(e.changes||[],t,n.facet(Sc)),selection:i&&(i instanceof y?i:y.single(i.anchor,i.head)),effects:hi(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function kc(n,e,t){let i=Ks(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=wc(i,Ks(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=se.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return hO(t?aO(r):r)}function aO(n){let e=n.startState,t=!0;for(let r of e.facet(yc)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:lO(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=oe.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=se.create(e,r,n.selection&&n.selection.map(s),M.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(bc);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof se?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof se?n=s[0]:n=kc(e,hi(s),!1)}return n}function hO(n){let e=n.startState,t=e.facet(Qc),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=wc(i,Ks(e,s,n.changes.newLength),!0))}return i==n?n:se.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const cO=[];function hi(n){return n==null?cO:Array.isArray(n)?n:[n]}var H=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(H||(H={}));const fO=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Js;try{Js=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function uO(n){if(Js)return Js.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||fO.test(t)))return!0}return!1}function dO(n){return e=>{if(!/\S/.test(e))return H.Space;if(uO(e))return H.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return H.Word;return H.Other}}class V{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Bi(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Bi(this,i),hr(this,i)}update(...e){return kc(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(Er.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,h)=>r.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(t=null,i=l.value):l.is(M.appendConfig)&&(t=null,i=hi(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=ar.resolve(i,r,this),s=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Hs)?e.newSelection:e.newSelection.asSingle();new V(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:y.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=hi(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(r);for(let u=0;u<l;u++)s[u]=s[u].map(c);let f=r.mapDesc(h,!0);s.push(a.range.map(f)),r=r.compose(c),o=M.mapEffects(o,c).concat(M.mapEffects(hi(a.effects),f))}return{changes:r,selection:y.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof oe?e:oe.of(e,this.doc.length,this.facet(V.lineSeparator))}toText(e){return D.of(e.split(this.facet(V.lineSeparator)||Is))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Bi(this,t),hr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof me&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:y.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=ar.resolve(e.extensions||[],new Map),i=e.doc instanceof D?e.doc:D.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||Is)),r=e.selection?e.selection instanceof y?e.selection:y.single(e.selection.anchor,e.selection.head):y.single(0);return pc(r,i.length),t.staticFacet(Hs)||(r=r.asSingle()),new V(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||`
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as An,g as Mn,a as u,R as z}from"./motion-vendor-CqvjzA30.js";var ct={exports:{}},P={};var Nt;function Tn(){if(Nt)return P;Nt=1;var e=An();function t(a){var i="https://react.dev/errors/"+a;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function s(a,i,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:f==null?null:""+f,children:a,containerInfo:i,implementation:d}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(a,i){if(a==="font")return"";if(typeof i=="string")return i==="use-credentials"?i:""}return P.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,P.createPortal=function(a,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)throw Error(t(299));return s(a,i,null,d)},P.flushSync=function(a){var i=c.T,d=r.p;try{if(c.T=null,r.p=2,a)return a()}finally{c.T=i,r.p=d,r.d.f()}},P.preconnect=function(a,i){typeof a=="string"&&(i?(i=i.crossOrigin,i=typeof i=="string"?i==="use-credentials"?i:"":void 0):i=null,r.d.C(a,i))},P.prefetchDNS=function(a){typeof a=="string"&&r.d.D(a)},P.preinit=function(a,i){if(typeof a=="string"&&i&&typeof i.as=="string"){var d=i.as,f=l(d,i.crossOrigin),h=typeof i.integrity=="string"?i.integrity:void 0,g=typeof i.fetchPriority=="string"?i.fetchPriority:void 0;d==="style"?r.d.S(a,typeof i.precedence=="string"?i.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:g}):d==="script"&&r.d.X(a,{crossOrigin:f,integrity:h,fetchPriority:g,nonce:typeof i.nonce=="string"?i.nonce:void 0})}},P.preinitModule=function(a,i){if(typeof a=="string")if(typeof i=="object"&&i!==null){if(i.as==null||i.as==="script"){var d=l(i.as,i.crossOrigin);r.d.M(a,{crossOrigin:d,integrity:typeof i.integrity=="string"?i.integrity:void 0,nonce:typeof i.nonce=="string"?i.nonce:void 0})}}else i==null&&r.d.M(a)},P.preload=function(a,i){if(typeof a=="string"&&typeof i=="object"&&i!==null&&typeof i.as=="string"){var d=i.as,f=l(d,i.crossOrigin);r.d.L(a,d,{crossOrigin:f,integrity:typeof i.integrity=="string"?i.integrity:void 0,nonce:typeof i.nonce=="string"?i.nonce:void 0,type:typeof i.type=="string"?i.type:void 0,fetchPriority:typeof i.fetchPriority=="string"?i.fetchPriority:void 0,referrerPolicy:typeof i.referrerPolicy=="string"?i.referrerPolicy:void 0,imageSrcSet:typeof i.imageSrcSet=="string"?i.imageSrcSet:void 0,imageSizes:typeof i.imageSizes=="string"?i.imageSizes:void 0,media:typeof i.media=="string"?i.media:void 0})}},P.preloadModule=function(a,i){if(typeof a=="string")if(i){var d=l(i.as,i.crossOrigin);r.d.m(a,{as:typeof i.as=="string"&&i.as!=="script"?i.as:void 0,crossOrigin:d,integrity:typeof i.integrity=="string"?i.integrity:void 0})}else r.d.m(a)},P.requestFormReset=function(a){r.d.r(a)},P.unstable_batchedUpdates=function(a,i){return a(i)},P.useFormState=function(a,i,d){return c.H.useFormState(a,i,d)},P.useFormStatus=function(){return c.H.useHostTransitionStatus()},P.version="19.2.6",P}var Lt;function In(){if(Lt)return ct.exports;Lt=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ct.exports=Tn(),ct.exports}var me=In();const ho=Mn(me);function Nn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function yt(e){return"nodeType"in e}function B(e){var t,n;return e?xe(e)?e:yt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return xe(e)?!1:e instanceof B(e).HTMLElement}function Kt(e){return e instanceof B(e).SVGElement}function De(e){return e?xe(e)?e.document:yt(e)?mt(e)?e:Be(e)||Kt(e)?e.ownerDocument:document:document:document}const Z=tt?u.useLayoutEffect:u.useEffect;function wt(e){const t=u.useRef(e);return Z(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Ln(){const e=u.useRef(null),t=u.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pe(e,t){t===void 0&&(t=[e]);const n=u.useRef(e);return Z(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=u.useRef();return u.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ge(e){const t=wt(e),n=u.useRef(null),r=u.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function gt(e){const t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}let lt={};function $e(e,t){return u.useMemo(()=>{if(t)return t;const n=lt[e]==null?0:lt[e]+1;return lt[e]=n,e+"-"+n},[e,t])}function qt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,c)=>{const l=Object.entries(c);for(const[a,i]of l){const d=s[a];d!=null&&(s[a]=d+e*i)}return s},{...t})}}const we=qt(1),_e=qt(-1);function kn(e){return"clientX"in e&&"clientY"in e}function xt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Pn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ht(e){if(Pn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return kn(e)?{x:e.clientX,y:e.clientY}:null}const Je=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Je.Translate.toString(e),Je.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),kt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function _n(e){return e.matches(kt)?e:e.querySelector(kt)}const zn={display:"none"};function Bn(e){let{id:t,value:n}=e;return z.createElement("div",{id:t,style:zn},n)}function Fn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return z.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function $n(){const[e,t]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Vt=u.createContext(null);function Un(e){const t=u.useContext(Vt);u.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Xn(){const[e]=u.useState(()=>new Set),t=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:o,event:s}=r;e.forEach(c=>{var l;return(l=c[o])==null?void 0:l.call(c,s)})},[e]),t]}const Yn={draggable:`
|
|
2
|
+
To pick up a draggable item, press the space bar.
|
|
3
|
+
While dragging, use the arrow keys to move the item.
|
|
4
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
+
`},jn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Hn(e){let{announcements:t=jn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Yn}=e;const{announce:s,announcement:c}=$n(),l=$e("DndLiveRegion"),[a,i]=u.useState(!1);if(u.useEffect(()=>{i(!0)},[]),Un(u.useMemo(()=>({onDragStart(f){let{active:h}=f;s(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&s(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;s(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;s(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;s(t.onDragCancel({active:h,over:g}))}}),[s,t])),!a)return null;const d=z.createElement(z.Fragment,null,z.createElement(Bn,{id:r,value:o.draggable}),z.createElement(Fn,{id:l,announcement:c}));return n?me.createPortal(d,n):d}var T;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(T||(T={}));function Qe(){}function vo(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function po(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const q=Object.freeze({x:0,y:0});function Gt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Wn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Pt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Qt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function _t(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const bo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=_t(t,t.left,t.top),s=[];for(const c of r){const{id:l}=c,a=n.get(l);if(a){const i=Gt(_t(a),o);s.push({id:l,data:{droppableContainer:c,value:i}})}}return s.sort(Jt)},Kn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Pt(t),s=[];for(const c of r){const{id:l}=c,a=n.get(l);if(a){const i=Pt(a),d=o.reduce((h,g,R)=>h+Gt(i[R],g),0),f=Number((d/4).toFixed(4));s.push({id:l,data:{droppableContainer:c,value:f}})}}return s.sort(Jt)};function qn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=s-n;if(r<o&&n<s){const a=t.width*t.height,i=e.width*e.height,d=c*l,f=d/(a+i-d);return Number(f.toFixed(4))}return 0}const Vn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,l=n.get(c);if(l){const a=qn(l,t);a>0&&o.push({id:c,data:{droppableContainer:s,value:a}})}}return o.sort(Wn)};function Gn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Zt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:q}function Jn(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const Qn=Jn(1);function Zn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function er(e,t,n){const r=Zn(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:l}=r,a=e.left-c-(1-o)*parseFloat(n),i=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,f=s?e.height/s:e.height;return{width:d,height:f,top:i,right:a+d,bottom:i+f,left:a}}const tr={ignoreTransform:!1};function Re(e,t){t===void 0&&(t=tr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:i,transformOrigin:d}=B(e).getComputedStyle(e);i&&(n=er(n,i,d))}const{top:r,left:o,width:s,height:c,bottom:l,right:a}=n;return{top:r,left:o,width:s,height:c,bottom:l,right:a}}function zt(e){return Re(e,{ignoreTransform:!0})}function nr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function rr(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function or(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function nt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(mt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Kt(o)||n.includes(o))return n;const s=B(e).getComputedStyle(o);return o!==e&&or(o,s)&&n.push(o),rr(o,s)?n:r(o.parentNode)}return e?r(e):n}function en(e){const[t]=nt(e,1);return t??null}function ut(e){return!tt||!e?null:xe(e)?e:yt(e)?mt(e)||e===De(e).scrollingElement?window:Be(e)?e:null:null}function tn(e){return xe(e)?e.scrollX:e.scrollLeft}function nn(e){return xe(e)?e.scrollY:e.scrollTop}function vt(e){return{x:tn(e),y:nn(e)}}var N;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(N||(N={}));function rn(e){return!tt||!e?!1:e===document.scrollingElement}function on(e){const t={x:0,y:0},n=rn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const ir={x:.2,y:.2};function sr(e,t,n,r,o){let{top:s,left:c,right:l,bottom:a}=n;r===void 0&&(r=10),o===void 0&&(o=ir);const{isTop:i,isBottom:d,isLeft:f,isRight:h}=on(e),g={x:0,y:0},R={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!i&&s<=t.top+v.height?(g.y=N.Backward,R.y=r*Math.abs((t.top+v.height-s)/v.height)):!d&&a>=t.bottom-v.height&&(g.y=N.Forward,R.y=r*Math.abs((t.bottom-v.height-a)/v.height)),!h&&l>=t.right-v.width?(g.x=N.Forward,R.x=r*Math.abs((t.right-v.width-l)/v.width)):!f&&c<=t.left+v.width&&(g.x=N.Backward,R.x=r*Math.abs((t.left+v.width-c)/v.width)),{direction:g,speed:R}}function ar(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function sn(e){return e.reduce((t,n)=>we(t,vt(n)),q)}function cr(e){return e.reduce((t,n)=>t+tn(n),0)}function lr(e){return e.reduce((t,n)=>t+nn(n),0)}function ur(e,t){if(t===void 0&&(t=Re),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);en(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const dr=[["x",["left","right"],cr],["y",["top","bottom"],lr]];class Dt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=nt(n),o=sn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,l]of dr)for(const a of c)Object.defineProperty(this,a,{get:()=>{const i=l(r),d=o[s]-i;return this.rect[a]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ne{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function fr(e){const{EventTarget:t}=B(e);return e instanceof t?e:De(e)}function dt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var H;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(H||(H={}));function Bt(e){e.preventDefault()}function gr(e){e.stopPropagation()}var y;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(y||(y={}));const an={start:[y.Space,y.Enter],cancel:[y.Esc],end:[y.Space,y.Enter,y.Tab]},hr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case y.Right:return{...n,x:n.x+25};case y.Left:return{...n,x:n.x-25};case y.Down:return{...n,y:n.y+25};case y.Up:return{...n,y:n.y-25}}};class cn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ne(De(n)),this.windowListeners=new Ne(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(H.Resize,this.handleCancel),this.windowListeners.add(H.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(H.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ur(r),n(q)}handleKeyDown(t){if(xt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=an,coordinateGetter:c=hr,scrollBehavior:l="smooth"}=o,{code:a}=t;if(s.end.includes(a)){this.handleEnd(t);return}if(s.cancel.includes(a)){this.handleCancel(t);return}const{collisionRect:i}=r.current,d=i?{x:i.left,y:i.top}:q;this.referenceCoordinates||(this.referenceCoordinates=d);const f=c(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=_e(f,d),g={x:0,y:0},{scrollableAncestors:R}=r.current;for(const v of R){const p=t.code,{isTop:m,isRight:w,isLeft:b,isBottom:S,maxScroll:C,minScroll:E}=on(v),x=ar(v),D={x:Math.min(p===y.Right?x.right-x.width/2:x.right,Math.max(p===y.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(p===y.Down?x.bottom-x.height/2:x.bottom,Math.max(p===y.Down?x.top:x.top+x.height/2,f.y))},M=p===y.Right&&!w||p===y.Left&&!b,I=p===y.Down&&!S||p===y.Up&&!m;if(M&&D.x!==f.x){const A=v.scrollLeft+h.x,W=p===y.Right&&A<=C.x||p===y.Left&&A>=E.x;if(W&&!h.y){v.scrollTo({left:A,behavior:l});return}W?g.x=v.scrollLeft-A:g.x=p===y.Right?v.scrollLeft-C.x:v.scrollLeft-E.x,g.x&&v.scrollBy({left:-g.x,behavior:l});break}else if(I&&D.y!==f.y){const A=v.scrollTop+h.y,W=p===y.Down&&A<=C.y||p===y.Up&&A>=E.y;if(W&&!h.x){v.scrollTo({top:A,behavior:l});return}W?g.y=v.scrollTop-A:g.y=p===y.Down?v.scrollTop-C.y:v.scrollTop-E.y,g.y&&v.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(t,we(_e(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}cn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=an,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Ft(e){return!!(e&&"distance"in e)}function $t(e){return!!(e&&"delay"in e)}class Rt{constructor(t,n,r){var o;r===void 0&&(r=fr(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:c}=s;this.props=t,this.events=n,this.document=De(c),this.documentListeners=new Ne(this.document),this.listeners=new Ne(r),this.windowListeners=new Ne(B(c)),this.initialCoordinates=(o=ht(s))!=null?o:q,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(H.Resize,this.handleCancel),this.windowListeners.add(H.DragStart,Bt),this.windowListeners.add(H.VisibilityChange,this.handleCancel),this.windowListeners.add(H.ContextMenu,Bt),this.documentListeners.add(H.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($t(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ft(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(H.Click,gr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(H.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:c,options:{activationConstraint:l}}=s;if(!o)return;const a=(n=ht(t))!=null?n:q,i=_e(o,a);if(!r&&l){if(Ft(l)){if(l.tolerance!=null&&dt(i,l.tolerance))return this.handleCancel();if(dt(i,l.distance))return this.handleStart()}if($t(l)&&dt(i,l.tolerance))return this.handleCancel();this.handlePending(l,i);return}t.cancelable&&t.preventDefault(),c(a)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===y.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const vr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ln extends Rt{constructor(t){const{event:n}=t,r=De(n.target);super(t,vr,r)}}ln.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const pr={move:{name:"mousemove"},end:{name:"mouseup"}};var pt;(function(e){e[e.RightClick=2]="RightClick"})(pt||(pt={}));class br extends Rt{constructor(t){super(t,pr,De(t.event.target))}}br.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===pt.RightClick?!1:(r?.({event:n}),!0)}}];const ft={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class yr extends Rt{constructor(t){super(t,ft)}static setup(){return window.addEventListener(ft.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ft.move.name,t)};function t(){}}}yr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Le;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Le||(Le={}));var Ze;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ze||(Ze={}));function mr(e){let{acceleration:t,activator:n=Le.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:l=Ze.TreeOrder,pointerCoordinates:a,scrollableAncestors:i,scrollableAncestorRects:d,delta:f,threshold:h}=e;const g=xr({delta:f,disabled:!s}),[R,v]=Ln(),p=u.useRef({x:0,y:0}),m=u.useRef({x:0,y:0}),w=u.useMemo(()=>{switch(n){case Le.Pointer:return a?{top:a.y,bottom:a.y,left:a.x,right:a.x}:null;case Le.DraggableRect:return o}},[n,o,a]),b=u.useRef(null),S=u.useCallback(()=>{const E=b.current;if(!E)return;const x=p.current.x*m.current.x,D=p.current.y*m.current.y;E.scrollBy(x,D)},[]),C=u.useMemo(()=>l===Ze.TreeOrder?[...i].reverse():i,[l,i]);u.useEffect(()=>{if(!s||!i.length||!w){v();return}for(const E of C){if(r?.(E)===!1)continue;const x=i.indexOf(E),D=d[x];if(!D)continue;const{direction:M,speed:I}=sr(E,D,w,t,h);for(const A of["x","y"])g[A][M[A]]||(I[A]=0,M[A]=0);if(I.x>0||I.y>0){v(),b.current=E,R(S,c),p.current=I,m.current=M;return}}p.current={x:0,y:0},m.current={x:0,y:0},v()},[t,S,r,v,s,c,JSON.stringify(w),JSON.stringify(g),R,i,C,d,JSON.stringify(h)])}const wr={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};function xr(e){let{delta:t,disabled:n}=e;const r=gt(t);return Fe(o=>{if(n||!r||!o)return wr;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:o.x[N.Backward]||s.x===-1,[N.Forward]:o.x[N.Forward]||s.x===1},y:{[N.Backward]:o.y[N.Backward]||s.y===-1,[N.Forward]:o.y[N.Forward]||s.y===1}}},[n,t,r])}function Dr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Rr(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var ze;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ze||(ze={}));var bt;(function(e){e.Optimized="optimized"})(bt||(bt={}));const Ut=new Map;function Sr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=u.useState(null),{frequency:l,measure:a,strategy:i}=o,d=u.useRef(e),f=p(),h=Pe(f),g=u.useCallback(function(m){m===void 0&&(m=[]),!h.current&&c(w=>w===null?m:w.concat(m.filter(b=>!w.includes(b))))},[h]),R=u.useRef(null),v=Fe(m=>{if(f&&!n)return Ut;if(!m||m===Ut||d.current!==e||s!=null){const w=new Map;for(let b of e){if(!b)continue;if(s&&s.length>0&&!s.includes(b.id)&&b.rect.current){w.set(b.id,b.rect.current);continue}const S=b.node.current,C=S?new Dt(a(S),S):null;b.rect.current=C,C&&w.set(b.id,C)}return w}return m},[e,s,n,f,a]);return u.useEffect(()=>{d.current=e},[e]),u.useEffect(()=>{f||g()},[n,f]),u.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),u.useEffect(()=>{f||typeof l!="number"||R.current!==null||(R.current=setTimeout(()=>{g(),R.current=null},l))},[l,f,g,...r]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:s!=null};function p(){switch(i){case ze.Always:return!1;case ze.BeforeDragging:return n;default:return!n}}}function un(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Cr(e,t){return un(e,t)}function Er(e){let{callback:t,disabled:n}=e;const r=wt(t),o=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return u.useEffect(()=>()=>o?.disconnect(),[o]),o}function rt(e){let{callback:t,disabled:n}=e;const r=wt(t),o=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return u.useEffect(()=>()=>o?.disconnect(),[o]),o}function Or(e){return new Dt(Re(e),e)}function Xt(e,t,n){t===void 0&&(t=Or);const[r,o]=u.useState(null);function s(){o(a=>{if(!e)return null;if(e.isConnected===!1){var i;return(i=a??n)!=null?i:null}const d=t(e);return JSON.stringify(a)===JSON.stringify(d)?a:d})}const c=Er({callback(a){if(e)for(const i of a){const{type:d,target:f}=i;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),l=rt({callback:s});return Z(()=>{s(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function Ar(e){const t=un(e);return Zt(e,t)}const Yt=[];function Mr(e){const t=u.useRef(e),n=Fe(r=>e?r&&r!==Yt&&e&&t.current&&e.parentNode===t.current.parentNode?r:nt(e):Yt,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function Tr(e){const[t,n]=u.useState(null),r=u.useRef(e),o=u.useCallback(s=>{const c=ut(s.target);c&&n(l=>l?(l.set(c,vt(c)),new Map(l)):null)},[]);return u.useEffect(()=>{const s=r.current;if(e!==s){c(s);const l=e.map(a=>{const i=ut(a);return i?(i.addEventListener("scroll",o,{passive:!0}),[i,vt(i)]):null}).filter(a=>a!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(s)};function c(l){l.forEach(a=>{const i=ut(a);i?.removeEventListener("scroll",o)})}},[o,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>we(s,c),q):sn(e):q,[e,t])}function jt(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const r=e!==q;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?_e(e,n.current):q}function Ir(e){u.useEffect(()=>{if(!tt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Nr(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function dn(e){return u.useMemo(()=>e?nr(e):null,[e])}const Ht=[];function Lr(e,t){t===void 0&&(t=Re);const[n]=e,r=dn(n?B(n):null),[o,s]=u.useState(Ht);function c(){s(()=>e.length?e.map(a=>rn(a)?r:new Dt(t(a),a)):Ht)}const l=rt({callback:c});return Z(()=>{l?.disconnect(),c(),e.forEach(a=>l?.observe(a))},[e]),o}function kr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Pr(e){let{measure:t}=e;const[n,r]=u.useState(null),o=u.useCallback(i=>{for(const{target:d}of i)if(Be(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),s=rt({callback:o}),c=u.useCallback(i=>{const d=kr(i);s?.disconnect(),d&&s?.observe(d),r(d?t(d):null)},[t,s]),[l,a]=Ge(c);return u.useMemo(()=>({nodeRef:l,rect:n,setRef:a}),[n,l,a])}const _r=[{sensor:ln,options:{}},{sensor:cn,options:{}}],zr={current:{}},Ve={draggable:{measure:zt},droppable:{measure:zt,strategy:ze.WhileDragging,frequency:bt.Optimized},dragOverlay:{measure:Re}};class ke extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Br={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ke,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ve,measureDroppableContainers:Qe,windowRect:null,measuringScheduled:!1},Fr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qe,draggableNodes:new Map,over:null,measureDroppableContainers:Qe},ot=u.createContext(Fr),fn=u.createContext(Br);function $r(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ke}}}function Ur(e,t){switch(t.type){case T.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case T.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case T.DragEnd:case T.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case T.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new ke(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case T.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new ke(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case T.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new ke(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Xr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=u.useContext(ot),s=gt(r),c=gt(n?.id);return u.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!xt(s)||document.activeElement===s.target)return;const l=o.get(c);if(!l)return;const{activatorNode:a,node:i}=l;if(!a.current&&!i.current)return;requestAnimationFrame(()=>{for(const d of[a.current,i.current]){if(!d)continue;const f=_n(d);if(f){f.focus();break}}})}},[r,t,o,c,s]),null}function Yr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function jr(e){return u.useMemo(()=>({draggable:{...Ve.draggable,...e?.draggable},droppable:{...Ve.droppable,...e?.droppable},dragOverlay:{...Ve.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Hr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=u.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;Z(()=>{if(!c&&!l||!t){s.current=!1;return}if(s.current||!r)return;const i=t?.node.current;if(!i||i.isConnected===!1)return;const d=n(i),f=Zt(d,r);if(c||(f.x=0),l||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=en(i);h&&h.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const gn=u.createContext({...q,scaleX:1,scaleY:1});var de;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(de||(de={}));const yo=u.memo(function(t){var n,r,o,s;let{id:c,accessibility:l,autoScroll:a=!0,children:i,sensors:d=_r,collisionDetection:f=Vn,measuring:h,modifiers:g,...R}=t;const v=u.useReducer(Ur,void 0,$r),[p,m]=v,[w,b]=Xn(),[S,C]=u.useState(de.Uninitialized),E=S===de.Initialized,{draggable:{active:x,nodes:D,translate:M},droppable:{containers:I}}=p,A=x!=null?D.get(x):null,W=u.useRef({initial:null,translated:null}),K=u.useMemo(()=>{var k;return x!=null?{id:x,data:(k=A?.data)!=null?k:zr,rect:W}:null},[x,A]),V=u.useRef(null),[Se,Ue]=u.useState(null),[F,Xe]=u.useState(null),ee=Pe(R,Object.values(R)),Ce=$e("DndDescribedBy",c),Ye=u.useMemo(()=>I.getEnabled(),[I]),_=jr(h),{droppableRects:te,measureDroppableContainers:fe,measuringScheduled:Ee}=Sr(Ye,{dragging:E,dependencies:[M.x,M.y],config:_.droppable}),Y=Dr(D,x),je=u.useMemo(()=>F?ht(F):null,[F]),ie=On(),ne=Cr(Y,_.draggable.measure);Hr({activeNode:x!=null?D.get(x):null,config:ie.layoutShiftCompensation,initialRect:ne,measure:_.draggable.measure});const O=Xt(Y,_.draggable.measure,ne),Oe=Xt(Y?Y.parentElement:null),G=u.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=I.getNodeFor((n=G.current.over)==null?void 0:n.id),re=Pr({measure:_.dragOverlay.measure}),he=(r=re.nodeRef.current)!=null?r:Y,ve=E?(o=re.rect)!=null?o:O:null,St=!!(re.nodeRef.current&&re.rect),Ct=Ar(St?null:O),it=dn(he?B(he):null),se=Mr(E?ge??Y:null),He=Lr(se),We=Yr(g,{transform:{x:M.x-Ct.x,y:M.y-Ct.y,scaleX:1,scaleY:1},activatorEvent:F,active:K,activeNodeRect:O,containerNodeRect:Oe,draggingNodeRect:ve,over:G.current.over,overlayNodeRect:re.rect,scrollableAncestors:se,scrollableAncestorRects:He,windowRect:it}),Et=je?we(je,M):null,Ot=Tr(se),wn=jt(Ot),xn=jt(Ot,[O]),pe=we(We,wn),be=ve?Qn(ve,We):null,Ae=K&&be?f({active:K,collisionRect:be,droppableRects:te,droppableContainers:Ye,pointerCoordinates:Et}):null,At=Qt(Ae,"id"),[ae,Mt]=u.useState(null),Dn=St?We:we(We,xn),Rn=Gn(Dn,(s=ae?.rect)!=null?s:null,O),st=u.useRef(null),Tt=u.useCallback((k,$)=>{let{sensor:U,options:ce}=$;if(V.current==null)return;const j=D.get(V.current);if(!j)return;const X=k.nativeEvent,J=new U({active:V.current,activeNode:j,event:X,options:ce,context:G,onAbort(L){if(!D.get(L))return;const{onDragAbort:Q}=ee.current,oe={id:L};Q?.(oe),w({type:"onDragAbort",event:oe})},onPending(L,le,Q,oe){if(!D.get(L))return;const{onDragPending:Te}=ee.current,ue={id:L,constraint:le,initialCoordinates:Q,offset:oe};Te?.(ue),w({type:"onDragPending",event:ue})},onStart(L){const le=V.current;if(le==null)return;const Q=D.get(le);if(!Q)return;const{onDragStart:oe}=ee.current,Me={activatorEvent:X,active:{id:le,data:Q.data,rect:W}};me.unstable_batchedUpdates(()=>{oe?.(Me),C(de.Initializing),m({type:T.DragStart,initialCoordinates:L,active:le}),w({type:"onDragStart",event:Me}),Ue(st.current),Xe(X)})},onMove(L){m({type:T.DragMove,coordinates:L})},onEnd:ye(T.DragEnd),onCancel:ye(T.DragCancel)});st.current=J;function ye(L){return async function(){const{active:Q,collisions:oe,over:Me,scrollAdjustedTranslate:Te}=G.current;let ue=null;if(Q&&Te){const{cancelDrop:Ie}=ee.current;ue={activatorEvent:X,active:Q,collisions:oe,delta:Te,over:Me},L===T.DragEnd&&typeof Ie=="function"&&await Promise.resolve(Ie(ue))&&(L=T.DragCancel)}V.current=null,me.unstable_batchedUpdates(()=>{m({type:L}),C(de.Uninitialized),Mt(null),Ue(null),Xe(null),st.current=null;const Ie=L===T.DragEnd?"onDragEnd":"onDragCancel";if(ue){const at=ee.current[Ie];at?.(ue),w({type:Ie,event:ue})}})}}},[D]),Sn=u.useCallback((k,$)=>(U,ce)=>{const j=U.nativeEvent,X=D.get(ce);if(V.current!==null||!X||j.dndKit||j.defaultPrevented)return;const J={active:X};k(U,$.options,J)===!0&&(j.dndKit={capturedBy:$.sensor},V.current=ce,Tt(U,$))},[D,Tt]),It=Rr(d,Sn);Ir(d),Z(()=>{O&&S===de.Initializing&&C(de.Initialized)},[O,S]),u.useEffect(()=>{const{onDragMove:k}=ee.current,{active:$,activatorEvent:U,collisions:ce,over:j}=G.current;if(!$||!U)return;const X={active:$,activatorEvent:U,collisions:ce,delta:{x:pe.x,y:pe.y},over:j};me.unstable_batchedUpdates(()=>{k?.(X),w({type:"onDragMove",event:X})})},[pe.x,pe.y]),u.useEffect(()=>{const{active:k,activatorEvent:$,collisions:U,droppableContainers:ce,scrollAdjustedTranslate:j}=G.current;if(!k||V.current==null||!$||!j)return;const{onDragOver:X}=ee.current,J=ce.get(At),ye=J&&J.rect.current?{id:J.id,rect:J.rect.current,data:J.data,disabled:J.disabled}:null,L={active:k,activatorEvent:$,collisions:U,delta:{x:j.x,y:j.y},over:ye};me.unstable_batchedUpdates(()=>{Mt(ye),X?.(L),w({type:"onDragOver",event:L})})},[At]),Z(()=>{G.current={activatorEvent:F,active:K,activeNode:Y,collisionRect:be,collisions:Ae,droppableRects:te,draggableNodes:D,draggingNode:he,draggingNodeRect:ve,droppableContainers:I,over:ae,scrollableAncestors:se,scrollAdjustedTranslate:pe},W.current={initial:ve,translated:be}},[K,Y,Ae,be,D,he,ve,te,I,ae,se,pe]),mr({...ie,delta:M,draggingRect:be,pointerCoordinates:Et,scrollableAncestors:se,scrollableAncestorRects:He});const Cn=u.useMemo(()=>({active:K,activeNode:Y,activeNodeRect:O,activatorEvent:F,collisions:Ae,containerNodeRect:Oe,dragOverlay:re,draggableNodes:D,droppableContainers:I,droppableRects:te,over:ae,measureDroppableContainers:fe,scrollableAncestors:se,scrollableAncestorRects:He,measuringConfiguration:_,measuringScheduled:Ee,windowRect:it}),[K,Y,O,F,Ae,Oe,re,D,I,te,ae,fe,se,He,_,Ee,it]),En=u.useMemo(()=>({activatorEvent:F,activators:It,active:K,activeNodeRect:O,ariaDescribedById:{draggable:Ce},dispatch:m,draggableNodes:D,over:ae,measureDroppableContainers:fe}),[F,It,K,O,m,Ce,D,ae,fe]);return z.createElement(Vt.Provider,{value:b},z.createElement(ot.Provider,{value:En},z.createElement(fn.Provider,{value:Cn},z.createElement(gn.Provider,{value:Rn},i)),z.createElement(Xr,{disabled:l?.restoreFocus===!1})),z.createElement(Hn,{...l,hiddenTextDescribedById:Ce}));function On(){const k=Se?.autoScrollEnabled===!1,$=typeof a=="object"?a.enabled===!1:a===!1,U=E&&!k&&!$;return typeof a=="object"?{...a,enabled:U}:{enabled:U}}}),Wr=u.createContext(null),Wt="button",Kr="Draggable";function qr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=$e(Kr),{activators:c,activatorEvent:l,active:a,activeNodeRect:i,ariaDescribedById:d,draggableNodes:f,over:h}=u.useContext(ot),{role:g=Wt,roleDescription:R="draggable",tabIndex:v=0}=o??{},p=a?.id===t,m=u.useContext(p?gn:Wr),[w,b]=Ge(),[S,C]=Ge(),E=Nr(c,t),x=Pe(n);Z(()=>(f.set(t,{id:t,key:s,node:w,activatorNode:S,data:x}),()=>{const M=f.get(t);M&&M.key===s&&f.delete(t)}),[f,t]);const D=u.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&g===Wt?!0:void 0,"aria-roledescription":R,"aria-describedby":d.draggable}),[r,g,v,p,R,d.draggable]);return{active:a,activatorEvent:l,activeNodeRect:i,attributes:D,isDragging:p,listeners:r?void 0:E,node:w,over:h,setNodeRef:b,setActivatorNodeRef:C,transform:m}}function Vr(){return u.useContext(fn)}const Gr="Droppable",Jr={timeout:25};function Qr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=$e(Gr),{active:c,dispatch:l,over:a,measureDroppableContainers:i}=u.useContext(ot),d=u.useRef({disabled:n}),f=u.useRef(!1),h=u.useRef(null),g=u.useRef(null),{disabled:R,updateMeasurementsFor:v,timeout:p}={...Jr,...o},m=Pe(v??r),w=u.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{i(Array.isArray(m.current)?m.current:[m.current]),g.current=null},p)},[p]),b=rt({callback:w,disabled:R||!c}),S=u.useCallback((D,M)=>{b&&(M&&(b.unobserve(M),f.current=!1),D&&b.observe(D))},[b]),[C,E]=Ge(S),x=Pe(t);return u.useEffect(()=>{!b||!C.current||(b.disconnect(),f.current=!1,b.observe(C.current))},[C,b]),u.useEffect(()=>(l({type:T.RegisterDroppable,element:{id:r,key:s,disabled:n,node:C,rect:h,data:x}}),()=>l({type:T.UnregisterDroppable,key:s,id:r})),[r]),u.useEffect(()=>{n!==d.current.disabled&&(l({type:T.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,l]),{active:c,rect:h,isOver:a?.id===r,node:C,over:a,setNodeRef:E}}function hn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Zr(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function Ke(e){return e!==null&&e>=0}function eo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function to(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const vn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=hn(t,r,n),c=t[o],l=s[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},qe={scaleX:1,scaleY:1},mo=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(o===n){const i=s[c];return i?{x:0,y:n<c?i.top+i.height-(l.top+l.height):i.top-l.top,...qe}:null}const a=no(s,o,n);return o>n&&o<=c?{x:0,y:-l.height-a,...qe}:o<n&&o>=c?{x:0,y:l.height+a,...qe}:{x:0,y:0,...qe}};function no(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const pn="Sortable",bn=z.createContext({activeIndex:-1,containerId:pn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:vn,disabled:{draggable:!1,droppable:!1}});function wo(e){let{children:t,id:n,items:r,strategy:o=vn,disabled:s=!1}=e;const{active:c,dragOverlay:l,droppableRects:a,over:i,measureDroppableContainers:d}=Vr(),f=$e(pn,n),h=l.rect!==null,g=u.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),R=c!=null,v=c?g.indexOf(c.id):-1,p=i?g.indexOf(i.id):-1,m=u.useRef(g),w=!eo(g,m.current),b=p!==-1&&v===-1||w,S=to(s);Z(()=>{w&&R&&d(g)},[w,g,R,d]),u.useEffect(()=>{m.current=g},[g]);const C=u.useMemo(()=>({activeIndex:v,containerId:f,disabled:S,disableTransforms:b,items:g,overIndex:p,useDragOverlay:h,sortedRects:Zr(g,a),strategy:o}),[v,f,S.draggable,S.droppable,b,g,p,a,h,o]);return z.createElement(bn.Provider,{value:C},t)}const ro=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return hn(n,r,o).indexOf(t)},oo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:l,previousContainerId:a,transition:i}=e;return!i||!r||l!==s&&o===c?!1:n?!0:c!==o&&t===a},io={duration:200,easing:"ease"},yn="transform",so=Je.Transition.toString({property:yn,duration:0,easing:"linear"}),ao={roleDescription:"sortable"};function co(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=u.useState(null),l=u.useRef(n);return Z(()=>{if(!t&&n!==l.current&&r.current){const a=o.current;if(a){const i=Re(r.current,{ignoreTransform:!0}),d={x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height};(d.x||d.y)&&c(d)}}n!==l.current&&(l.current=n)},[t,n,r,o]),u.useEffect(()=>{s&&c(null)},[s]),s}function xo(e){let{animateLayoutChanges:t=oo,attributes:n,disabled:r,data:o,getNewIndex:s=ro,id:c,strategy:l,resizeObserverConfig:a,transition:i=io}=e;const{items:d,containerId:f,activeIndex:h,disabled:g,disableTransforms:R,sortedRects:v,overIndex:p,useDragOverlay:m,strategy:w}=u.useContext(bn),b=lo(r,g),S=d.indexOf(c),C=u.useMemo(()=>({sortable:{containerId:f,index:S,items:d},...o}),[f,o,S,d]),E=u.useMemo(()=>d.slice(d.indexOf(c)),[d,c]),{rect:x,node:D,isOver:M,setNodeRef:I}=Qr({id:c,data:C,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...a}}),{active:A,activatorEvent:W,activeNodeRect:K,attributes:V,setNodeRef:Se,listeners:Ue,isDragging:F,over:Xe,setActivatorNodeRef:ee,transform:Ce}=qr({id:c,data:C,attributes:{...ao,...n},disabled:b.draggable}),Ye=Nn(I,Se),_=!!A,te=_&&!R&&Ke(h)&&Ke(p),fe=!m&&F,Ee=fe&&te?Ce:null,je=te?Ee??(l??w)({rects:v,activeNodeRect:K,activeIndex:h,overIndex:p,index:S}):null,ie=Ke(h)&&Ke(p)?s({id:c,items:d,activeIndex:h,overIndex:p}):S,ne=A?.id,O=u.useRef({activeId:ne,items:d,newIndex:ie,containerId:f}),Oe=d!==O.current.items,G=t({active:A,containerId:f,isDragging:F,isSorting:_,id:c,index:S,items:d,newIndex:O.current.newIndex,previousItems:O.current.items,previousContainerId:O.current.containerId,transition:i,wasDragging:O.current.activeId!=null}),ge=co({disabled:!G,index:S,node:D,rect:x});return u.useEffect(()=>{_&&O.current.newIndex!==ie&&(O.current.newIndex=ie),f!==O.current.containerId&&(O.current.containerId=f),d!==O.current.items&&(O.current.items=d)},[_,ie,f,d]),u.useEffect(()=>{if(ne===O.current.activeId)return;if(ne!=null&&O.current.activeId==null){O.current.activeId=ne;return}const he=setTimeout(()=>{O.current.activeId=ne},50);return()=>clearTimeout(he)},[ne]),{active:A,activeIndex:h,attributes:V,data:C,rect:x,index:S,newIndex:ie,items:d,isOver:M,isSorting:_,isDragging:F,listeners:Ue,node:D,overIndex:p,over:Xe,setNodeRef:Ye,setActivatorNodeRef:ee,setDroppableNodeRef:I,setDraggableNodeRef:Se,transform:ge??je,transition:re()};function re(){if(ge||Oe&&O.current.newIndex===S)return so;if(!(fe&&!xt(W)||!i)&&(_||G))return Je.Transition.toString({...i,property:yn})}}function lo(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function et(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const uo=[y.Down,y.Right,y.Up,y.Left],Do=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:s,over:c,scrollableAncestors:l}}=t;if(uo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const a=[];s.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=o.get(f.id);if(h)switch(e.code){case y.Down:r.top<h.top&&a.push(f);break;case y.Up:r.top>h.top&&a.push(f);break;case y.Left:r.left>h.left&&a.push(f);break;case y.Right:r.left<h.left&&a.push(f);break}});const i=Kn({collisionRect:r,droppableRects:o,droppableContainers:a});let d=Qt(i,"id");if(d===c?.id&&i.length>1&&(d=i[1].id),d!=null){const f=s.get(n.id),h=s.get(d),g=h?o.get(h.id):null,R=h?.node.current;if(R&&g&&f&&h){const p=nt(R).some((E,x)=>l[x]!==E),m=mn(f,h),w=fo(f,h),b=p||!m?{x:0,y:0}:{x:w?r.width-g.width:0,y:w?r.height-g.height:0},S={x:g.left,y:g.top};return b.x&&b.y?S:_e(S,b)}}}};function mn(e,t){return!et(e)||!et(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function fo(e,t){return!et(e)||!et(t)||!mn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Je as C,yo as D,cn as K,ln as P,ho as R,wo as S,me as a,vo as b,bo as c,hn as d,xo as e,In as r,Do as s,po as u,mo as v};
|