@nice2dev/ui-science 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +32 -32
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +753 -751
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var st = Object.defineProperty;
|
|
2
2
|
var at = (e, t, n) => t in e ? st(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var ve = (e, t, n) => at(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { jsx as o, jsxs as u, Fragment as
|
|
5
|
-
import { createContext as Ue, useContext as Ze, useState as
|
|
4
|
+
import { jsx as o, jsxs as u, Fragment as ze } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as Ue, useContext as Ze, useState as j, useCallback as P, useMemo as K, useRef as Ae, useEffect as Xe } from "react";
|
|
6
6
|
class lt {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
ve(this, "config");
|
|
@@ -131,10 +131,10 @@ class lt {
|
|
|
131
131
|
async searchEntries(t, n) {
|
|
132
132
|
var s, a, l, c, h, p;
|
|
133
133
|
const r = [], i = t.toLowerCase();
|
|
134
|
-
for (const
|
|
135
|
-
if (!(n != null && n.notebookId &&
|
|
136
|
-
for (const
|
|
137
|
-
n != null && n.type &&
|
|
134
|
+
for (const y of this.notebooks.values())
|
|
135
|
+
if (!(n != null && n.notebookId && y.id !== n.notebookId))
|
|
136
|
+
for (const m of y.entries)
|
|
137
|
+
n != null && n.type && m.type !== n.type || n != null && n.status && m.status !== n.status || (s = n == null ? void 0 : n.tags) != null && s.length && !n.tags.some(($) => m.tags.includes($)) || n != null && n.dateFrom && m.createdAt < n.dateFrom || n != null && n.dateTo && m.createdAt > n.dateTo || (m.title.toLowerCase().includes(i) || (a = m.objective) != null && a.toLowerCase().includes(i) || (l = m.hypothesis) != null && l.toLowerCase().includes(i) || (c = m.methods) != null && c.toLowerCase().includes(i) || (h = m.results) != null && h.toLowerCase().includes(i) || (p = m.conclusions) != null && p.toLowerCase().includes(i)) && r.push(m);
|
|
138
138
|
return r;
|
|
139
139
|
}
|
|
140
140
|
/** Export entry to PDF/HTML */
|
|
@@ -156,11 +156,11 @@ class lt {
|
|
|
156
156
|
<meta charset="utf-8">
|
|
157
157
|
<title>${t.title}</title>
|
|
158
158
|
<style>
|
|
159
|
-
body { font-family: 'Times New Roman', serif; max-width: 800px; margin: 0 auto; padding: 20px; }
|
|
160
|
-
h1 { border-bottom: 2px solid #333; }
|
|
161
|
-
.meta { color: #666; font-size: 0.9em; }
|
|
162
|
-
.section { margin: 20px 0; }
|
|
163
|
-
.signatures { border-top: 1px solid #ccc; margin-top: 40px; padding-top: 20px; }
|
|
159
|
+
body { font-family: 'Times New Roman', serif; max-width: 800px; margin: 0 auto; padding: var(--nice-space-5, 20px); }
|
|
160
|
+
h1 { border-bottom: 2px solid var(--nice-text, #333); }
|
|
161
|
+
.meta { color: var(--nice-text-secondary, #666); font-size: 0.9em; }
|
|
162
|
+
.section { margin: var(--nice-space-5, 20px) 0; }
|
|
163
|
+
.signatures { border-top: 1px solid var(--nice-border, #ccc); margin-top: var(--nice-space-10, 40px); padding-top: var(--nice-space-5, 20px); }
|
|
164
164
|
</style>
|
|
165
165
|
</head>
|
|
166
166
|
<body>
|
|
@@ -203,7 +203,7 @@ function Kt(e) {
|
|
|
203
203
|
return new lt(e);
|
|
204
204
|
}
|
|
205
205
|
const Ke = Ue(null);
|
|
206
|
-
function
|
|
206
|
+
function Te() {
|
|
207
207
|
const e = Ze(Ke);
|
|
208
208
|
if (!e)
|
|
209
209
|
throw new Error("useLabNotebook must be used within LabNotebookProvider");
|
|
@@ -213,7 +213,7 @@ function ct({
|
|
|
213
213
|
service: e,
|
|
214
214
|
children: t
|
|
215
215
|
}) {
|
|
216
|
-
const [n, r] =
|
|
216
|
+
const [n, r] = j([]), [i, s] = j(null), [a, l] = j(null), c = P(async () => {
|
|
217
217
|
const $ = await e.listNotebooks();
|
|
218
218
|
r($);
|
|
219
219
|
}, [e]), h = K(
|
|
@@ -222,30 +222,30 @@ function ct({
|
|
|
222
222
|
), p = K(
|
|
223
223
|
() => (h == null ? void 0 : h.entries.find(($) => $.id === a)) || null,
|
|
224
224
|
[h, a]
|
|
225
|
-
),
|
|
225
|
+
), y = P(($) => {
|
|
226
226
|
s($), l(null);
|
|
227
|
-
}, []),
|
|
227
|
+
}, []), m = {
|
|
228
228
|
service: e,
|
|
229
229
|
notebooks: n,
|
|
230
230
|
currentNotebook: h,
|
|
231
231
|
currentEntry: p,
|
|
232
|
-
setCurrentNotebook:
|
|
232
|
+
setCurrentNotebook: y,
|
|
233
233
|
setCurrentEntry: l,
|
|
234
234
|
refresh: c
|
|
235
235
|
};
|
|
236
|
-
return /* @__PURE__ */ o(Ke.Provider, { value:
|
|
236
|
+
return /* @__PURE__ */ o(Ke.Provider, { value: m, children: t });
|
|
237
237
|
}
|
|
238
238
|
const q = {
|
|
239
239
|
container: {
|
|
240
240
|
display: "flex",
|
|
241
241
|
height: "100%",
|
|
242
|
-
backgroundColor: "#f5f5f5",
|
|
242
|
+
backgroundColor: "var(--nice-bg-secondary, #f5f5f5)",
|
|
243
243
|
fontFamily: "'Inter', sans-serif"
|
|
244
244
|
},
|
|
245
245
|
sidebar: {
|
|
246
246
|
width: "280px",
|
|
247
|
-
backgroundColor: "#fff",
|
|
248
|
-
borderRight: "1px solid #e0e0e0",
|
|
247
|
+
backgroundColor: "var(--nice-bg, #fff)",
|
|
248
|
+
borderRight: "1px solid var(--nice-border, #e0e0e0)",
|
|
249
249
|
display: "flex",
|
|
250
250
|
flexDirection: "column"
|
|
251
251
|
},
|
|
@@ -257,8 +257,8 @@ const q = {
|
|
|
257
257
|
},
|
|
258
258
|
header: {
|
|
259
259
|
padding: "16px 24px",
|
|
260
|
-
borderBottom: "1px solid #e0e0e0",
|
|
261
|
-
backgroundColor: "#fff"
|
|
260
|
+
borderBottom: "1px solid var(--nice-border, #e0e0e0)",
|
|
261
|
+
backgroundColor: "var(--nice-bg, #fff)"
|
|
262
262
|
},
|
|
263
263
|
content: {
|
|
264
264
|
flex: 1,
|
|
@@ -267,7 +267,7 @@ const q = {
|
|
|
267
267
|
},
|
|
268
268
|
entryCard: {
|
|
269
269
|
padding: "12px 16px",
|
|
270
|
-
borderBottom: "1px solid #eee",
|
|
270
|
+
borderBottom: "1px solid var(--nice-border, #eee)",
|
|
271
271
|
cursor: "pointer",
|
|
272
272
|
transition: "background-color 0.15s"
|
|
273
273
|
},
|
|
@@ -282,14 +282,14 @@ const q = {
|
|
|
282
282
|
input: {
|
|
283
283
|
width: "100%",
|
|
284
284
|
padding: "8px 12px",
|
|
285
|
-
border: "1px solid #ddd",
|
|
285
|
+
border: "1px solid var(--nice-border, #ddd)",
|
|
286
286
|
borderRadius: "4px",
|
|
287
287
|
fontSize: "14px"
|
|
288
288
|
},
|
|
289
289
|
textarea: {
|
|
290
290
|
width: "100%",
|
|
291
291
|
padding: "12px",
|
|
292
|
-
border: "1px solid #ddd",
|
|
292
|
+
border: "1px solid var(--nice-border, #ddd)",
|
|
293
293
|
borderRadius: "4px",
|
|
294
294
|
fontSize: "14px",
|
|
295
295
|
minHeight: "100px",
|
|
@@ -297,20 +297,20 @@ const q = {
|
|
|
297
297
|
},
|
|
298
298
|
button: {
|
|
299
299
|
padding: "8px 16px",
|
|
300
|
-
backgroundColor: "#1976d2",
|
|
301
|
-
color: "#fff",
|
|
300
|
+
backgroundColor: "var(--nice-primary-hover, #1976d2)",
|
|
301
|
+
color: "var(--nice-bg, #fff)",
|
|
302
302
|
border: "none",
|
|
303
303
|
borderRadius: "4px",
|
|
304
304
|
cursor: "pointer",
|
|
305
305
|
fontSize: "14px"
|
|
306
306
|
}
|
|
307
307
|
}, Be = {
|
|
308
|
-
draft: "#9e9e9e",
|
|
309
|
-
"in-progress": "#2196f3",
|
|
310
|
-
completed: "#4caf50",
|
|
311
|
-
reviewed: "#ff9800",
|
|
312
|
-
signed: "#9c27b0",
|
|
313
|
-
locked: "#f44336"
|
|
308
|
+
draft: "var(--nice-text-secondary, #9e9e9e)",
|
|
309
|
+
"in-progress": "var(--nice-primary, #2196f3)",
|
|
310
|
+
completed: "var(--nice-success, #4caf50)",
|
|
311
|
+
reviewed: "var(--nice-warning, #ff9800)",
|
|
312
|
+
signed: "var(--nice-accent, #9c27b0)",
|
|
313
|
+
locked: "var(--nice-danger, #f44336)"
|
|
314
314
|
}, Je = {
|
|
315
315
|
experiment: "🧪",
|
|
316
316
|
protocol: "📋",
|
|
@@ -331,22 +331,22 @@ function Jt({
|
|
|
331
331
|
] }) });
|
|
332
332
|
}
|
|
333
333
|
function dt() {
|
|
334
|
-
const { notebooks: e, currentNotebook: t, setCurrentNotebook: n, service: r, refresh: i } =
|
|
334
|
+
const { notebooks: e, currentNotebook: t, setCurrentNotebook: n, service: r, refresh: i } = Te(), [s, a] = j(!1), [l, c] = j(""), h = async () => {
|
|
335
335
|
l.trim() && (await r.createNotebook({ name: l.trim() }), await i(), c(""), a(!1));
|
|
336
336
|
};
|
|
337
337
|
return /* @__PURE__ */ u("div", { style: q.sidebar, children: [
|
|
338
|
-
/* @__PURE__ */ o("div", { style: { padding: "16px", borderBottom: "1px solid #e0e0e0" }, children: /* @__PURE__ */ o("h2", { style: { margin: 0, fontSize: "18px" }, children: "📓 Lab Notebooks" }) }),
|
|
338
|
+
/* @__PURE__ */ o("div", { style: { padding: "16px", borderBottom: "1px solid var(--nice-border, #e0e0e0)" }, children: /* @__PURE__ */ o("h2", { style: { margin: 0, fontSize: "18px" }, children: "📓 Lab Notebooks" }) }),
|
|
339
339
|
/* @__PURE__ */ o("div", { style: { flex: 1, overflow: "auto" }, children: e.map((p) => /* @__PURE__ */ u(
|
|
340
340
|
"div",
|
|
341
341
|
{
|
|
342
342
|
onClick: () => n(p.id),
|
|
343
343
|
style: {
|
|
344
344
|
...q.entryCard,
|
|
345
|
-
backgroundColor: (t == null ? void 0 : t.id) === p.id ? "#e3f2fd" : "transparent"
|
|
345
|
+
backgroundColor: (t == null ? void 0 : t.id) === p.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
|
|
346
346
|
},
|
|
347
347
|
children: [
|
|
348
348
|
/* @__PURE__ */ o("div", { style: { fontWeight: 500 }, children: p.name }),
|
|
349
|
-
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "#666", marginTop: "4px" }, children: [
|
|
349
|
+
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)", marginTop: "4px" }, children: [
|
|
350
350
|
p.entries.length,
|
|
351
351
|
" entries"
|
|
352
352
|
] })
|
|
@@ -354,7 +354,7 @@ function dt() {
|
|
|
354
354
|
},
|
|
355
355
|
p.id
|
|
356
356
|
)) }),
|
|
357
|
-
/* @__PURE__ */ o("div", { style: { padding: "16px", borderTop: "1px solid #e0e0e0" }, children: s ? /* @__PURE__ */ u("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
357
|
+
/* @__PURE__ */ o("div", { style: { padding: "16px", borderTop: "1px solid var(--nice-border, #e0e0e0)" }, children: s ? /* @__PURE__ */ u("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
358
358
|
/* @__PURE__ */ o(
|
|
359
359
|
"input",
|
|
360
360
|
{
|
|
@@ -372,7 +372,7 @@ function dt() {
|
|
|
372
372
|
"button",
|
|
373
373
|
{
|
|
374
374
|
onClick: () => a(!1),
|
|
375
|
-
style: { ...q.button, backgroundColor: "#9e9e9e" },
|
|
375
|
+
style: { ...q.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
|
|
376
376
|
children: "Cancel"
|
|
377
377
|
}
|
|
378
378
|
)
|
|
@@ -381,9 +381,9 @@ function dt() {
|
|
|
381
381
|
] });
|
|
382
382
|
}
|
|
383
383
|
function ut() {
|
|
384
|
-
const { currentNotebook: e, currentEntry: t, setCurrentEntry: n, service: r, refresh: i } =
|
|
384
|
+
const { currentNotebook: e, currentEntry: t, setCurrentEntry: n, service: r, refresh: i } = Te(), [s, a] = j(!1);
|
|
385
385
|
if (!e)
|
|
386
|
-
return /* @__PURE__ */ o("div", { style: { ...q.main, justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ u("div", { style: { textAlign: "center", color: "#666" }, children: [
|
|
386
|
+
return /* @__PURE__ */ o("div", { style: { ...q.main, justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ u("div", { style: { textAlign: "center", color: "var(--nice-text-secondary, #666)" }, children: [
|
|
387
387
|
/* @__PURE__ */ o("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "📓" }),
|
|
388
388
|
/* @__PURE__ */ o("div", { style: { fontSize: "18px" }, children: "Select a notebook to get started" })
|
|
389
389
|
] }) });
|
|
@@ -397,13 +397,13 @@ function ut() {
|
|
|
397
397
|
/* @__PURE__ */ o("button", { onClick: () => a(!0), style: q.button, children: "+ New Entry" })
|
|
398
398
|
] }) }),
|
|
399
399
|
/* @__PURE__ */ u("div", { style: { display: "flex", flex: 1, overflow: "hidden" }, children: [
|
|
400
|
-
/* @__PURE__ */ o("div", { style: { width: "300px", borderRight: "1px solid #e0e0e0", overflow: "auto" }, children: e.entries.map((c) => /* @__PURE__ */ u(
|
|
400
|
+
/* @__PURE__ */ o("div", { style: { width: "300px", borderRight: "1px solid var(--nice-border, #e0e0e0)", overflow: "auto" }, children: e.entries.map((c) => /* @__PURE__ */ u(
|
|
401
401
|
"div",
|
|
402
402
|
{
|
|
403
403
|
onClick: () => n(c.id),
|
|
404
404
|
style: {
|
|
405
405
|
...q.entryCard,
|
|
406
|
-
backgroundColor: (t == null ? void 0 : t.id) === c.id ? "#e3f2fd" : "transparent"
|
|
406
|
+
backgroundColor: (t == null ? void 0 : t.id) === c.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
|
|
407
407
|
},
|
|
408
408
|
children: [
|
|
409
409
|
/* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
@@ -422,18 +422,18 @@ function ut() {
|
|
|
422
422
|
children: c.status
|
|
423
423
|
}
|
|
424
424
|
),
|
|
425
|
-
/* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: new Date(c.updatedAt).toLocaleDateString() })
|
|
425
|
+
/* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: new Date(c.updatedAt).toLocaleDateString() })
|
|
426
426
|
] })
|
|
427
427
|
]
|
|
428
428
|
},
|
|
429
429
|
c.id
|
|
430
430
|
)) }),
|
|
431
|
-
/* @__PURE__ */ o("div", { style: q.content, children: t ? /* @__PURE__ */ o(ht, { entry: t }) : s ? /* @__PURE__ */ o(pt, { onSubmit: l, onCancel: () => a(!1) }) : /* @__PURE__ */ o("div", { style: { textAlign: "center", color: "#666", marginTop: "100px" }, children: "Select an entry or create a new one" }) })
|
|
431
|
+
/* @__PURE__ */ o("div", { style: q.content, children: t ? /* @__PURE__ */ o(ht, { entry: t }) : s ? /* @__PURE__ */ o(pt, { onSubmit: l, onCancel: () => a(!1) }) : /* @__PURE__ */ o("div", { style: { textAlign: "center", color: "var(--nice-text-secondary, #666)", marginTop: "100px" }, children: "Select an entry or create a new one" }) })
|
|
432
432
|
] })
|
|
433
433
|
] });
|
|
434
434
|
}
|
|
435
435
|
function ht({ entry: e }) {
|
|
436
|
-
const { service: t, currentNotebook: n, refresh: r } =
|
|
436
|
+
const { service: t, currentNotebook: n, refresh: r } = Te(), [i, s] = j(!1), [a, l] = j(e), c = e.status === "locked" || e.status === "signed", h = async () => {
|
|
437
437
|
n && (await t.updateEntry(n.id, e.id, a), await r(), s(!1));
|
|
438
438
|
}, p = async () => {
|
|
439
439
|
n && (await t.signEntry(n.id, e.id, {
|
|
@@ -467,13 +467,13 @@ function ht({ entry: e }) {
|
|
|
467
467
|
children: e.status
|
|
468
468
|
}
|
|
469
469
|
),
|
|
470
|
-
/* @__PURE__ */ u("span", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
470
|
+
/* @__PURE__ */ u("span", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: [
|
|
471
471
|
"v",
|
|
472
472
|
e.version
|
|
473
473
|
] })
|
|
474
474
|
] })
|
|
475
475
|
] }),
|
|
476
|
-
!c && /* @__PURE__ */ o("div", { style: { display: "flex", gap: "8px" }, children: i ? /* @__PURE__ */ u(
|
|
476
|
+
!c && /* @__PURE__ */ o("div", { style: { display: "flex", gap: "8px" }, children: i ? /* @__PURE__ */ u(ze, { children: [
|
|
477
477
|
/* @__PURE__ */ o("button", { onClick: h, style: q.button, children: "Save" }),
|
|
478
478
|
/* @__PURE__ */ o(
|
|
479
479
|
"button",
|
|
@@ -481,17 +481,17 @@ function ht({ entry: e }) {
|
|
|
481
481
|
onClick: () => {
|
|
482
482
|
s(!1), l(e);
|
|
483
483
|
},
|
|
484
|
-
style: { ...q.button, backgroundColor: "#9e9e9e" },
|
|
484
|
+
style: { ...q.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
|
|
485
485
|
children: "Cancel"
|
|
486
486
|
}
|
|
487
487
|
)
|
|
488
|
-
] }) : /* @__PURE__ */ u(
|
|
488
|
+
] }) : /* @__PURE__ */ u(ze, { children: [
|
|
489
489
|
/* @__PURE__ */ o("button", { onClick: () => s(!0), style: q.button, children: "Edit" }),
|
|
490
490
|
/* @__PURE__ */ o(
|
|
491
491
|
"button",
|
|
492
492
|
{
|
|
493
493
|
onClick: p,
|
|
494
|
-
style: { ...q.button, backgroundColor: "#9c27b0" },
|
|
494
|
+
style: { ...q.button, backgroundColor: "var(--nice-accent, #9c27b0)" },
|
|
495
495
|
children: "Sign"
|
|
496
496
|
}
|
|
497
497
|
)
|
|
@@ -507,7 +507,7 @@ function ht({ entry: e }) {
|
|
|
507
507
|
{
|
|
508
508
|
type: "text",
|
|
509
509
|
value: a.title,
|
|
510
|
-
onChange: (
|
|
510
|
+
onChange: (y) => l({ ...a, title: y.target.value }),
|
|
511
511
|
style: q.input
|
|
512
512
|
}
|
|
513
513
|
)
|
|
@@ -518,7 +518,7 @@ function ht({ entry: e }) {
|
|
|
518
518
|
"textarea",
|
|
519
519
|
{
|
|
520
520
|
value: a.objective || "",
|
|
521
|
-
onChange: (
|
|
521
|
+
onChange: (y) => l({ ...a, objective: y.target.value }),
|
|
522
522
|
style: q.textarea
|
|
523
523
|
}
|
|
524
524
|
)
|
|
@@ -529,7 +529,7 @@ function ht({ entry: e }) {
|
|
|
529
529
|
"textarea",
|
|
530
530
|
{
|
|
531
531
|
value: a.methods || "",
|
|
532
|
-
onChange: (
|
|
532
|
+
onChange: (y) => l({ ...a, methods: y.target.value }),
|
|
533
533
|
style: q.textarea
|
|
534
534
|
}
|
|
535
535
|
)
|
|
@@ -540,7 +540,7 @@ function ht({ entry: e }) {
|
|
|
540
540
|
"textarea",
|
|
541
541
|
{
|
|
542
542
|
value: a.results || "",
|
|
543
|
-
onChange: (
|
|
543
|
+
onChange: (y) => l({ ...a, results: y.target.value }),
|
|
544
544
|
style: q.textarea
|
|
545
545
|
}
|
|
546
546
|
)
|
|
@@ -551,72 +551,72 @@ function ht({ entry: e }) {
|
|
|
551
551
|
"textarea",
|
|
552
552
|
{
|
|
553
553
|
value: a.conclusions || "",
|
|
554
|
-
onChange: (
|
|
554
|
+
onChange: (y) => l({ ...a, conclusions: y.target.value }),
|
|
555
555
|
style: q.textarea
|
|
556
556
|
}
|
|
557
557
|
)
|
|
558
558
|
] })
|
|
559
559
|
] }) : /* @__PURE__ */ u("div", { style: { display: "flex", flexDirection: "column", gap: "24px" }, children: [
|
|
560
560
|
e.objective && /* @__PURE__ */ u("section", { children: [
|
|
561
|
-
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "#1976d2" }, children: "Objective" }),
|
|
561
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "var(--nice-primary-hover, #1976d2)" }, children: "Objective" }),
|
|
562
562
|
/* @__PURE__ */ o("p", { style: { margin: 0, whiteSpace: "pre-wrap" }, children: e.objective })
|
|
563
563
|
] }),
|
|
564
564
|
e.hypothesis && /* @__PURE__ */ u("section", { children: [
|
|
565
|
-
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "#1976d2" }, children: "Hypothesis" }),
|
|
565
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "var(--nice-primary-hover, #1976d2)" }, children: "Hypothesis" }),
|
|
566
566
|
/* @__PURE__ */ o("p", { style: { margin: 0, whiteSpace: "pre-wrap" }, children: e.hypothesis })
|
|
567
567
|
] }),
|
|
568
568
|
e.methods && /* @__PURE__ */ u("section", { children: [
|
|
569
|
-
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "#1976d2" }, children: "Methods" }),
|
|
569
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "var(--nice-primary-hover, #1976d2)" }, children: "Methods" }),
|
|
570
570
|
/* @__PURE__ */ o("p", { style: { margin: 0, whiteSpace: "pre-wrap" }, children: e.methods })
|
|
571
571
|
] }),
|
|
572
572
|
e.results && /* @__PURE__ */ u("section", { children: [
|
|
573
|
-
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "#1976d2" }, children: "Results" }),
|
|
573
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "var(--nice-primary-hover, #1976d2)" }, children: "Results" }),
|
|
574
574
|
/* @__PURE__ */ o("p", { style: { margin: 0, whiteSpace: "pre-wrap" }, children: e.results })
|
|
575
575
|
] }),
|
|
576
576
|
e.conclusions && /* @__PURE__ */ u("section", { children: [
|
|
577
|
-
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "#1976d2" }, children: "Conclusions" }),
|
|
577
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "var(--nice-primary-hover, #1976d2)" }, children: "Conclusions" }),
|
|
578
578
|
/* @__PURE__ */ o("p", { style: { margin: 0, whiteSpace: "pre-wrap" }, children: e.conclusions })
|
|
579
579
|
] }),
|
|
580
580
|
e.signatures.length > 0 && /* @__PURE__ */ u("section", { children: [
|
|
581
|
-
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "#9c27b0" }, children: "Signatures" }),
|
|
582
|
-
e.signatures.map((
|
|
581
|
+
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0", color: "var(--nice-accent, #9c27b0)" }, children: "Signatures" }),
|
|
582
|
+
e.signatures.map((y, m) => /* @__PURE__ */ u(
|
|
583
583
|
"div",
|
|
584
584
|
{
|
|
585
585
|
style: {
|
|
586
586
|
padding: "8px",
|
|
587
|
-
backgroundColor: "#f5f5f5",
|
|
587
|
+
backgroundColor: "var(--nice-bg-secondary, #f5f5f5)",
|
|
588
588
|
borderRadius: "4px",
|
|
589
589
|
marginBottom: "8px"
|
|
590
590
|
},
|
|
591
591
|
children: [
|
|
592
|
-
/* @__PURE__ */ o("strong", { children:
|
|
592
|
+
/* @__PURE__ */ o("strong", { children: y.userName }),
|
|
593
593
|
" (",
|
|
594
|
-
|
|
594
|
+
y.role,
|
|
595
595
|
")",
|
|
596
|
-
/* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "#666" }, children: new Date(
|
|
596
|
+
/* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: new Date(y.signedAt).toLocaleString() })
|
|
597
597
|
]
|
|
598
598
|
},
|
|
599
|
-
|
|
599
|
+
m
|
|
600
600
|
))
|
|
601
601
|
] }),
|
|
602
602
|
e.attachments.length > 0 && /* @__PURE__ */ u("section", { children: [
|
|
603
603
|
/* @__PURE__ */ o("h3", { style: { margin: "0 0 8px 0" }, children: "Attachments" }),
|
|
604
|
-
e.attachments.map((
|
|
604
|
+
e.attachments.map((y) => /* @__PURE__ */ u(
|
|
605
605
|
"a",
|
|
606
606
|
{
|
|
607
|
-
href:
|
|
607
|
+
href: y.url,
|
|
608
608
|
target: "_blank",
|
|
609
609
|
rel: "noopener noreferrer",
|
|
610
|
-
style: { display: "block", color: "#1976d2", textDecoration: "none" },
|
|
610
|
+
style: { display: "block", color: "var(--nice-primary-hover, #1976d2)", textDecoration: "none" },
|
|
611
611
|
children: [
|
|
612
612
|
"📎 ",
|
|
613
|
-
|
|
613
|
+
y.name,
|
|
614
614
|
" (",
|
|
615
|
-
(
|
|
615
|
+
(y.size / 1024).toFixed(1),
|
|
616
616
|
" KB)"
|
|
617
617
|
]
|
|
618
618
|
},
|
|
619
|
-
|
|
619
|
+
y.id
|
|
620
620
|
))
|
|
621
621
|
] })
|
|
622
622
|
] })
|
|
@@ -626,7 +626,7 @@ function pt({
|
|
|
626
626
|
onSubmit: e,
|
|
627
627
|
onCancel: t
|
|
628
628
|
}) {
|
|
629
|
-
const [n, r] =
|
|
629
|
+
const [n, r] = j({
|
|
630
630
|
title: "",
|
|
631
631
|
type: "experiment",
|
|
632
632
|
objective: ""
|
|
@@ -685,7 +685,7 @@ function pt({
|
|
|
685
685
|
{
|
|
686
686
|
type: "button",
|
|
687
687
|
onClick: t,
|
|
688
|
-
style: { ...q.button, backgroundColor: "#9e9e9e" },
|
|
688
|
+
style: { ...q.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
|
|
689
689
|
children: "Cancel"
|
|
690
690
|
}
|
|
691
691
|
)
|
|
@@ -802,15 +802,15 @@ const $e = {
|
|
|
802
802
|
const w = l * e[$] + c;
|
|
803
803
|
h += Math.pow(t[$] - i, 2), p += Math.pow(t[$] - w, 2);
|
|
804
804
|
}
|
|
805
|
-
const
|
|
806
|
-
return { slope: l, intercept: c, r2:
|
|
805
|
+
const y = 1 - p / h, m = `y = ${l.toFixed(4)}x + ${c.toFixed(4)}`;
|
|
806
|
+
return { slope: l, intercept: c, r2: y, equation: m };
|
|
807
807
|
},
|
|
808
808
|
/** T-test (two-sample) */
|
|
809
809
|
tTest(e, t) {
|
|
810
|
-
const n = e.length, r = t.length, i = this.mean(e), s = this.mean(t), a = this.variance(e), l = this.variance(t), c = Math.sqrt(a / n + l / r), h = (i - s) / c, p = Math.pow(a / n + l / r, 2) / (Math.pow(a / n, 2) / (n - 1) + Math.pow(l / r, 2) / (r - 1)),
|
|
810
|
+
const n = e.length, r = t.length, i = this.mean(e), s = this.mean(t), a = this.variance(e), l = this.variance(t), c = Math.sqrt(a / n + l / r), h = (i - s) / c, p = Math.pow(a / n + l / r, 2) / (Math.pow(a / n, 2) / (n - 1) + Math.pow(l / r, 2) / (r - 1)), y = 2 * (1 - this.normalCDF(Math.abs(h)));
|
|
811
811
|
return {
|
|
812
812
|
tStatistic: h,
|
|
813
|
-
pValue:
|
|
813
|
+
pValue: y,
|
|
814
814
|
degreesOfFreedom: p,
|
|
815
815
|
meanDiff: i - s
|
|
816
816
|
};
|
|
@@ -878,21 +878,21 @@ class ft {
|
|
|
878
878
|
/** Import data from CSV */
|
|
879
879
|
async importCSV(t, n) {
|
|
880
880
|
const r = (n == null ? void 0 : n.delimiter) || ",", i = (n == null ? void 0 : n.header) !== !1, s = t.split(`
|
|
881
|
-
`).filter((
|
|
881
|
+
`).filter((m) => m.trim());
|
|
882
882
|
if (s.length === 0)
|
|
883
883
|
throw new Error("Empty CSV content");
|
|
884
|
-
const a = (
|
|
884
|
+
const a = (m) => {
|
|
885
885
|
const $ = [];
|
|
886
|
-
let w = "",
|
|
887
|
-
for (const J of
|
|
888
|
-
J === '"' ?
|
|
886
|
+
let w = "", F = !1;
|
|
887
|
+
for (const J of m)
|
|
888
|
+
J === '"' ? F = !F : J === r && !F ? ($.push(w.trim()), w = "") : w += J;
|
|
889
889
|
return $.push(w.trim()), $;
|
|
890
|
-
}, l = a(s[0]), c = i ? l : l.map((
|
|
891
|
-
for (let
|
|
892
|
-
const $ = a(s[
|
|
893
|
-
for (let
|
|
894
|
-
const J = $[
|
|
895
|
-
w[c[
|
|
890
|
+
}, l = a(s[0]), c = i ? l : l.map((m, $) => `col_${$ + 1}`), h = i ? 1 : 0, p = [];
|
|
891
|
+
for (let m = h; m < s.length; m++) {
|
|
892
|
+
const $ = a(s[m]), w = {};
|
|
893
|
+
for (let F = 0; F < c.length; F++) {
|
|
894
|
+
const J = $[F], te = parseFloat(J);
|
|
895
|
+
w[c[F]] = !isNaN(te) && J !== "" ? te : J;
|
|
896
896
|
}
|
|
897
897
|
p.push(w);
|
|
898
898
|
}
|
|
@@ -946,7 +946,7 @@ class ft {
|
|
|
946
946
|
missing: s.length - a.length
|
|
947
947
|
};
|
|
948
948
|
if (c === "number") {
|
|
949
|
-
const p = a.filter((
|
|
949
|
+
const p = a.filter((y) => typeof y == "number");
|
|
950
950
|
h.stats = $e.describe(p);
|
|
951
951
|
}
|
|
952
952
|
r.push(h);
|
|
@@ -1029,12 +1029,12 @@ class ft {
|
|
|
1029
1029
|
return $e.tTest(s.get(a[0]), s.get(a[1]));
|
|
1030
1030
|
}
|
|
1031
1031
|
distributionAnalysis(t, n) {
|
|
1032
|
-
const { column: r, bins: i = 10 } = n, s = t.data.map((
|
|
1033
|
-
for (let
|
|
1034
|
-
p.push(a +
|
|
1035
|
-
for (const
|
|
1036
|
-
const
|
|
1037
|
-
h[
|
|
1032
|
+
const { column: r, bins: i = 10 } = n, s = t.data.map((y) => y[r]).filter((y) => typeof y == "number"), a = Math.min(...s), c = (Math.max(...s) - a) / i, h = new Array(i).fill(0), p = [];
|
|
1033
|
+
for (let y = 0; y <= i; y++)
|
|
1034
|
+
p.push(a + y * c);
|
|
1035
|
+
for (const y of s) {
|
|
1036
|
+
const m = Math.min(Math.floor((y - a) / c), i - 1);
|
|
1037
|
+
h[m]++;
|
|
1038
1038
|
}
|
|
1039
1039
|
return {
|
|
1040
1040
|
histogram: h,
|
|
@@ -1167,14 +1167,14 @@ function Qt({
|
|
|
1167
1167
|
className: t,
|
|
1168
1168
|
style: n
|
|
1169
1169
|
}) {
|
|
1170
|
-
const [r, i] =
|
|
1170
|
+
const [r, i] = j([]), [s, a] = j(null), [l, c] = j("data"), h = P(() => {
|
|
1171
1171
|
i(e.listDatasets());
|
|
1172
1172
|
}, [e]), p = K(
|
|
1173
|
-
() => r.find((
|
|
1173
|
+
() => r.find((m) => m.id === s),
|
|
1174
1174
|
[r, s]
|
|
1175
|
-
),
|
|
1176
|
-
var
|
|
1177
|
-
const $ = (
|
|
1175
|
+
), y = async (m) => {
|
|
1176
|
+
var F;
|
|
1177
|
+
const $ = (F = m.target.files) == null ? void 0 : F[0];
|
|
1178
1178
|
if (!$)
|
|
1179
1179
|
return;
|
|
1180
1180
|
const w = await $.text();
|
|
@@ -1197,7 +1197,7 @@ function Qt({
|
|
|
1197
1197
|
{
|
|
1198
1198
|
style: {
|
|
1199
1199
|
padding: "12px 16px",
|
|
1200
|
-
borderBottom: "1px solid #e0e0e0",
|
|
1200
|
+
borderBottom: "1px solid var(--nice-border, #e0e0e0)",
|
|
1201
1201
|
display: "flex",
|
|
1202
1202
|
gap: "12px",
|
|
1203
1203
|
alignItems: "center"
|
|
@@ -1208,7 +1208,7 @@ function Qt({
|
|
|
1208
1208
|
{
|
|
1209
1209
|
style: {
|
|
1210
1210
|
padding: "8px 16px",
|
|
1211
|
-
backgroundColor: "#1976d2",
|
|
1211
|
+
backgroundColor: "var(--nice-primary-hover, #1976d2)",
|
|
1212
1212
|
color: "white",
|
|
1213
1213
|
borderRadius: "4px",
|
|
1214
1214
|
cursor: "pointer"
|
|
@@ -1220,7 +1220,7 @@ function Qt({
|
|
|
1220
1220
|
{
|
|
1221
1221
|
type: "file",
|
|
1222
1222
|
accept: ".csv,.json",
|
|
1223
|
-
onChange:
|
|
1223
|
+
onChange: y,
|
|
1224
1224
|
style: { display: "none" }
|
|
1225
1225
|
}
|
|
1226
1226
|
)
|
|
@@ -1231,40 +1231,40 @@ function Qt({
|
|
|
1231
1231
|
"select",
|
|
1232
1232
|
{
|
|
1233
1233
|
value: s || "",
|
|
1234
|
-
onChange: (
|
|
1235
|
-
style: { padding: "8px 12px", borderRadius: "4px", border: "1px solid #ddd" },
|
|
1234
|
+
onChange: (m) => a(m.target.value || null),
|
|
1235
|
+
style: { padding: "8px 12px", borderRadius: "4px", border: "1px solid var(--nice-border, #ddd)" },
|
|
1236
1236
|
children: [
|
|
1237
1237
|
/* @__PURE__ */ o("option", { value: "", children: "Select dataset..." }),
|
|
1238
|
-
r.map((
|
|
1239
|
-
|
|
1238
|
+
r.map((m) => /* @__PURE__ */ u("option", { value: m.id, children: [
|
|
1239
|
+
m.name,
|
|
1240
1240
|
" (",
|
|
1241
|
-
|
|
1241
|
+
m.rowCount,
|
|
1242
1242
|
" rows)"
|
|
1243
|
-
] },
|
|
1243
|
+
] }, m.id))
|
|
1244
1244
|
]
|
|
1245
1245
|
}
|
|
1246
1246
|
),
|
|
1247
|
-
p && /* @__PURE__ */ o("div", { style: { marginLeft: "auto", display: "flex", gap: "8px" }, children: ["data", "stats", "analysis"].map((
|
|
1247
|
+
p && /* @__PURE__ */ o("div", { style: { marginLeft: "auto", display: "flex", gap: "8px" }, children: ["data", "stats", "analysis"].map((m) => /* @__PURE__ */ o(
|
|
1248
1248
|
"button",
|
|
1249
1249
|
{
|
|
1250
|
-
onClick: () => c(
|
|
1250
|
+
onClick: () => c(m),
|
|
1251
1251
|
style: {
|
|
1252
1252
|
padding: "8px 16px",
|
|
1253
|
-
backgroundColor: l ===
|
|
1254
|
-
color: l ===
|
|
1255
|
-
border: "1px solid #ddd",
|
|
1253
|
+
backgroundColor: l === m ? "var(--nice-primary-hover, #1976d2)" : "transparent",
|
|
1254
|
+
color: l === m ? "white" : "var(--nice-text, #333)",
|
|
1255
|
+
border: "1px solid var(--nice-border, #ddd)",
|
|
1256
1256
|
borderRadius: "4px",
|
|
1257
1257
|
cursor: "pointer",
|
|
1258
1258
|
textTransform: "capitalize"
|
|
1259
1259
|
},
|
|
1260
|
-
children:
|
|
1260
|
+
children: m
|
|
1261
1261
|
},
|
|
1262
|
-
|
|
1262
|
+
m
|
|
1263
1263
|
)) })
|
|
1264
1264
|
]
|
|
1265
1265
|
}
|
|
1266
1266
|
),
|
|
1267
|
-
/* @__PURE__ */ o("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: p ? l === "data" ? /* @__PURE__ */ o(
|
|
1267
|
+
/* @__PURE__ */ o("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: p ? l === "data" ? /* @__PURE__ */ o(yt, { dataset: p }) : l === "stats" ? /* @__PURE__ */ o(mt, { dataset: p }) : /* @__PURE__ */ o(gt, { dataset: p, service: e }) : /* @__PURE__ */ u("div", { style: { textAlign: "center", color: "var(--nice-text-secondary, #666)", padding: "48px" }, children: [
|
|
1268
1268
|
/* @__PURE__ */ o("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "📊" }),
|
|
1269
1269
|
/* @__PURE__ */ o("div", { style: { fontSize: "18px" }, children: "Import a dataset or select an existing one to begin" })
|
|
1270
1270
|
] }) })
|
|
@@ -1272,27 +1272,27 @@ function Qt({
|
|
|
1272
1272
|
}
|
|
1273
1273
|
);
|
|
1274
1274
|
}
|
|
1275
|
-
function
|
|
1276
|
-
const [t, n] =
|
|
1275
|
+
function yt({ dataset: e }) {
|
|
1276
|
+
const [t, n] = j(0), r = 50, i = Math.ceil(e.rowCount / r), s = e.data.slice(t * r, (t + 1) * r);
|
|
1277
1277
|
return /* @__PURE__ */ u("div", { children: [
|
|
1278
1278
|
/* @__PURE__ */ o("div", { style: { overflowX: "auto", marginBottom: "16px" }, children: /* @__PURE__ */ u("table", { style: { borderCollapse: "collapse", width: "100%", fontSize: "13px" }, children: [
|
|
1279
|
-
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ u("tr", { style: { backgroundColor: "#f5f5f5" }, children: [
|
|
1280
|
-
/* @__PURE__ */ o("th", { style: { padding: "8px 12px", border: "1px solid #ddd", textAlign: "left" }, children: "#" }),
|
|
1279
|
+
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ u("tr", { style: { backgroundColor: "var(--nice-bg-secondary, #f5f5f5)" }, children: [
|
|
1280
|
+
/* @__PURE__ */ o("th", { style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)", textAlign: "left" }, children: "#" }),
|
|
1281
1281
|
e.columns.map((a) => /* @__PURE__ */ u(
|
|
1282
1282
|
"th",
|
|
1283
1283
|
{
|
|
1284
|
-
style: { padding: "8px 12px", border: "1px solid #ddd", textAlign: "left" },
|
|
1284
|
+
style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)", textAlign: "left" },
|
|
1285
1285
|
children: [
|
|
1286
1286
|
a.name,
|
|
1287
|
-
/* @__PURE__ */ o("div", { style: { fontSize: "10px", color: "#666", fontWeight: "normal" }, children: a.type })
|
|
1287
|
+
/* @__PURE__ */ o("div", { style: { fontSize: "10px", color: "var(--nice-text-secondary, #666)", fontWeight: "normal" }, children: a.type })
|
|
1288
1288
|
]
|
|
1289
1289
|
},
|
|
1290
1290
|
a.name
|
|
1291
1291
|
))
|
|
1292
1292
|
] }) }),
|
|
1293
1293
|
/* @__PURE__ */ o("tbody", { children: s.map((a, l) => /* @__PURE__ */ u("tr", { children: [
|
|
1294
|
-
/* @__PURE__ */ o("td", { style: { padding: "8px 12px", border: "1px solid #ddd", color: "#666" }, children: t * r + l + 1 }),
|
|
1295
|
-
e.columns.map((c) => /* @__PURE__ */ o("td", { style: { padding: "8px 12px", border: "1px solid #ddd" }, children: a[c.name] != null ? String(a[c.name]) : /* @__PURE__ */ o("span", { style: { color: "#ccc" }, children: "null" }) }, c.name))
|
|
1294
|
+
/* @__PURE__ */ o("td", { style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)", color: "var(--nice-text-secondary, #666)" }, children: t * r + l + 1 }),
|
|
1295
|
+
e.columns.map((c) => /* @__PURE__ */ o("td", { style: { padding: "8px 12px", border: "1px solid var(--nice-border, #ddd)" }, children: a[c.name] != null ? String(a[c.name]) : /* @__PURE__ */ o("span", { style: { color: "var(--nice-border, #ccc)" }, children: "null" }) }, c.name))
|
|
1296
1296
|
] }, l)) })
|
|
1297
1297
|
] }) }),
|
|
1298
1298
|
/* @__PURE__ */ u("div", { style: { display: "flex", gap: "8px", alignItems: "center", justifyContent: "center" }, children: [
|
|
@@ -1309,7 +1309,7 @@ function mt({ dataset: e }) {
|
|
|
1309
1309
|
] })
|
|
1310
1310
|
] });
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1312
|
+
function mt({ dataset: e }) {
|
|
1313
1313
|
const t = e.columns.filter((n) => n.type === "number");
|
|
1314
1314
|
return /* @__PURE__ */ o(
|
|
1315
1315
|
"div",
|
|
@@ -1322,11 +1322,11 @@ function yt({ dataset: e }) {
|
|
|
1322
1322
|
children: t.map((n) => /* @__PURE__ */ u(
|
|
1323
1323
|
"div",
|
|
1324
1324
|
{
|
|
1325
|
-
style: { padding: "16px", backgroundColor: "#f9f9f9", borderRadius: "8px" },
|
|
1325
|
+
style: { padding: "16px", backgroundColor: "var(--nice-bg-secondary, #f9f9f9)", borderRadius: "8px" },
|
|
1326
1326
|
children: [
|
|
1327
1327
|
/* @__PURE__ */ o("h3", { style: { margin: "0 0 12px 0" }, children: n.name }),
|
|
1328
1328
|
n.stats && /* @__PURE__ */ o("table", { style: { width: "100%", fontSize: "13px" }, children: /* @__PURE__ */ o("tbody", { children: Object.entries(n.stats).map(([r, i]) => /* @__PURE__ */ u("tr", { children: [
|
|
1329
|
-
/* @__PURE__ */ o("td", { style: { padding: "4px 0", color: "#666" }, children: r }),
|
|
1329
|
+
/* @__PURE__ */ o("td", { style: { padding: "4px 0", color: "var(--nice-text-secondary, #666)" }, children: r }),
|
|
1330
1330
|
/* @__PURE__ */ o("td", { style: { padding: "4px 0", textAlign: "right", fontFamily: "monospace" }, children: typeof i == "number" ? i.toFixed(4) : String(i) })
|
|
1331
1331
|
] }, r)) }) })
|
|
1332
1332
|
]
|
|
@@ -1340,7 +1340,7 @@ function gt({
|
|
|
1340
1340
|
dataset: e,
|
|
1341
1341
|
service: t
|
|
1342
1342
|
}) {
|
|
1343
|
-
const [n, r] =
|
|
1343
|
+
const [n, r] = j("descriptive"), [i, s] = j(null);
|
|
1344
1344
|
return /* @__PURE__ */ u("div", { children: [
|
|
1345
1345
|
/* @__PURE__ */ u("div", { style: { display: "flex", gap: "12px", marginBottom: "24px" }, children: [
|
|
1346
1346
|
/* @__PURE__ */ u(
|
|
@@ -1348,7 +1348,7 @@ function gt({
|
|
|
1348
1348
|
{
|
|
1349
1349
|
value: n,
|
|
1350
1350
|
onChange: (l) => r(l.target.value),
|
|
1351
|
-
style: { padding: "8px 12px", borderRadius: "4px", border: "1px solid #ddd" },
|
|
1351
|
+
style: { padding: "8px 12px", borderRadius: "4px", border: "1px solid var(--nice-border, #ddd)" },
|
|
1352
1352
|
children: [
|
|
1353
1353
|
/* @__PURE__ */ o("option", { value: "descriptive", children: "Descriptive Statistics" }),
|
|
1354
1354
|
/* @__PURE__ */ o("option", { value: "correlation", children: "Correlation Matrix" }),
|
|
@@ -1365,7 +1365,7 @@ function gt({
|
|
|
1365
1365
|
},
|
|
1366
1366
|
style: {
|
|
1367
1367
|
padding: "8px 16px",
|
|
1368
|
-
backgroundColor: "#1976d2",
|
|
1368
|
+
backgroundColor: "var(--nice-primary-hover, #1976d2)",
|
|
1369
1369
|
color: "white",
|
|
1370
1370
|
border: "none",
|
|
1371
1371
|
borderRadius: "4px",
|
|
@@ -1375,7 +1375,7 @@ function gt({
|
|
|
1375
1375
|
}
|
|
1376
1376
|
)
|
|
1377
1377
|
] }),
|
|
1378
|
-
i && /* @__PURE__ */ u("div", { style: { padding: "16px", backgroundColor: "#f9f9f9", borderRadius: "8px" }, children: [
|
|
1378
|
+
i && /* @__PURE__ */ u("div", { style: { padding: "16px", backgroundColor: "var(--nice-bg-secondary, #f9f9f9)", borderRadius: "8px" }, children: [
|
|
1379
1379
|
/* @__PURE__ */ u("h3", { style: { margin: "0 0 12px 0" }, children: [
|
|
1380
1380
|
"Results (",
|
|
1381
1381
|
i.executionTimeMs.toFixed(2),
|
|
@@ -1385,7 +1385,7 @@ function gt({
|
|
|
1385
1385
|
] })
|
|
1386
1386
|
] });
|
|
1387
1387
|
}
|
|
1388
|
-
const
|
|
1388
|
+
const Oe = {
|
|
1389
1389
|
apa: (e) => {
|
|
1390
1390
|
const t = xt(e.authors), n = e.year ? ` (${e.year}).` : ".", r = e.title;
|
|
1391
1391
|
let i = "";
|
|
@@ -1429,7 +1429,7 @@ const Te = {
|
|
|
1429
1429
|
return e.type === "article" && e.journal && (r = ` *${e.journal}*`, e.volume && (r += ` **${e.volume}**`), e.pages && (r += `, ${e.pages}`), e.year && (r += ` (${e.year})`), r += "."), `${t}, ${n}.${r}`;
|
|
1430
1430
|
},
|
|
1431
1431
|
bibtex: (e) => {
|
|
1432
|
-
const t =
|
|
1432
|
+
const t = St(e), n = e.type === "article" ? "article" : e.type === "book" ? "book" : "misc";
|
|
1433
1433
|
let i = ` author = {${e.authors.map((s) => `${s.family}, ${s.given}`).join(" and ")}},
|
|
1434
1434
|
`;
|
|
1435
1435
|
return i += ` title = {${e.title}},
|
|
@@ -1489,12 +1489,12 @@ function Qe(e) {
|
|
|
1489
1489
|
function wt(e) {
|
|
1490
1490
|
return Qe(e);
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1492
|
+
function St(e) {
|
|
1493
1493
|
var i;
|
|
1494
1494
|
const t = ((i = e.authors[0]) == null ? void 0 : i.family.toLowerCase()) || "unknown", n = e.year || "0000", r = e.title.split(" ")[0].toLowerCase().replace(/[^a-z]/g, "");
|
|
1495
1495
|
return `${t}${n}${r}`;
|
|
1496
1496
|
}
|
|
1497
|
-
class
|
|
1497
|
+
class Ct {
|
|
1498
1498
|
constructor(t = {}) {
|
|
1499
1499
|
ve(this, "config");
|
|
1500
1500
|
ve(this, "citations", /* @__PURE__ */ new Map());
|
|
@@ -1574,8 +1574,8 @@ class St {
|
|
|
1574
1574
|
return Array.from(this.citations.values()).filter((i) => {
|
|
1575
1575
|
var s, a, l, c, h;
|
|
1576
1576
|
return n != null && n.collection && !((s = i.collections) != null && s.includes(n.collection)) || n != null && n.type && i.type !== n.type || n != null && n.year && i.year !== n.year || (a = n == null ? void 0 : n.tags) != null && a.length && !n.tags.some((p) => {
|
|
1577
|
-
var
|
|
1578
|
-
return (
|
|
1577
|
+
var y;
|
|
1578
|
+
return (y = i.tags) == null ? void 0 : y.includes(p);
|
|
1579
1579
|
}) ? !1 : !!(i.title.toLowerCase().includes(r) || i.authors.some(
|
|
1580
1580
|
(p) => p.family.toLowerCase().includes(r) || p.given.toLowerCase().includes(r)
|
|
1581
1581
|
) || (l = i.journal) != null && l.toLowerCase().includes(r) || (c = i.abstract) != null && c.toLowerCase().includes(r) || (h = i.doi) != null && h.toLowerCase().includes(r));
|
|
@@ -1611,7 +1611,7 @@ class St {
|
|
|
1611
1611
|
const r = this.citations.get(t);
|
|
1612
1612
|
if (!r)
|
|
1613
1613
|
throw new Error(`Citation not found: ${t}`);
|
|
1614
|
-
return
|
|
1614
|
+
return Oe[n](r);
|
|
1615
1615
|
}
|
|
1616
1616
|
/** Format multiple citations as bibliography */
|
|
1617
1617
|
formatBibliography(t, n) {
|
|
@@ -1619,7 +1619,7 @@ class St {
|
|
|
1619
1619
|
const a = this.citations.get(i);
|
|
1620
1620
|
if (!a)
|
|
1621
1621
|
return null;
|
|
1622
|
-
const l =
|
|
1622
|
+
const l = Oe[n](a);
|
|
1623
1623
|
return n === "bibtex" ? l : ["ieee", "vancouver"].includes(n) ? `[${s + 1}] ${l}` : l;
|
|
1624
1624
|
}).filter(Boolean).join(`
|
|
1625
1625
|
|
|
@@ -1670,7 +1670,7 @@ class St {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
/** Export as BibTeX */
|
|
1672
1672
|
exportBibtex(t) {
|
|
1673
|
-
return (t ? t.map((r) => this.citations.get(r)).filter(Boolean) : Array.from(this.citations.values())).map((r) =>
|
|
1673
|
+
return (t ? t.map((r) => this.citations.get(r)).filter(Boolean) : Array.from(this.citations.values())).map((r) => Oe.bibtex(r)).join(`
|
|
1674
1674
|
|
|
1675
1675
|
`);
|
|
1676
1676
|
}
|
|
@@ -1697,7 +1697,7 @@ class St {
|
|
|
1697
1697
|
if (!i.ok)
|
|
1698
1698
|
throw new Error(`Crossref API error: ${i.status}`);
|
|
1699
1699
|
const s = await i.json(), a = s.message.items.map((l) => {
|
|
1700
|
-
var c, h, p,
|
|
1700
|
+
var c, h, p, y, m, $;
|
|
1701
1701
|
return {
|
|
1702
1702
|
type: "article",
|
|
1703
1703
|
title: ((c = l.title) == null ? void 0 : c[0]) || "",
|
|
@@ -1706,8 +1706,8 @@ class St {
|
|
|
1706
1706
|
family: w.family || "",
|
|
1707
1707
|
orcid: w.ORCID
|
|
1708
1708
|
})),
|
|
1709
|
-
year: (
|
|
1710
|
-
journal: (
|
|
1709
|
+
year: (y = (p = (h = l.published) == null ? void 0 : h["date-parts"]) == null ? void 0 : p[0]) == null ? void 0 : y[0],
|
|
1710
|
+
journal: (m = l["container-title"]) == null ? void 0 : m[0],
|
|
1711
1711
|
volume: l.volume,
|
|
1712
1712
|
issue: l.issue,
|
|
1713
1713
|
pages: l.page,
|
|
@@ -1734,26 +1734,26 @@ class St {
|
|
|
1734
1734
|
const l = `https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=${a.join(",")}&retmode=json`, c = await fetch(l);
|
|
1735
1735
|
if (!c.ok)
|
|
1736
1736
|
throw new Error(`PubMed API error: ${c.status}`);
|
|
1737
|
-
const h = await c.json(), p = a.map((
|
|
1737
|
+
const h = await c.json(), p = a.map((y) => {
|
|
1738
1738
|
var $;
|
|
1739
|
-
const
|
|
1739
|
+
const m = h.result[y];
|
|
1740
1740
|
return {
|
|
1741
1741
|
type: "article",
|
|
1742
|
-
title:
|
|
1743
|
-
authors: (
|
|
1744
|
-
const
|
|
1742
|
+
title: m.title || "",
|
|
1743
|
+
authors: (m.authors || []).map((w) => {
|
|
1744
|
+
const F = w.name.split(" ");
|
|
1745
1745
|
return {
|
|
1746
|
-
family:
|
|
1747
|
-
given:
|
|
1746
|
+
family: F.pop() || "",
|
|
1747
|
+
given: F.join(" ")
|
|
1748
1748
|
};
|
|
1749
1749
|
}),
|
|
1750
|
-
year:
|
|
1751
|
-
journal:
|
|
1752
|
-
volume:
|
|
1753
|
-
issue:
|
|
1754
|
-
pages:
|
|
1755
|
-
pmid:
|
|
1756
|
-
doi: ($ =
|
|
1750
|
+
year: m.pubdate ? parseInt(m.pubdate.split(" ")[0], 10) : void 0,
|
|
1751
|
+
journal: m.source,
|
|
1752
|
+
volume: m.volume,
|
|
1753
|
+
issue: m.issue,
|
|
1754
|
+
pages: m.pages,
|
|
1755
|
+
pmid: y,
|
|
1756
|
+
doi: ($ = m.elocationid) == null ? void 0 : $.replace("doi: ", ""),
|
|
1757
1757
|
sourceDatabase: "pubmed"
|
|
1758
1758
|
};
|
|
1759
1759
|
});
|
|
@@ -1807,7 +1807,7 @@ class St {
|
|
|
1807
1807
|
}
|
|
1808
1808
|
}
|
|
1809
1809
|
function Ht(e) {
|
|
1810
|
-
return new
|
|
1810
|
+
return new Ct(e);
|
|
1811
1811
|
}
|
|
1812
1812
|
const He = Ue(null);
|
|
1813
1813
|
function et() {
|
|
@@ -1825,8 +1825,8 @@ const he = {
|
|
|
1825
1825
|
},
|
|
1826
1826
|
sidebar: {
|
|
1827
1827
|
width: "240px",
|
|
1828
|
-
backgroundColor: "#f5f5f5",
|
|
1829
|
-
borderRight: "1px solid #e0e0e0",
|
|
1828
|
+
backgroundColor: "var(--nice-bg-secondary, #f5f5f5)",
|
|
1829
|
+
borderRight: "1px solid var(--nice-border, #e0e0e0)",
|
|
1830
1830
|
display: "flex",
|
|
1831
1831
|
flexDirection: "column"
|
|
1832
1832
|
},
|
|
@@ -1838,7 +1838,7 @@ const he = {
|
|
|
1838
1838
|
},
|
|
1839
1839
|
toolbar: {
|
|
1840
1840
|
padding: "12px 16px",
|
|
1841
|
-
borderBottom: "1px solid #e0e0e0",
|
|
1841
|
+
borderBottom: "1px solid var(--nice-border, #e0e0e0)",
|
|
1842
1842
|
display: "flex",
|
|
1843
1843
|
gap: "12px",
|
|
1844
1844
|
alignItems: "center"
|
|
@@ -1849,24 +1849,24 @@ const he = {
|
|
|
1849
1849
|
},
|
|
1850
1850
|
listItem: {
|
|
1851
1851
|
padding: "12px 16px",
|
|
1852
|
-
borderBottom: "1px solid #eee",
|
|
1852
|
+
borderBottom: "1px solid var(--nice-border, #eee)",
|
|
1853
1853
|
cursor: "pointer"
|
|
1854
1854
|
},
|
|
1855
1855
|
detail: {
|
|
1856
1856
|
width: "400px",
|
|
1857
|
-
borderLeft: "1px solid #e0e0e0",
|
|
1857
|
+
borderLeft: "1px solid var(--nice-border, #e0e0e0)",
|
|
1858
1858
|
overflow: "auto",
|
|
1859
1859
|
padding: "16px"
|
|
1860
1860
|
},
|
|
1861
1861
|
input: {
|
|
1862
1862
|
padding: "8px 12px",
|
|
1863
|
-
border: "1px solid #ddd",
|
|
1863
|
+
border: "1px solid var(--nice-border, #ddd)",
|
|
1864
1864
|
borderRadius: "4px",
|
|
1865
1865
|
fontSize: "14px"
|
|
1866
1866
|
},
|
|
1867
1867
|
button: {
|
|
1868
1868
|
padding: "8px 16px",
|
|
1869
|
-
backgroundColor: "#1976d2",
|
|
1869
|
+
backgroundColor: "var(--nice-primary-hover, #1976d2)",
|
|
1870
1870
|
color: "white",
|
|
1871
1871
|
border: "none",
|
|
1872
1872
|
borderRadius: "4px",
|
|
@@ -1874,9 +1874,9 @@ const he = {
|
|
|
1874
1874
|
}
|
|
1875
1875
|
};
|
|
1876
1876
|
function en({ service: e, className: t, style: n }) {
|
|
1877
|
-
const [r, i] =
|
|
1877
|
+
const [r, i] = j([]), [s, a] = j([]), [l, c] = j("all"), [h, p] = j(null), [y, m] = j(""), [$, w] = j("apa"), F = P(() => {
|
|
1878
1878
|
i(e.listCitations(l)), a(e.listCollections());
|
|
1879
|
-
}, [e, l]), J = K(() =>
|
|
1879
|
+
}, [e, l]), J = K(() => y ? e.searchCitations(y, { collection: l }) : r, [r, y, l, e]), te = K(
|
|
1880
1880
|
() => r.find((L) => L.id === h),
|
|
1881
1881
|
[r, h]
|
|
1882
1882
|
), V = {
|
|
@@ -1887,11 +1887,11 @@ function en({ service: e, className: t, style: n }) {
|
|
|
1887
1887
|
setSelectedCollection: c,
|
|
1888
1888
|
selectedCitation: h,
|
|
1889
1889
|
setSelectedCitation: p,
|
|
1890
|
-
searchQuery:
|
|
1891
|
-
setSearchQuery:
|
|
1890
|
+
searchQuery: y,
|
|
1891
|
+
setSearchQuery: m,
|
|
1892
1892
|
citationStyle: $,
|
|
1893
1893
|
setCitationStyle: w,
|
|
1894
|
-
refresh:
|
|
1894
|
+
refresh: F
|
|
1895
1895
|
};
|
|
1896
1896
|
return /* @__PURE__ */ o(He.Provider, { value: V, children: /* @__PURE__ */ u("div", { className: t, style: { ...he.container, ...n }, children: [
|
|
1897
1897
|
/* @__PURE__ */ u("div", { style: he.sidebar, children: [
|
|
@@ -1900,15 +1900,15 @@ function en({ service: e, className: t, style: n }) {
|
|
|
1900
1900
|
"div",
|
|
1901
1901
|
{
|
|
1902
1902
|
onClick: () => {
|
|
1903
|
-
c(L.id),
|
|
1903
|
+
c(L.id), F();
|
|
1904
1904
|
},
|
|
1905
1905
|
style: {
|
|
1906
1906
|
...he.listItem,
|
|
1907
|
-
backgroundColor: l === L.id ? "#e3f2fd" : "transparent"
|
|
1907
|
+
backgroundColor: l === L.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
|
|
1908
1908
|
},
|
|
1909
1909
|
children: [
|
|
1910
1910
|
/* @__PURE__ */ o("div", { children: L.name }),
|
|
1911
|
-
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1911
|
+
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: [
|
|
1912
1912
|
L.citationCount,
|
|
1913
1913
|
" items"
|
|
1914
1914
|
] })
|
|
@@ -1924,8 +1924,8 @@ function en({ service: e, className: t, style: n }) {
|
|
|
1924
1924
|
{
|
|
1925
1925
|
type: "text",
|
|
1926
1926
|
placeholder: "Search references...",
|
|
1927
|
-
value:
|
|
1928
|
-
onChange: (L) =>
|
|
1927
|
+
value: y,
|
|
1928
|
+
onChange: (L) => m(L.target.value),
|
|
1929
1929
|
style: { ...he.input, flex: 1 }
|
|
1930
1930
|
}
|
|
1931
1931
|
),
|
|
@@ -1956,20 +1956,20 @@ function en({ service: e, className: t, style: n }) {
|
|
|
1956
1956
|
onClick: () => p(L.id),
|
|
1957
1957
|
style: {
|
|
1958
1958
|
...he.listItem,
|
|
1959
|
-
backgroundColor: h === L.id ? "#e3f2fd" : "transparent"
|
|
1959
|
+
backgroundColor: h === L.id ? "var(--nice-primary-bg, #e3f2fd)" : "transparent"
|
|
1960
1960
|
},
|
|
1961
1961
|
children: [
|
|
1962
1962
|
/* @__PURE__ */ o("div", { style: { fontWeight: 500, marginBottom: "4px" }, children: L.title }),
|
|
1963
|
-
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1963
|
+
/* @__PURE__ */ u("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #666)" }, children: [
|
|
1964
1964
|
L.authors.map((H) => H.family).join(", "),
|
|
1965
1965
|
L.year && ` (${L.year})`
|
|
1966
1966
|
] }),
|
|
1967
|
-
L.journal && /* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "#888", fontStyle: "italic" }, children: L.journal })
|
|
1967
|
+
L.journal && /* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "var(--nice-text-secondary, #888)", fontStyle: "italic" }, children: L.journal })
|
|
1968
1968
|
]
|
|
1969
1969
|
},
|
|
1970
1970
|
L.id
|
|
1971
1971
|
)),
|
|
1972
|
-
J.length === 0 && /* @__PURE__ */ o("div", { style: { padding: "24px", textAlign: "center", color: "#666" }, children: "No references found" })
|
|
1972
|
+
J.length === 0 && /* @__PURE__ */ o("div", { style: { padding: "24px", textAlign: "center", color: "var(--nice-text-secondary, #666)" }, children: "No references found" })
|
|
1973
1973
|
] }),
|
|
1974
1974
|
te && /* @__PURE__ */ o("div", { style: he.detail, children: /* @__PURE__ */ o(Dt, { citation: te }) })
|
|
1975
1975
|
] })
|
|
@@ -1977,7 +1977,7 @@ function en({ service: e, className: t, style: n }) {
|
|
|
1977
1977
|
] }) });
|
|
1978
1978
|
}
|
|
1979
1979
|
function kt() {
|
|
1980
|
-
const { service: e, refresh: t } = et(), [n, r] =
|
|
1980
|
+
const { service: e, refresh: t } = et(), [n, r] = j(!1), [i, s] = j(""), [a, l] = j(!1), c = async () => {
|
|
1981
1981
|
if (i.trim()) {
|
|
1982
1982
|
l(!0);
|
|
1983
1983
|
try {
|
|
@@ -1987,7 +1987,7 @@ function kt() {
|
|
|
1987
1987
|
}
|
|
1988
1988
|
}
|
|
1989
1989
|
};
|
|
1990
|
-
return /* @__PURE__ */ u(
|
|
1990
|
+
return /* @__PURE__ */ u(ze, { children: [
|
|
1991
1991
|
/* @__PURE__ */ o("button", { onClick: () => r(!0), style: he.button, children: "+ Add Reference" }),
|
|
1992
1992
|
n && /* @__PURE__ */ o(
|
|
1993
1993
|
"div",
|
|
@@ -1995,7 +1995,7 @@ function kt() {
|
|
|
1995
1995
|
style: {
|
|
1996
1996
|
position: "fixed",
|
|
1997
1997
|
inset: 0,
|
|
1998
|
-
backgroundColor: "rgba(0,0,0,0.5)",
|
|
1998
|
+
backgroundColor: "var(--nice-overlay-50, rgba(0, 0, 0, 0.5))",
|
|
1999
1999
|
display: "flex",
|
|
2000
2000
|
alignItems: "center",
|
|
2001
2001
|
justifyContent: "center",
|
|
@@ -2029,7 +2029,7 @@ function kt() {
|
|
|
2029
2029
|
"button",
|
|
2030
2030
|
{
|
|
2031
2031
|
onClick: () => r(!1),
|
|
2032
|
-
style: { ...he.button, backgroundColor: "#9e9e9e" },
|
|
2032
|
+
style: { ...he.button, backgroundColor: "var(--nice-text-secondary, #9e9e9e)" },
|
|
2033
2033
|
children: "Cancel"
|
|
2034
2034
|
}
|
|
2035
2035
|
),
|
|
@@ -2043,7 +2043,7 @@ function kt() {
|
|
|
2043
2043
|
] });
|
|
2044
2044
|
}
|
|
2045
2045
|
function Dt({ citation: e }) {
|
|
2046
|
-
const { service: t, citationStyle: n } = et(), [r, i] =
|
|
2046
|
+
const { service: t, citationStyle: n } = et(), [r, i] = j(!1), s = K(
|
|
2047
2047
|
() => t.formatCitation(e.id, n),
|
|
2048
2048
|
[t, e.id, n]
|
|
2049
2049
|
), a = () => {
|
|
@@ -2051,7 +2051,7 @@ function Dt({ citation: e }) {
|
|
|
2051
2051
|
};
|
|
2052
2052
|
return /* @__PURE__ */ u("div", { children: [
|
|
2053
2053
|
/* @__PURE__ */ o("h2", { style: { margin: "0 0 8px 0", fontSize: "18px" }, children: e.title }),
|
|
2054
|
-
/* @__PURE__ */ o("div", { style: { color: "#666", marginBottom: "16px" }, children: e.authors.map((l) => `${l.given} ${l.family}`).join(", ") }),
|
|
2054
|
+
/* @__PURE__ */ o("div", { style: { color: "var(--nice-text-secondary, #666)", marginBottom: "16px" }, children: e.authors.map((l) => `${l.given} ${l.family}`).join(", ") }),
|
|
2055
2055
|
/* @__PURE__ */ u("div", { style: { marginBottom: "16px" }, children: [
|
|
2056
2056
|
/* @__PURE__ */ u(
|
|
2057
2057
|
"div",
|
|
@@ -2084,7 +2084,7 @@ function Dt({ citation: e }) {
|
|
|
2084
2084
|
{
|
|
2085
2085
|
style: {
|
|
2086
2086
|
padding: "12px",
|
|
2087
|
-
backgroundColor: "#f5f5f5",
|
|
2087
|
+
backgroundColor: "var(--nice-bg-secondary, #f5f5f5)",
|
|
2088
2088
|
borderRadius: "4px",
|
|
2089
2089
|
whiteSpace: "pre-wrap",
|
|
2090
2090
|
fontSize: "13px"
|
|
@@ -2137,12 +2137,12 @@ function Dt({ citation: e }) {
|
|
|
2137
2137
|
] }),
|
|
2138
2138
|
e.abstract && /* @__PURE__ */ u("div", { style: { marginTop: "8px" }, children: [
|
|
2139
2139
|
/* @__PURE__ */ o("strong", { children: "Abstract:" }),
|
|
2140
|
-
/* @__PURE__ */ o("p", { style: { margin: "8px 0 0 0", color: "#444" }, children: e.abstract })
|
|
2140
|
+
/* @__PURE__ */ o("p", { style: { margin: "8px 0 0 0", color: "var(--nice-text, #444)" }, children: e.abstract })
|
|
2141
2141
|
] })
|
|
2142
2142
|
] })
|
|
2143
2143
|
] });
|
|
2144
2144
|
}
|
|
2145
|
-
const
|
|
2145
|
+
const zt = {
|
|
2146
2146
|
series: [],
|
|
2147
2147
|
xAxes: [],
|
|
2148
2148
|
yAxes: [],
|
|
@@ -2152,33 +2152,33 @@ const At = {
|
|
|
2152
2152
|
cursor: null,
|
|
2153
2153
|
hoveredPoint: null
|
|
2154
2154
|
};
|
|
2155
|
-
function
|
|
2155
|
+
function Ie(e) {
|
|
2156
2156
|
return e.reduce((t, n) => t + n, 0) / e.length;
|
|
2157
2157
|
}
|
|
2158
|
-
function
|
|
2158
|
+
function At(e) {
|
|
2159
2159
|
const t = [...e].sort((r, i) => r - i), n = Math.floor(t.length / 2);
|
|
2160
2160
|
return t.length % 2 ? t[n] : (t[n - 1] + t[n]) / 2;
|
|
2161
2161
|
}
|
|
2162
2162
|
function Re(e) {
|
|
2163
|
-
const t =
|
|
2164
|
-
return Math.sqrt(
|
|
2163
|
+
const t = Ie(e), n = e.map((r) => Math.pow(r - t, 2));
|
|
2164
|
+
return Math.sqrt(Ie(n));
|
|
2165
2165
|
}
|
|
2166
|
-
function
|
|
2166
|
+
function It(e) {
|
|
2167
2167
|
return Re(e) / Math.sqrt(e.length);
|
|
2168
2168
|
}
|
|
2169
|
-
function
|
|
2170
|
-
const t =
|
|
2169
|
+
function Nt(e) {
|
|
2170
|
+
const t = Ie(e), n = It(e), r = 1.96;
|
|
2171
2171
|
return [t - r * n, t + r * n];
|
|
2172
2172
|
}
|
|
2173
|
-
function
|
|
2174
|
-
const t = e.length, n = e.map((w) => typeof w.x == "number" ? w.x : 0), r = e.map((w) => w.y), i = n.reduce((w,
|
|
2173
|
+
function Et(e) {
|
|
2174
|
+
const t = e.length, n = e.map((w) => typeof w.x == "number" ? w.x : 0), r = e.map((w) => w.y), i = n.reduce((w, F) => w + F, 0), s = r.reduce((w, F) => w + F, 0), a = n.reduce((w, F, J) => w + F * r[J], 0), l = n.reduce((w, F) => w + F * F, 0), c = (t * a - i * s) / (t * l - i * i), h = (s - c * i) / t, p = s / t, y = r.reduce((w, F) => w + Math.pow(F - p, 2), 0), $ = 1 - r.reduce((w, F, J) => w + Math.pow(F - (c * n[J] + h), 2), 0) / y;
|
|
2175
2175
|
return { slope: c, intercept: h, r2: $ };
|
|
2176
2176
|
}
|
|
2177
|
-
function
|
|
2178
|
-
const n =
|
|
2179
|
-
return { t: p, p:
|
|
2177
|
+
function jt(e, t) {
|
|
2178
|
+
const n = Ie(e), r = Ie(t), i = Re(e) ** 2, s = Re(t) ** 2, a = e.length, l = t.length, c = ((a - 1) * i + (l - 1) * s) / (a + l - 2), h = Math.sqrt(c * (1 / a + 1 / l)), p = (n - r) / h, y = Math.exp(-0.717 * Math.abs(p) - 0.416 * p * p);
|
|
2179
|
+
return { t: p, p: y, significant: y < 0.05 };
|
|
2180
2180
|
}
|
|
2181
|
-
function
|
|
2181
|
+
function Ye(e, t, n, r = 5) {
|
|
2182
2182
|
const s = (t - e) / (r - 1);
|
|
2183
2183
|
return Array.from({ length: r }, (a, l) => e + l * s);
|
|
2184
2184
|
}
|
|
@@ -2197,11 +2197,11 @@ function tn({
|
|
|
2197
2197
|
statOverlays: c = [],
|
|
2198
2198
|
annotations: h = [],
|
|
2199
2199
|
legend: p = { show: !0, position: "top", orientation: "horizontal", interactive: !0 },
|
|
2200
|
-
tooltip:
|
|
2201
|
-
zoom:
|
|
2200
|
+
tooltip: y = { enabled: !0, mode: "point" },
|
|
2201
|
+
zoom: m = { enabled: !0, mode: "xy", wheel: !0, drag: !0, resetButton: !0 },
|
|
2202
2202
|
export: $,
|
|
2203
2203
|
statisticalTests: w = [],
|
|
2204
|
-
gridLines:
|
|
2204
|
+
gridLines: F = !0,
|
|
2205
2205
|
aspectRatio: J,
|
|
2206
2206
|
animation: te = !0,
|
|
2207
2207
|
theme: V = "light",
|
|
@@ -2212,60 +2212,60 @@ function tn({
|
|
|
2212
2212
|
className: de,
|
|
2213
2213
|
style: pe
|
|
2214
2214
|
}) {
|
|
2215
|
-
const se =
|
|
2216
|
-
|
|
2217
|
-
const [ne,
|
|
2218
|
-
...
|
|
2215
|
+
const se = Ae(null);
|
|
2216
|
+
Ae(null);
|
|
2217
|
+
const [ne, Y] = j({
|
|
2218
|
+
...zt,
|
|
2219
2219
|
series: e,
|
|
2220
2220
|
annotations: h
|
|
2221
|
-
}), [ce, ue] =
|
|
2221
|
+
}), [ce, ue] = j({ width: 0, height: 0 }), [me, xe] = j({ x: null, y: null }), [X, Z] = j(
|
|
2222
2222
|
null
|
|
2223
|
-
), [ae, G] =
|
|
2223
|
+
), [ae, G] = j(
|
|
2224
2224
|
new Set(e.map((d) => d.id))
|
|
2225
|
-
),
|
|
2225
|
+
), C = K(() => {
|
|
2226
2226
|
const d = e.filter((M) => ae.has(M.id) && M.visible !== !1);
|
|
2227
2227
|
if (d.length === 0)
|
|
2228
2228
|
return { xMin: 0, xMax: 1, yMin: 0, yMax: 1 };
|
|
2229
|
-
let x = 1 / 0,
|
|
2229
|
+
let x = 1 / 0, S = -1 / 0, E = 1 / 0, N = -1 / 0;
|
|
2230
2230
|
for (const M of d)
|
|
2231
|
-
for (const
|
|
2232
|
-
const
|
|
2233
|
-
if (x = Math.min(x,
|
|
2234
|
-
const [
|
|
2235
|
-
|
|
2231
|
+
for (const z of M.data) {
|
|
2232
|
+
const W = typeof z.x == "number" ? z.x : 0;
|
|
2233
|
+
if (x = Math.min(x, W), S = Math.max(S, W), E = Math.min(E, z.y), N = Math.max(N, z.y), z.error) {
|
|
2234
|
+
const [T, le] = Array.isArray(z.error) ? z.error : [-z.error, z.error];
|
|
2235
|
+
E = Math.min(E, z.y + T), N = Math.max(N, z.y + le);
|
|
2236
2236
|
}
|
|
2237
2237
|
}
|
|
2238
|
-
const
|
|
2238
|
+
const _ = (S - x) * 0.05 || 0.5, g = (N - E) * 0.05 || 0.5;
|
|
2239
2239
|
return {
|
|
2240
|
-
xMin: x -
|
|
2241
|
-
xMax:
|
|
2242
|
-
yMin:
|
|
2243
|
-
yMax:
|
|
2240
|
+
xMin: x - _,
|
|
2241
|
+
xMax: S + _,
|
|
2242
|
+
yMin: E - g,
|
|
2243
|
+
yMax: N + g
|
|
2244
2244
|
};
|
|
2245
2245
|
}, [e, ae]), Q = K(() => {
|
|
2246
2246
|
const d = {};
|
|
2247
2247
|
for (const x of e) {
|
|
2248
2248
|
if (!ae.has(x.id))
|
|
2249
2249
|
continue;
|
|
2250
|
-
const
|
|
2251
|
-
c.includes("mean") && (d[`${x.id}_mean`] =
|
|
2250
|
+
const S = x.data.map((E) => E.y);
|
|
2251
|
+
c.includes("mean") && (d[`${x.id}_mean`] = Ie(S)), c.includes("median") && (d[`${x.id}_median`] = At(S)), c.includes("std-dev") && (d[`${x.id}_std`] = Re(S)), c.includes("regression") && (d[`${x.id}_regression`] = Et(x.data)), c.includes("confidence-interval") && (d[`${x.id}_ci95`] = Nt(S));
|
|
2252
2252
|
}
|
|
2253
2253
|
return d;
|
|
2254
2254
|
}, [e, ae, c]), ee = K(() => w.map((d) => {
|
|
2255
2255
|
if (d.type === "t-test" && d.series.length === 2) {
|
|
2256
|
-
const x = e.find((
|
|
2257
|
-
if (x &&
|
|
2258
|
-
const
|
|
2259
|
-
x.data.map((
|
|
2260
|
-
|
|
2256
|
+
const x = e.find((E) => E.id === d.series[0]), S = e.find((E) => E.id === d.series[1]);
|
|
2257
|
+
if (x && S) {
|
|
2258
|
+
const E = jt(
|
|
2259
|
+
x.data.map((N) => N.y),
|
|
2260
|
+
S.data.map((N) => N.y)
|
|
2261
2261
|
);
|
|
2262
2262
|
return {
|
|
2263
2263
|
...d,
|
|
2264
2264
|
result: {
|
|
2265
|
-
statistic:
|
|
2266
|
-
pValue:
|
|
2267
|
-
significant:
|
|
2268
|
-
interpretation:
|
|
2265
|
+
statistic: E.t,
|
|
2266
|
+
pValue: E.p,
|
|
2267
|
+
significant: E.significant,
|
|
2268
|
+
interpretation: E.significant ? `Significant difference (p = ${E.p.toFixed(4)})` : `No significant difference (p = ${E.p.toFixed(4)})`
|
|
2269
2269
|
}
|
|
2270
2270
|
};
|
|
2271
2271
|
}
|
|
@@ -2273,47 +2273,47 @@ function tn({
|
|
|
2273
2273
|
return d;
|
|
2274
2274
|
}), [w, e]), re = P((d) => {
|
|
2275
2275
|
G((x) => {
|
|
2276
|
-
const
|
|
2277
|
-
return
|
|
2276
|
+
const S = new Set(x);
|
|
2277
|
+
return S.has(d) ? S.delete(d) : S.add(d), S;
|
|
2278
2278
|
});
|
|
2279
2279
|
}, []), ie = P(() => {
|
|
2280
2280
|
xe({ x: null, y: null }), oe == null || oe(null, null);
|
|
2281
|
-
}, [oe]),
|
|
2281
|
+
}, [oe]), A = K(() => {
|
|
2282
2282
|
switch (V) {
|
|
2283
2283
|
case "dark":
|
|
2284
|
-
return ["#60a5fa", "#f472b6", "#34d399", "#fbbf24", "#a78bfa", "#fb923c"];
|
|
2284
|
+
return ["var(--nice-primary-light, #60a5fa)", "var(--nice-accent-pink, #f472b6)", "var(--nice-success-light, #34d399)", "var(--nice-warning-light, #fbbf24)", "var(--nice-accent, #a78bfa)", "#fb923c"];
|
|
2285
2285
|
case "publication":
|
|
2286
2286
|
return ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b"];
|
|
2287
2287
|
case "presentation":
|
|
2288
|
-
return ["#3b82f6", "#ef4444", "#22c55e", "#f59e0b", "#8b5cf6", "#ec4899"];
|
|
2288
|
+
return ["var(--nice-primary, #3b82f6)", "var(--nice-danger, #ef4444)", "var(--nice-success, #22c55e)", "var(--nice-warning, #f59e0b)", "var(--nice-accent, #8b5cf6)", "var(--nice-accent-pink, #ec4899)"];
|
|
2289
2289
|
default:
|
|
2290
|
-
return ["#2563eb", "#dc2626", "#16a34a", "#ca8a04", "#7c3aed", "#db2777"];
|
|
2290
|
+
return ["var(--nice-primary-hover, #2563eb)", "var(--nice-danger-dark, #dc2626)", "var(--nice-success-dark, #16a34a)", "#ca8a04", "var(--nice-accent, #7c3aed)", "var(--nice-accent-pink, #db2777)"];
|
|
2291
2291
|
}
|
|
2292
2292
|
}, [V]), k = K(() => {
|
|
2293
2293
|
switch (V) {
|
|
2294
2294
|
case "dark":
|
|
2295
2295
|
return {
|
|
2296
|
-
bg: "#1f2937",
|
|
2297
|
-
text: "#f3f4f6",
|
|
2298
|
-
grid: "#374151",
|
|
2299
|
-
axis: "#9ca3af",
|
|
2300
|
-
tooltip: "#374151"
|
|
2296
|
+
bg: "var(--nice-text, #1f2937)",
|
|
2297
|
+
text: "var(--nice-bg-secondary, #f3f4f6)",
|
|
2298
|
+
grid: "var(--nice-text, #374151)",
|
|
2299
|
+
axis: "var(--nice-text-muted, #9ca3af)",
|
|
2300
|
+
tooltip: "var(--nice-text, #374151)"
|
|
2301
2301
|
};
|
|
2302
2302
|
case "publication":
|
|
2303
2303
|
return {
|
|
2304
|
-
bg: "#
|
|
2305
|
-
text: "#000000",
|
|
2306
|
-
grid: "#e5e5e5",
|
|
2307
|
-
axis: "#333333",
|
|
2308
|
-
tooltip: "#
|
|
2304
|
+
bg: "var(--nice-bg, #fff)",
|
|
2305
|
+
text: "var(--nice-text, #000000)",
|
|
2306
|
+
grid: "var(--nice-border, #e5e5e5)",
|
|
2307
|
+
axis: "var(--nice-text, #333333)",
|
|
2308
|
+
tooltip: "var(--nice-bg, #fff)"
|
|
2309
2309
|
};
|
|
2310
2310
|
default:
|
|
2311
2311
|
return {
|
|
2312
|
-
bg: "#
|
|
2313
|
-
text: "#1f2937",
|
|
2314
|
-
grid: "#e5e7eb",
|
|
2315
|
-
axis: "#4b5563",
|
|
2316
|
-
tooltip: "#
|
|
2312
|
+
bg: "var(--nice-bg, #fff)",
|
|
2313
|
+
text: "var(--nice-text, #1f2937)",
|
|
2314
|
+
grid: "var(--nice-border, #e5e7eb)",
|
|
2315
|
+
axis: "var(--nice-text-secondary, #4b5563)",
|
|
2316
|
+
tooltip: "var(--nice-bg, #fff)"
|
|
2317
2317
|
};
|
|
2318
2318
|
}
|
|
2319
2319
|
}, [V]);
|
|
@@ -2383,7 +2383,7 @@ function tn({
|
|
|
2383
2383
|
width: 12,
|
|
2384
2384
|
height: 12,
|
|
2385
2385
|
borderRadius: 2,
|
|
2386
|
-
backgroundColor: d.color ||
|
|
2386
|
+
backgroundColor: d.color || A[x % A.length]
|
|
2387
2387
|
}
|
|
2388
2388
|
}
|
|
2389
2389
|
),
|
|
@@ -2401,7 +2401,7 @@ function tn({
|
|
|
2401
2401
|
style: { flex: 1, position: "relative", minHeight: 200 },
|
|
2402
2402
|
children: [
|
|
2403
2403
|
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", style: { overflow: "visible" }, children: [
|
|
2404
|
-
|
|
2404
|
+
F && /* @__PURE__ */ u("g", { className: "nice-scientific-chart__grid", stroke: k.grid, strokeWidth: 1, children: [
|
|
2405
2405
|
[0, 0.25, 0.5, 0.75, 1].map((d) => /* @__PURE__ */ o(
|
|
2406
2406
|
"line",
|
|
2407
2407
|
{
|
|
@@ -2426,67 +2426,67 @@ function tn({
|
|
|
2426
2426
|
))
|
|
2427
2427
|
] }),
|
|
2428
2428
|
e.filter((d) => ae.has(d.id) && d.visible !== !1).map((d, x) => {
|
|
2429
|
-
var
|
|
2430
|
-
const
|
|
2431
|
-
return /* @__PURE__ */ o("g", { className: "nice-scientific-chart__series", children:
|
|
2432
|
-
|
|
2429
|
+
var N, _, g;
|
|
2430
|
+
const S = d.color || A[x % A.length], E = d.type || s;
|
|
2431
|
+
return /* @__PURE__ */ o("g", { className: "nice-scientific-chart__series", children: E === "scatter" || E === "line" ? /* @__PURE__ */ u(ze, { children: [
|
|
2432
|
+
E === "line" && d.data.length > 1 && /* @__PURE__ */ o(
|
|
2433
2433
|
"polyline",
|
|
2434
2434
|
{
|
|
2435
2435
|
fill: "none",
|
|
2436
|
-
stroke:
|
|
2437
|
-
strokeWidth: ((
|
|
2438
|
-
strokeDasharray: ((
|
|
2439
|
-
points: d.data.map((M,
|
|
2440
|
-
const
|
|
2441
|
-
return `${
|
|
2436
|
+
stroke: S,
|
|
2437
|
+
strokeWidth: ((N = d.line) == null ? void 0 : N.width) || 2,
|
|
2438
|
+
strokeDasharray: ((_ = d.line) == null ? void 0 : _.style) === "dashed" ? "5,5" : ((g = d.line) == null ? void 0 : g.style) === "dotted" ? "2,2" : void 0,
|
|
2439
|
+
points: d.data.map((M, z) => {
|
|
2440
|
+
const W = 10 + ((typeof M.x == "number" ? M.x : z) - C.xMin) / (C.xMax - C.xMin) * 85, T = 90 - (M.y - C.yMin) / (C.yMax - C.yMin) * 85;
|
|
2441
|
+
return `${W}%,${T}%`;
|
|
2442
2442
|
}).join(" ")
|
|
2443
2443
|
}
|
|
2444
2444
|
),
|
|
2445
|
-
d.data.map((M,
|
|
2446
|
-
var fe, be, ge,
|
|
2447
|
-
const
|
|
2445
|
+
d.data.map((M, z) => {
|
|
2446
|
+
var fe, be, ge, ye, we;
|
|
2447
|
+
const W = 10 + ((typeof M.x == "number" ? M.x : z) - C.xMin) / (C.xMax - C.xMin) * 85, T = 90 - (M.y - C.yMin) / (C.yMax - C.yMin) * 85, le = M.size || ((fe = d.marker) == null ? void 0 : fe.size) || 6;
|
|
2448
2448
|
return /* @__PURE__ */ u("g", { className: "nice-scientific-chart__point", children: [
|
|
2449
2449
|
M.error && /* @__PURE__ */ o(
|
|
2450
2450
|
"line",
|
|
2451
2451
|
{
|
|
2452
|
-
x1: `${
|
|
2453
|
-
y1: `${90 - (M.y + (Array.isArray(M.error) ? M.error[1] : M.error) -
|
|
2454
|
-
x2: `${
|
|
2455
|
-
y2: `${90 - (M.y - (Array.isArray(M.error) ? Math.abs(M.error[0]) : M.error) -
|
|
2456
|
-
stroke:
|
|
2452
|
+
x1: `${W}%`,
|
|
2453
|
+
y1: `${90 - (M.y + (Array.isArray(M.error) ? M.error[1] : M.error) - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2454
|
+
x2: `${W}%`,
|
|
2455
|
+
y2: `${90 - (M.y - (Array.isArray(M.error) ? Math.abs(M.error[0]) : M.error) - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2456
|
+
stroke: S,
|
|
2457
2457
|
strokeWidth: 1
|
|
2458
2458
|
}
|
|
2459
2459
|
),
|
|
2460
2460
|
/* @__PURE__ */ o(
|
|
2461
2461
|
"circle",
|
|
2462
2462
|
{
|
|
2463
|
-
cx: `${
|
|
2464
|
-
cy: `${
|
|
2463
|
+
cx: `${W}%`,
|
|
2464
|
+
cy: `${T}%`,
|
|
2465
2465
|
r: le / 2,
|
|
2466
|
-
fill: M.color || ((be = d.marker) == null ? void 0 : be.fillColor) ||
|
|
2467
|
-
stroke: ((ge = d.marker) == null ? void 0 : ge.strokeColor) ||
|
|
2468
|
-
strokeWidth: ((
|
|
2466
|
+
fill: M.color || ((be = d.marker) == null ? void 0 : be.fillColor) || S,
|
|
2467
|
+
stroke: ((ge = d.marker) == null ? void 0 : ge.strokeColor) || S,
|
|
2468
|
+
strokeWidth: ((ye = d.marker) == null ? void 0 : ye.strokeWidth) || 1,
|
|
2469
2469
|
opacity: ((we = d.marker) == null ? void 0 : we.opacity) ?? 1,
|
|
2470
2470
|
style: { cursor: L ? "pointer" : void 0 },
|
|
2471
2471
|
onMouseEnter: () => {
|
|
2472
|
-
Z({ seriesId: d.id, pointIndex:
|
|
2472
|
+
Z({ seriesId: d.id, pointIndex: z }), H == null || H(M, d);
|
|
2473
2473
|
},
|
|
2474
2474
|
onMouseLeave: () => {
|
|
2475
2475
|
Z(null), H == null || H(null, null);
|
|
2476
2476
|
},
|
|
2477
|
-
onClick: (
|
|
2477
|
+
onClick: (Se) => L == null ? void 0 : L(M, d, Se)
|
|
2478
2478
|
}
|
|
2479
2479
|
)
|
|
2480
|
-
] },
|
|
2480
|
+
] }, z);
|
|
2481
2481
|
}),
|
|
2482
2482
|
Q[`${d.id}_regression`] && /* @__PURE__ */ o(
|
|
2483
2483
|
"line",
|
|
2484
2484
|
{
|
|
2485
2485
|
x1: "10%",
|
|
2486
|
-
y1: `${90 - (Q[`${d.id}_regression`].intercept + Q[`${d.id}_regression`].slope *
|
|
2486
|
+
y1: `${90 - (Q[`${d.id}_regression`].intercept + Q[`${d.id}_regression`].slope * C.xMin - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2487
2487
|
x2: "95%",
|
|
2488
|
-
y2: `${90 - (Q[`${d.id}_regression`].intercept + Q[`${d.id}_regression`].slope *
|
|
2489
|
-
stroke:
|
|
2488
|
+
y2: `${90 - (Q[`${d.id}_regression`].intercept + Q[`${d.id}_regression`].slope * C.xMax - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2489
|
+
stroke: S,
|
|
2490
2490
|
strokeWidth: 1,
|
|
2491
2491
|
strokeDasharray: "5,3",
|
|
2492
2492
|
opacity: 0.7
|
|
@@ -2496,10 +2496,10 @@ function tn({
|
|
|
2496
2496
|
"line",
|
|
2497
2497
|
{
|
|
2498
2498
|
x1: "10%",
|
|
2499
|
-
y1: `${90 - (Q[`${d.id}_mean`] -
|
|
2499
|
+
y1: `${90 - (Q[`${d.id}_mean`] - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2500
2500
|
x2: "95%",
|
|
2501
|
-
y2: `${90 - (Q[`${d.id}_mean`] -
|
|
2502
|
-
stroke:
|
|
2501
|
+
y2: `${90 - (Q[`${d.id}_mean`] - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2502
|
+
stroke: S,
|
|
2503
2503
|
strokeWidth: 1,
|
|
2504
2504
|
strokeDasharray: "10,5",
|
|
2505
2505
|
opacity: 0.5
|
|
@@ -2510,7 +2510,7 @@ function tn({
|
|
|
2510
2510
|
/* @__PURE__ */ u("g", { className: "nice-scientific-chart__axes", stroke: k.axis, strokeWidth: 1, children: [
|
|
2511
2511
|
/* @__PURE__ */ o("line", { x1: "10%", y1: "90%", x2: "95%", y2: "90%" }),
|
|
2512
2512
|
/* @__PURE__ */ o("line", { x1: "10%", y1: "5%", x2: "10%", y2: "90%" }),
|
|
2513
|
-
|
|
2513
|
+
Ye(C.xMin, C.xMax, "linear", 6).map((d, x) => /* @__PURE__ */ u("g", { children: [
|
|
2514
2514
|
/* @__PURE__ */ o("line", { x1: `${10 + x * 17}%`, y1: "90%", x2: `${10 + x * 17}%`, y2: "92%" }),
|
|
2515
2515
|
/* @__PURE__ */ o(
|
|
2516
2516
|
"text",
|
|
@@ -2524,7 +2524,7 @@ function tn({
|
|
|
2524
2524
|
}
|
|
2525
2525
|
)
|
|
2526
2526
|
] }, `x-${x}`)),
|
|
2527
|
-
|
|
2527
|
+
Ye(C.yMin, C.yMax, "linear", 6).map((d, x) => /* @__PURE__ */ u("g", { children: [
|
|
2528
2528
|
/* @__PURE__ */ o("line", { x1: "8%", y1: `${90 - x * 17}%`, x2: "10%", y2: `${90 - x * 17}%` }),
|
|
2529
2529
|
/* @__PURE__ */ o(
|
|
2530
2530
|
"text",
|
|
@@ -2541,35 +2541,35 @@ function tn({
|
|
|
2541
2541
|
] }, `y-${x}`))
|
|
2542
2542
|
] }),
|
|
2543
2543
|
h.filter((d) => d.visible !== !1).map((d) => {
|
|
2544
|
-
var x,
|
|
2544
|
+
var x, S, E, N, _, g, M;
|
|
2545
2545
|
return /* @__PURE__ */ u("g", { className: "nice-scientific-chart__annotation", children: [
|
|
2546
2546
|
d.type === "text" && d.text && /* @__PURE__ */ o(
|
|
2547
2547
|
"text",
|
|
2548
2548
|
{
|
|
2549
|
-
x: `${10 + (d.position.x -
|
|
2550
|
-
y: `${90 - (d.position.y -
|
|
2549
|
+
x: `${10 + (d.position.x - C.xMin) / (C.xMax - C.xMin) * 85}%`,
|
|
2550
|
+
y: `${90 - (d.position.y - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2551
2551
|
fill: ((x = d.style) == null ? void 0 : x.color) || k.text,
|
|
2552
|
-
fontSize: ((
|
|
2553
|
-
fontWeight: (
|
|
2552
|
+
fontSize: ((S = d.style) == null ? void 0 : S.fontSize) || 12,
|
|
2553
|
+
fontWeight: (E = d.style) == null ? void 0 : E.fontWeight,
|
|
2554
2554
|
children: d.text
|
|
2555
2555
|
}
|
|
2556
2556
|
),
|
|
2557
2557
|
d.type === "line" && /* @__PURE__ */ o(
|
|
2558
2558
|
"line",
|
|
2559
2559
|
{
|
|
2560
|
-
x1: `${10 + (d.position.x -
|
|
2561
|
-
y1: `${90 - (d.position.y -
|
|
2562
|
-
x2: `${10 + (d.position.x2 -
|
|
2563
|
-
y2: `${90 - (d.position.y2 -
|
|
2564
|
-
stroke: ((
|
|
2565
|
-
strokeWidth: ((
|
|
2560
|
+
x1: `${10 + (d.position.x - C.xMin) / (C.xMax - C.xMin) * 85}%`,
|
|
2561
|
+
y1: `${90 - (d.position.y - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2562
|
+
x2: `${10 + (d.position.x2 - C.xMin) / (C.xMax - C.xMin) * 85}%`,
|
|
2563
|
+
y2: `${90 - (d.position.y2 - C.yMin) / (C.yMax - C.yMin) * 85}%`,
|
|
2564
|
+
stroke: ((N = d.style) == null ? void 0 : N.color) || k.text,
|
|
2565
|
+
strokeWidth: ((_ = d.style) == null ? void 0 : _.lineWidth) || 1,
|
|
2566
2566
|
strokeDasharray: ((g = d.style) == null ? void 0 : g.lineStyle) === "dashed" ? "5,5" : ((M = d.style) == null ? void 0 : M.lineStyle) === "dotted" ? "2,2" : void 0
|
|
2567
2567
|
}
|
|
2568
2568
|
)
|
|
2569
2569
|
] }, d.id);
|
|
2570
2570
|
})
|
|
2571
2571
|
] }),
|
|
2572
|
-
|
|
2572
|
+
y.enabled && X && /* @__PURE__ */ o(
|
|
2573
2573
|
"div",
|
|
2574
2574
|
{
|
|
2575
2575
|
className: "nice-scientific-chart__tooltip",
|
|
@@ -2579,13 +2579,13 @@ function tn({
|
|
|
2579
2579
|
background: k.tooltip,
|
|
2580
2580
|
border: `1px solid ${k.grid}`,
|
|
2581
2581
|
borderRadius: 4,
|
|
2582
|
-
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
2582
|
+
boxShadow: "0 2px 4px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))",
|
|
2583
2583
|
pointerEvents: "none",
|
|
2584
2584
|
fontSize: "0.75rem"
|
|
2585
2585
|
},
|
|
2586
2586
|
children: (() => {
|
|
2587
|
-
const d = e.find((
|
|
2588
|
-
return !d || !x ? null :
|
|
2587
|
+
const d = e.find((S) => S.id === X.seriesId), x = d == null ? void 0 : d.data[X.pointIndex];
|
|
2588
|
+
return !d || !x ? null : y.format ? y.format(x, d) : /* @__PURE__ */ u(ze, { children: [
|
|
2589
2589
|
/* @__PURE__ */ o("div", { style: { fontWeight: "bold" }, children: d.name }),
|
|
2590
2590
|
/* @__PURE__ */ u("div", { children: [
|
|
2591
2591
|
"X: ",
|
|
@@ -2625,7 +2625,7 @@ function tn({
|
|
|
2625
2625
|
]
|
|
2626
2626
|
}
|
|
2627
2627
|
),
|
|
2628
|
-
|
|
2628
|
+
m.enabled && m.resetButton && (me.x || me.y) && /* @__PURE__ */ o(
|
|
2629
2629
|
"button",
|
|
2630
2630
|
{
|
|
2631
2631
|
onClick: ie,
|
|
@@ -2681,7 +2681,7 @@ const Pe = {
|
|
|
2681
2681
|
panX: 0,
|
|
2682
2682
|
panY: 0
|
|
2683
2683
|
};
|
|
2684
|
-
function
|
|
2684
|
+
function Ft(e, t) {
|
|
2685
2685
|
const n = t * Math.PI / 180, r = Math.cos(n), i = Math.sin(n);
|
|
2686
2686
|
return {
|
|
2687
2687
|
x: e.x,
|
|
@@ -2706,7 +2706,7 @@ function Rt(e, t) {
|
|
|
2706
2706
|
};
|
|
2707
2707
|
}
|
|
2708
2708
|
function Me(e, t, n) {
|
|
2709
|
-
let r =
|
|
2709
|
+
let r = Ft(e, n.rotationX);
|
|
2710
2710
|
r = Bt(r, n.rotationY), r = Rt(r, n.rotationZ);
|
|
2711
2711
|
const i = r.z + t, s = t / Math.max(i, 0.1);
|
|
2712
2712
|
return {
|
|
@@ -2807,11 +2807,11 @@ function ke(e, t, n, r) {
|
|
|
2807
2807
|
]
|
|
2808
2808
|
}, a = s[r] || s.viridis, l = i * (a.length - 1), c = Math.floor(l), h = l - c;
|
|
2809
2809
|
if (c >= a.length - 1) {
|
|
2810
|
-
const
|
|
2811
|
-
return `rgb(${
|
|
2810
|
+
const F = a[a.length - 1];
|
|
2811
|
+
return `rgb(${F[0]}, ${F[1]}, ${F[2]})`;
|
|
2812
2812
|
}
|
|
2813
|
-
const p = a[c],
|
|
2814
|
-
return `rgb(${
|
|
2813
|
+
const p = a[c], y = a[c + 1], m = Math.round(p[0] + h * (y[0] - p[0])), $ = Math.round(p[1] + h * (y[1] - p[1])), w = Math.round(p[2] + h * (y[2] - p[2]));
|
|
2814
|
+
return `rgb(${m}, ${$}, ${w})`;
|
|
2815
2815
|
}
|
|
2816
2816
|
function nn({
|
|
2817
2817
|
data: e,
|
|
@@ -2825,60 +2825,60 @@ function nn({
|
|
|
2825
2825
|
legendPosition: c = "top-right",
|
|
2826
2826
|
enableRotation: h = !0,
|
|
2827
2827
|
enableZoom: p = !0,
|
|
2828
|
-
enablePan:
|
|
2829
|
-
showAxes:
|
|
2828
|
+
enablePan: y = !0,
|
|
2829
|
+
showAxes: m = !0,
|
|
2830
2830
|
showAxisLabels: $ = !0,
|
|
2831
2831
|
focalLength: w = 3,
|
|
2832
|
-
theme:
|
|
2832
|
+
theme: F = "light",
|
|
2833
2833
|
onCameraChange: J,
|
|
2834
2834
|
onPointClick: te,
|
|
2835
2835
|
onPointHover: V,
|
|
2836
2836
|
className: L,
|
|
2837
2837
|
style: H
|
|
2838
2838
|
}) {
|
|
2839
|
-
const oe =
|
|
2839
|
+
const oe = Ae(null), [U, de] = j(Pe), [pe, se] = j(!1), [ne, Y] = j(
|
|
2840
2840
|
null
|
|
2841
|
-
), [ce, ue] =
|
|
2841
|
+
), [ce, ue] = j(
|
|
2842
2842
|
null
|
|
2843
|
-
), [
|
|
2844
|
-
let
|
|
2843
|
+
), [me, xe] = j(0), X = K(() => {
|
|
2844
|
+
let A = 1 / 0, k = -1 / 0, d = 1 / 0, x = -1 / 0, S = 1 / 0, E = -1 / 0, N = 1 / 0, _ = -1 / 0;
|
|
2845
2845
|
for (const M of e)
|
|
2846
2846
|
if (M.type === "scatter3d")
|
|
2847
|
-
for (const
|
|
2848
|
-
|
|
2847
|
+
for (const z of M.points)
|
|
2848
|
+
A = Math.min(A, z.x), k = Math.max(k, z.x), d = Math.min(d, z.y), x = Math.max(x, z.y), S = Math.min(S, z.z), E = Math.max(E, z.z), typeof z.color == "number" && (N = Math.min(N, z.color), _ = Math.max(_, z.color));
|
|
2849
2849
|
else if (M.type === "surface" || M.type === "wireframe") {
|
|
2850
|
-
const
|
|
2851
|
-
for (const
|
|
2852
|
-
|
|
2853
|
-
for (const
|
|
2854
|
-
d = Math.min(d,
|
|
2855
|
-
for (const
|
|
2856
|
-
for (const
|
|
2857
|
-
|
|
2850
|
+
const z = M;
|
|
2851
|
+
for (const W of z.xData)
|
|
2852
|
+
A = Math.min(A, W), k = Math.max(k, W);
|
|
2853
|
+
for (const W of z.yData)
|
|
2854
|
+
d = Math.min(d, W), x = Math.max(x, W);
|
|
2855
|
+
for (const W of z.zData)
|
|
2856
|
+
for (const T of W)
|
|
2857
|
+
S = Math.min(S, T), E = Math.max(E, T), N = Math.min(N, T), _ = Math.max(_, T);
|
|
2858
2858
|
}
|
|
2859
|
-
const g = Math.max(k -
|
|
2860
|
-
return { xMin:
|
|
2859
|
+
const g = Math.max(k - A, x - d, E - S) || 1;
|
|
2860
|
+
return { xMin: A, xMax: k, yMin: d, yMax: x, zMin: S, zMax: E, colorMin: N, colorMax: _, maxRange: g };
|
|
2861
2861
|
}, [e]), Z = P(
|
|
2862
|
-
(
|
|
2863
|
-
const k = 2 /
|
|
2862
|
+
(A) => {
|
|
2863
|
+
const k = 2 / X.maxRange;
|
|
2864
2864
|
return {
|
|
2865
|
-
x: (
|
|
2866
|
-
y: (
|
|
2867
|
-
z: (
|
|
2865
|
+
x: (A.x - (X.xMin + X.xMax) / 2) * k,
|
|
2866
|
+
y: (A.y - (X.yMin + X.yMax) / 2) * k,
|
|
2867
|
+
z: (A.z - (X.zMin + X.zMax) / 2) * k
|
|
2868
2868
|
};
|
|
2869
2869
|
},
|
|
2870
|
-
[
|
|
2870
|
+
[X]
|
|
2871
2871
|
), ae = P(
|
|
2872
|
-
(
|
|
2873
|
-
!h && !
|
|
2872
|
+
(A) => {
|
|
2873
|
+
!h && !y || (se(!0), Y({ x: A.clientX, y: A.clientY, viewState: { ...U } }));
|
|
2874
2874
|
},
|
|
2875
|
-
[h,
|
|
2875
|
+
[h, y, U]
|
|
2876
2876
|
), G = P(
|
|
2877
|
-
(
|
|
2877
|
+
(A) => {
|
|
2878
2878
|
if (!pe || !ne)
|
|
2879
2879
|
return;
|
|
2880
|
-
const k =
|
|
2881
|
-
|
|
2880
|
+
const k = A.clientX - ne.x, d = A.clientY - ne.y;
|
|
2881
|
+
A.shiftKey && y ? de({
|
|
2882
2882
|
...ne.viewState,
|
|
2883
2883
|
panX: ne.viewState.panX + k * 2e-3,
|
|
2884
2884
|
panY: ne.viewState.panY + d * 2e-3
|
|
@@ -2888,15 +2888,15 @@ function nn({
|
|
|
2888
2888
|
rotationX: ne.viewState.rotationX + d * 0.5
|
|
2889
2889
|
});
|
|
2890
2890
|
},
|
|
2891
|
-
[pe, ne, h,
|
|
2892
|
-
),
|
|
2893
|
-
se(!1),
|
|
2891
|
+
[pe, ne, h, y]
|
|
2892
|
+
), C = P(() => {
|
|
2893
|
+
se(!1), Y(null);
|
|
2894
2894
|
}, []), Q = P(
|
|
2895
|
-
(
|
|
2895
|
+
(A) => {
|
|
2896
2896
|
if (!p)
|
|
2897
2897
|
return;
|
|
2898
|
-
|
|
2899
|
-
const k =
|
|
2898
|
+
A.preventDefault();
|
|
2899
|
+
const k = A.deltaY > 0 ? 0.9 : 1.1;
|
|
2900
2900
|
de((d) => ({
|
|
2901
2901
|
...d,
|
|
2902
2902
|
zoom: Math.max(0.1, Math.min(10, d.zoom * k))
|
|
@@ -2904,83 +2904,83 @@ function nn({
|
|
|
2904
2904
|
},
|
|
2905
2905
|
[p]
|
|
2906
2906
|
), ee = K(() => {
|
|
2907
|
-
switch (
|
|
2907
|
+
switch (F) {
|
|
2908
2908
|
case "dark":
|
|
2909
|
-
return { bg: "#1a1a2e", text: "#e0e0e0", axis: "#555", grid: "#333" };
|
|
2909
|
+
return { bg: "var(--nice-bg, #1a1a2e)", text: "var(--nice-border, #e0e0e0)", axis: "var(--nice-text-secondary, #555)", grid: "var(--nice-text, #333)" };
|
|
2910
2910
|
case "scientific":
|
|
2911
|
-
return { bg: "#f8f8f8", text: "#333", axis: "#666", grid: "#ddd" };
|
|
2911
|
+
return { bg: "var(--nice-bg-secondary, #f8f8f8)", text: "var(--nice-text, #333)", axis: "var(--nice-text-secondary, #666)", grid: "var(--nice-border, #ddd)" };
|
|
2912
2912
|
default:
|
|
2913
|
-
return { bg: "#
|
|
2913
|
+
return { bg: "var(--nice-bg, #fff)", text: "var(--nice-text, #333)", axis: "var(--nice-text-secondary, #888)", grid: "var(--nice-border, #e0e0e0)" };
|
|
2914
2914
|
}
|
|
2915
|
-
}, [
|
|
2915
|
+
}, [F]), re = K(() => {
|
|
2916
2916
|
var k;
|
|
2917
|
-
const
|
|
2917
|
+
const A = [];
|
|
2918
2918
|
for (const d of e)
|
|
2919
2919
|
if (d.type === "scatter3d") {
|
|
2920
|
-
const x = d,
|
|
2921
|
-
var
|
|
2922
|
-
const
|
|
2923
|
-
let g = (
|
|
2924
|
-
if (Array.isArray((
|
|
2925
|
-
const be = x.points.indexOf(
|
|
2920
|
+
const x = d, S = x.points.map((E) => {
|
|
2921
|
+
var z, W, T, le, fe;
|
|
2922
|
+
const N = Z(E), _ = Me(N, w, U);
|
|
2923
|
+
let g = (z = x.marker) == null ? void 0 : z.color;
|
|
2924
|
+
if (Array.isArray((W = x.marker) == null ? void 0 : W.color)) {
|
|
2925
|
+
const be = x.points.indexOf(E);
|
|
2926
2926
|
g = ke(
|
|
2927
2927
|
x.marker.color[be],
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
((
|
|
2928
|
+
X.colorMin,
|
|
2929
|
+
X.colorMax,
|
|
2930
|
+
((T = x.marker) == null ? void 0 : T.colorScale) || "viridis"
|
|
2931
2931
|
);
|
|
2932
|
-
} else typeof
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2932
|
+
} else typeof E.color == "number" && (g = ke(
|
|
2933
|
+
E.color,
|
|
2934
|
+
X.colorMin,
|
|
2935
|
+
X.colorMax,
|
|
2936
2936
|
((le = x.marker) == null ? void 0 : le.colorScale) || "viridis"
|
|
2937
2937
|
));
|
|
2938
|
-
const M = Array.isArray(
|
|
2938
|
+
const M = Array.isArray(E.size) ? E.size[0] : E.size || ((fe = x.marker) == null ? void 0 : fe.size) || 5;
|
|
2939
2939
|
return {
|
|
2940
|
-
...
|
|
2940
|
+
..._,
|
|
2941
2941
|
color: g,
|
|
2942
2942
|
size: M,
|
|
2943
|
-
original:
|
|
2943
|
+
original: E
|
|
2944
2944
|
};
|
|
2945
2945
|
});
|
|
2946
|
-
|
|
2946
|
+
A.push({ type: "scatter", points: S, data: d });
|
|
2947
2947
|
} else if (d.type === "surface" || d.type === "wireframe") {
|
|
2948
|
-
const x = d,
|
|
2949
|
-
for (let
|
|
2950
|
-
for (let
|
|
2951
|
-
const
|
|
2952
|
-
x: x.xData[
|
|
2953
|
-
y: x.yData[
|
|
2954
|
-
z: x.zData[
|
|
2955
|
-
}, g = Z(
|
|
2956
|
-
((k = x.colorData) == null ? void 0 : k[
|
|
2957
|
-
|
|
2958
|
-
|
|
2948
|
+
const x = d, S = [];
|
|
2949
|
+
for (let E = 0; E < x.xData.length; E++)
|
|
2950
|
+
for (let N = 0; N < x.yData.length; N++) {
|
|
2951
|
+
const _ = {
|
|
2952
|
+
x: x.xData[E],
|
|
2953
|
+
y: x.yData[N],
|
|
2954
|
+
z: x.zData[E][N]
|
|
2955
|
+
}, g = Z(_), M = Me(g, w, U), z = ke(
|
|
2956
|
+
((k = x.colorData) == null ? void 0 : k[E][N]) ?? x.zData[E][N],
|
|
2957
|
+
X.colorMin,
|
|
2958
|
+
X.colorMax,
|
|
2959
2959
|
x.colorScale || "viridis"
|
|
2960
2960
|
);
|
|
2961
|
-
|
|
2961
|
+
S.push({ ...M, color: z, size: 3, original: _ });
|
|
2962
2962
|
}
|
|
2963
|
-
|
|
2963
|
+
A.push({ type: d.type, points: S, data: d });
|
|
2964
2964
|
}
|
|
2965
|
-
for (const d of
|
|
2966
|
-
d.points.sort((x,
|
|
2967
|
-
return
|
|
2968
|
-
}, [e, U, w, Z,
|
|
2969
|
-
var d, x,
|
|
2970
|
-
if (!
|
|
2965
|
+
for (const d of A)
|
|
2966
|
+
d.points.sort((x, S) => x.depth - S.depth);
|
|
2967
|
+
return A;
|
|
2968
|
+
}, [e, U, w, Z, X]), ie = K(() => {
|
|
2969
|
+
var d, x, S;
|
|
2970
|
+
if (!m)
|
|
2971
2971
|
return null;
|
|
2972
|
-
const
|
|
2972
|
+
const A = 1.2, k = {
|
|
2973
2973
|
x: [
|
|
2974
|
-
Me({ x: -
|
|
2975
|
-
Me({ x:
|
|
2974
|
+
Me({ x: -A, y: 0, z: 0 }, w, U),
|
|
2975
|
+
Me({ x: A, y: 0, z: 0 }, w, U)
|
|
2976
2976
|
],
|
|
2977
2977
|
y: [
|
|
2978
|
-
Me({ x: 0, y: -
|
|
2979
|
-
Me({ x: 0, y:
|
|
2978
|
+
Me({ x: 0, y: -A, z: 0 }, w, U),
|
|
2979
|
+
Me({ x: 0, y: A, z: 0 }, w, U)
|
|
2980
2980
|
],
|
|
2981
2981
|
z: [
|
|
2982
|
-
Me({ x: 0, y: 0, z: -
|
|
2983
|
-
Me({ x: 0, y: 0, z }, w, U)
|
|
2982
|
+
Me({ x: 0, y: 0, z: -A }, w, U),
|
|
2983
|
+
Me({ x: 0, y: 0, z: A }, w, U)
|
|
2984
2984
|
]
|
|
2985
2985
|
};
|
|
2986
2986
|
return /* @__PURE__ */ u("g", { className: "nice-3d-plot__axes", children: [
|
|
@@ -2991,7 +2991,7 @@ function nn({
|
|
|
2991
2991
|
y1: `${k.x[0].y}%`,
|
|
2992
2992
|
x2: `${k.x[1].x}%`,
|
|
2993
2993
|
y2: `${k.x[1].y}%`,
|
|
2994
|
-
stroke: "#e74c3c",
|
|
2994
|
+
stroke: "var(--nice-danger, #e74c3c)",
|
|
2995
2995
|
strokeWidth: 1.5
|
|
2996
2996
|
}
|
|
2997
2997
|
),
|
|
@@ -3000,7 +3000,7 @@ function nn({
|
|
|
3000
3000
|
{
|
|
3001
3001
|
x: `${k.x[1].x + 2}%`,
|
|
3002
3002
|
y: `${k.x[1].y}%`,
|
|
3003
|
-
fill: "#e74c3c",
|
|
3003
|
+
fill: "var(--nice-danger, #e74c3c)",
|
|
3004
3004
|
fontSize: "12",
|
|
3005
3005
|
children: ((d = i.xAxis) == null ? void 0 : d.title) || "X"
|
|
3006
3006
|
}
|
|
@@ -3012,7 +3012,7 @@ function nn({
|
|
|
3012
3012
|
y1: `${k.y[0].y}%`,
|
|
3013
3013
|
x2: `${k.y[1].x}%`,
|
|
3014
3014
|
y2: `${k.y[1].y}%`,
|
|
3015
|
-
stroke: "#2ecc71",
|
|
3015
|
+
stroke: "var(--nice-success, #2ecc71)",
|
|
3016
3016
|
strokeWidth: 1.5
|
|
3017
3017
|
}
|
|
3018
3018
|
),
|
|
@@ -3021,7 +3021,7 @@ function nn({
|
|
|
3021
3021
|
{
|
|
3022
3022
|
x: `${k.y[1].x}%`,
|
|
3023
3023
|
y: `${k.y[1].y - 2}%`,
|
|
3024
|
-
fill: "#2ecc71",
|
|
3024
|
+
fill: "var(--nice-success, #2ecc71)",
|
|
3025
3025
|
fontSize: "12",
|
|
3026
3026
|
textAnchor: "middle",
|
|
3027
3027
|
children: ((x = i.yAxis) == null ? void 0 : x.title) || "Y"
|
|
@@ -3034,7 +3034,7 @@ function nn({
|
|
|
3034
3034
|
y1: `${k.z[0].y}%`,
|
|
3035
3035
|
x2: `${k.z[1].x}%`,
|
|
3036
3036
|
y2: `${k.z[1].y}%`,
|
|
3037
|
-
stroke: "#3498db",
|
|
3037
|
+
stroke: "var(--nice-primary, #3498db)",
|
|
3038
3038
|
strokeWidth: 1.5
|
|
3039
3039
|
}
|
|
3040
3040
|
),
|
|
@@ -3043,18 +3043,18 @@ function nn({
|
|
|
3043
3043
|
{
|
|
3044
3044
|
x: `${k.z[1].x + 2}%`,
|
|
3045
3045
|
y: `${k.z[1].y}%`,
|
|
3046
|
-
fill: "#3498db",
|
|
3046
|
+
fill: "var(--nice-primary, #3498db)",
|
|
3047
3047
|
fontSize: "12",
|
|
3048
|
-
children: ((
|
|
3048
|
+
children: ((S = i.zAxis) == null ? void 0 : S.title) || "Z"
|
|
3049
3049
|
}
|
|
3050
3050
|
)
|
|
3051
3051
|
] });
|
|
3052
|
-
}, [
|
|
3052
|
+
}, [m, $, U, w, i]);
|
|
3053
3053
|
return /* @__PURE__ */ u(
|
|
3054
3054
|
"div",
|
|
3055
3055
|
{
|
|
3056
3056
|
ref: oe,
|
|
3057
|
-
className: `nice-3d-plot nice-3d-plot--${
|
|
3057
|
+
className: `nice-3d-plot nice-3d-plot--${F} ${L || ""}`,
|
|
3058
3058
|
style: {
|
|
3059
3059
|
width: n,
|
|
3060
3060
|
height: r,
|
|
@@ -3068,8 +3068,8 @@ function nn({
|
|
|
3068
3068
|
},
|
|
3069
3069
|
onMouseDown: ae,
|
|
3070
3070
|
onMouseMove: G,
|
|
3071
|
-
onMouseUp:
|
|
3072
|
-
onMouseLeave:
|
|
3071
|
+
onMouseUp: C,
|
|
3072
|
+
onMouseLeave: C,
|
|
3073
3073
|
onWheel: Q,
|
|
3074
3074
|
children: [
|
|
3075
3075
|
t && /* @__PURE__ */ o(
|
|
@@ -3081,17 +3081,17 @@ function nn({
|
|
|
3081
3081
|
),
|
|
3082
3082
|
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", style: { position: "absolute", top: 0, left: 0 }, children: [
|
|
3083
3083
|
ie,
|
|
3084
|
-
re.map((
|
|
3085
|
-
|
|
3086
|
-
var
|
|
3084
|
+
re.map((A, k) => /* @__PURE__ */ u("g", { className: "nice-3d-plot__data", children: [
|
|
3085
|
+
A.type === "scatter" && A.points.map((d, x) => {
|
|
3086
|
+
var S;
|
|
3087
3087
|
return /* @__PURE__ */ o(
|
|
3088
3088
|
"circle",
|
|
3089
3089
|
{
|
|
3090
3090
|
cx: `${d.x}%`,
|
|
3091
3091
|
cy: `${d.y}%`,
|
|
3092
3092
|
r: d.size || 4,
|
|
3093
|
-
fill: d.color || "#3498db",
|
|
3094
|
-
opacity: ((
|
|
3093
|
+
fill: d.color || "var(--nice-primary, #3498db)",
|
|
3094
|
+
opacity: ((S = A.data.marker) == null ? void 0 : S.opacity) ?? 0.8,
|
|
3095
3095
|
style: { cursor: te ? "pointer" : void 0 },
|
|
3096
3096
|
onMouseEnter: () => {
|
|
3097
3097
|
ue({ point: d.original, dataIndex: k }), V == null || V(d.original, k);
|
|
@@ -3104,19 +3104,19 @@ function nn({
|
|
|
3104
3104
|
x
|
|
3105
3105
|
);
|
|
3106
3106
|
}),
|
|
3107
|
-
(
|
|
3107
|
+
(A.type === "surface" || A.type === "wireframe") && A.points.map((d, x) => /* @__PURE__ */ o(
|
|
3108
3108
|
"rect",
|
|
3109
3109
|
{
|
|
3110
3110
|
x: `${d.x - 1}%`,
|
|
3111
3111
|
y: `${d.y - 1}%`,
|
|
3112
3112
|
width: "2%",
|
|
3113
3113
|
height: "2%",
|
|
3114
|
-
fill: d.color || "#3498db",
|
|
3115
|
-
opacity:
|
|
3114
|
+
fill: d.color || "var(--nice-primary, #3498db)",
|
|
3115
|
+
opacity: A.data.opacity ?? 0.7
|
|
3116
3116
|
},
|
|
3117
3117
|
x
|
|
3118
3118
|
))
|
|
3119
|
-
] },
|
|
3119
|
+
] }, A.data.id || k))
|
|
3120
3120
|
] }),
|
|
3121
3121
|
l && e.length > 1 && /* @__PURE__ */ o(
|
|
3122
3122
|
"div",
|
|
@@ -3124,7 +3124,7 @@ function nn({
|
|
|
3124
3124
|
style: {
|
|
3125
3125
|
position: "absolute",
|
|
3126
3126
|
padding: "8px",
|
|
3127
|
-
background: "rgba(255,255,255,0.9)",
|
|
3127
|
+
background: "var(--nice-overlay-light-90, rgba(255, 255, 255, 0.9))",
|
|
3128
3128
|
borderRadius: 4,
|
|
3129
3129
|
fontSize: "0.8rem",
|
|
3130
3130
|
...c === "top-right" && { top: 8, right: 8 },
|
|
@@ -3132,10 +3132,10 @@ function nn({
|
|
|
3132
3132
|
...c === "bottom-right" && { bottom: 8, right: 8 },
|
|
3133
3133
|
...c === "bottom-left" && { bottom: 8, left: 8 }
|
|
3134
3134
|
},
|
|
3135
|
-
children: e.map((
|
|
3136
|
-
/* @__PURE__ */ o("span", { style: { width: 12, height: 12, background: "#3498db", borderRadius: 2 } }),
|
|
3137
|
-
|
|
3138
|
-
] },
|
|
3135
|
+
children: e.map((A, k) => /* @__PURE__ */ u("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
3136
|
+
/* @__PURE__ */ o("span", { style: { width: 12, height: 12, background: "var(--nice-primary, #3498db)", borderRadius: 2 } }),
|
|
3137
|
+
A.name
|
|
3138
|
+
] }, A.id || k))
|
|
3139
3139
|
}
|
|
3140
3140
|
),
|
|
3141
3141
|
s && /* @__PURE__ */ u(
|
|
@@ -3150,11 +3150,11 @@ function nn({
|
|
|
3150
3150
|
height: 150,
|
|
3151
3151
|
background: `linear-gradient(to top, ${ke(0, 0, 1, "viridis")}, ${ke(0.5, 0, 1, "viridis")}, ${ke(1, 0, 1, "viridis")})`,
|
|
3152
3152
|
borderRadius: 2,
|
|
3153
|
-
border: "1px solid #ccc"
|
|
3153
|
+
border: "1px solid var(--nice-border, #ccc)"
|
|
3154
3154
|
},
|
|
3155
3155
|
children: [
|
|
3156
|
-
/* @__PURE__ */ o("div", { style: { position: "absolute", top: -16, right: 20, fontSize: "0.7rem" }, children:
|
|
3157
|
-
/* @__PURE__ */ o("div", { style: { position: "absolute", bottom: -16, right: 20, fontSize: "0.7rem" }, children:
|
|
3156
|
+
/* @__PURE__ */ o("div", { style: { position: "absolute", top: -16, right: 20, fontSize: "0.7rem" }, children: X.colorMax.toFixed(2) }),
|
|
3157
|
+
/* @__PURE__ */ o("div", { style: { position: "absolute", bottom: -16, right: 20, fontSize: "0.7rem" }, children: X.colorMin.toFixed(2) })
|
|
3158
3158
|
]
|
|
3159
3159
|
}
|
|
3160
3160
|
),
|
|
@@ -3165,8 +3165,8 @@ function nn({
|
|
|
3165
3165
|
position: "absolute",
|
|
3166
3166
|
bottom: 8,
|
|
3167
3167
|
left: 8,
|
|
3168
|
-
background: "rgba(0,0,0,0.8)",
|
|
3169
|
-
color: "#fff",
|
|
3168
|
+
background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
|
|
3169
|
+
color: "var(--nice-bg, #fff)",
|
|
3170
3170
|
padding: "4px 8px",
|
|
3171
3171
|
borderRadius: 4,
|
|
3172
3172
|
fontSize: "0.75rem"
|
|
@@ -3195,7 +3195,7 @@ function nn({
|
|
|
3195
3195
|
);
|
|
3196
3196
|
}
|
|
3197
3197
|
const tt = {
|
|
3198
|
-
H: "#
|
|
3198
|
+
H: "var(--nice-bg, #fff)",
|
|
3199
3199
|
C: "#909090",
|
|
3200
3200
|
N: "#3050F8",
|
|
3201
3201
|
O: "#FF0D0D",
|
|
@@ -3218,7 +3218,7 @@ const tt = {
|
|
|
3218
3218
|
Be: "#C2FF00",
|
|
3219
3219
|
Mg: "#8AFF00",
|
|
3220
3220
|
Ca: "#3DFF00",
|
|
3221
|
-
Sr: "#
|
|
3221
|
+
Sr: "var(--nice-success, #00ff00)",
|
|
3222
3222
|
Ba: "#00C900",
|
|
3223
3223
|
B: "#FFB5B5",
|
|
3224
3224
|
Al: "#BFA6A6",
|
|
@@ -3253,7 +3253,7 @@ const tt = {
|
|
|
3253
3253
|
Rh: "#0A7D8C",
|
|
3254
3254
|
Os: "#266696",
|
|
3255
3255
|
Ir: "#175487"
|
|
3256
|
-
},
|
|
3256
|
+
}, Fe = {
|
|
3257
3257
|
H: 0.31,
|
|
3258
3258
|
C: 0.77,
|
|
3259
3259
|
N: 0.71,
|
|
@@ -3310,39 +3310,39 @@ function Ve(e) {
|
|
|
3310
3310
|
if (c === "HEADER")
|
|
3311
3311
|
s = l.substring(10, 50).trim() || s;
|
|
3312
3312
|
else if (c === "ATOM" || c === "HETATM") {
|
|
3313
|
-
const h = parseInt(l.substring(6, 11).trim(), 10), p = l.substring(12, 16).trim(),
|
|
3313
|
+
const h = parseInt(l.substring(6, 11).trim(), 10), p = l.substring(12, 16).trim(), y = l.substring(17, 20).trim(), m = l.substring(21, 22).trim() || "A", $ = parseInt(l.substring(22, 26).trim(), 10), w = parseFloat(l.substring(30, 38).trim()), F = parseFloat(l.substring(38, 46).trim()), J = parseFloat(l.substring(46, 54).trim()), te = parseFloat(l.substring(54, 60).trim()) || 1, V = parseFloat(l.substring(60, 66).trim()) || 0, L = l.substring(76, 78).trim() || p.replace(/\d/g, "").substring(0, 1), H = {
|
|
3314
3314
|
id: t.length,
|
|
3315
3315
|
serial: h,
|
|
3316
3316
|
name: p,
|
|
3317
3317
|
element: L.toUpperCase(),
|
|
3318
|
-
residueName:
|
|
3318
|
+
residueName: y,
|
|
3319
3319
|
residueSeq: $,
|
|
3320
|
-
chainId:
|
|
3320
|
+
chainId: m,
|
|
3321
3321
|
x: w,
|
|
3322
|
-
y:
|
|
3322
|
+
y: F,
|
|
3323
3323
|
z: J,
|
|
3324
3324
|
occupancy: te,
|
|
3325
3325
|
bFactor: V,
|
|
3326
|
-
color: tt[L.toUpperCase()] || "#808080",
|
|
3327
|
-
radius:
|
|
3326
|
+
color: tt[L.toUpperCase()] || "var(--nice-text-secondary, #808080)",
|
|
3327
|
+
radius: Fe[L.toUpperCase()] || 1.5
|
|
3328
3328
|
};
|
|
3329
3329
|
t.push(H);
|
|
3330
|
-
const oe = `${
|
|
3330
|
+
const oe = `${m}_${$}_${y}`;
|
|
3331
3331
|
r.has(oe) || r.set(oe, {
|
|
3332
3332
|
id: r.size,
|
|
3333
|
-
name:
|
|
3333
|
+
name: y,
|
|
3334
3334
|
seq: $,
|
|
3335
|
-
chainId:
|
|
3335
|
+
chainId: m,
|
|
3336
3336
|
atoms: []
|
|
3337
|
-
}), r.get(oe).atoms.push(H.id), i.has(
|
|
3337
|
+
}), r.get(oe).atoms.push(H.id), i.has(m) || i.set(m, { id: m, residues: [] });
|
|
3338
3338
|
} else if (c === "CONECT") {
|
|
3339
|
-
const h = l.substring(6).trim().split(/\s+/).map(Number), p = h[0],
|
|
3340
|
-
if (
|
|
3341
|
-
for (let
|
|
3342
|
-
const $ = h[
|
|
3343
|
-
w &&
|
|
3339
|
+
const h = l.substring(6).trim().split(/\s+/).map(Number), p = h[0], y = t.find((m) => m.serial === p);
|
|
3340
|
+
if (y)
|
|
3341
|
+
for (let m = 1; m < h.length; m++) {
|
|
3342
|
+
const $ = h[m], w = t.find((F) => F.serial === $);
|
|
3343
|
+
w && y.id < w.id && n.push({
|
|
3344
3344
|
id: n.length,
|
|
3345
|
-
atom1:
|
|
3345
|
+
atom1: y.id,
|
|
3346
3346
|
atom2: w.id,
|
|
3347
3347
|
order: 1
|
|
3348
3348
|
});
|
|
@@ -3352,8 +3352,8 @@ function Ve(e) {
|
|
|
3352
3352
|
if (n.length === 0)
|
|
3353
3353
|
for (let l = 0; l < t.length; l++)
|
|
3354
3354
|
for (let c = l + 1; c < t.length; c++) {
|
|
3355
|
-
const h = t[l], p = t[c],
|
|
3356
|
-
w <
|
|
3355
|
+
const h = t[l], p = t[c], y = h.x - p.x, m = h.y - p.y, $ = h.z - p.z, w = Math.sqrt(y * y + m * m + $ * $), F = (Fe[h.element] || 1.5) + (Fe[p.element] || 1.5) + 0.4;
|
|
3356
|
+
w < F && w > 0.4 && n.push({
|
|
3357
3357
|
id: n.length,
|
|
3358
3358
|
atom1: l,
|
|
3359
3359
|
atom2: c,
|
|
@@ -3370,16 +3370,16 @@ function Ve(e) {
|
|
|
3370
3370
|
chains: Array.from(i.values())
|
|
3371
3371
|
};
|
|
3372
3372
|
}
|
|
3373
|
-
function
|
|
3374
|
-
const a = ($) => $ * Math.PI / 180, l = t * Math.cos(a(r)) - n * Math.sin(a(r)), c = t * Math.sin(a(r)) + n * Math.cos(a(r)), h = e * Math.cos(a(i)) + c * Math.sin(a(i)), p = -e * Math.sin(a(i)) + c * Math.cos(a(i)),
|
|
3375
|
-
return [
|
|
3373
|
+
function _t(e, t, n, r, i, s) {
|
|
3374
|
+
const a = ($) => $ * Math.PI / 180, l = t * Math.cos(a(r)) - n * Math.sin(a(r)), c = t * Math.sin(a(r)) + n * Math.cos(a(r)), h = e * Math.cos(a(i)) + c * Math.sin(a(i)), p = -e * Math.sin(a(i)) + c * Math.cos(a(i)), y = h * Math.cos(a(s)) - l * Math.sin(a(s)), m = h * Math.sin(a(s)) + l * Math.cos(a(s));
|
|
3375
|
+
return [y, m, p];
|
|
3376
3376
|
}
|
|
3377
|
-
function
|
|
3378
|
-
const a = e - i.x, l = t - i.y, c = n - i.z, [h, p,
|
|
3377
|
+
function je(e, t, n, r, i, s) {
|
|
3378
|
+
const a = e - i.x, l = t - i.y, c = n - i.z, [h, p, y] = _t(a, l, c, r.rotX, r.rotY, r.rotZ), m = 500, $ = m / (m + y * 50);
|
|
3379
3379
|
return {
|
|
3380
3380
|
x: 50 + h * s * r.zoom * $ + r.panX,
|
|
3381
3381
|
y: 50 - p * s * r.zoom * $ + r.panY,
|
|
3382
|
-
depth:
|
|
3382
|
+
depth: y
|
|
3383
3383
|
};
|
|
3384
3384
|
}
|
|
3385
3385
|
function rn({
|
|
@@ -3393,15 +3393,15 @@ function rn({
|
|
|
3393
3393
|
labelType: l = "element",
|
|
3394
3394
|
width: c = "100%",
|
|
3395
3395
|
height: h = 500,
|
|
3396
|
-
backgroundColor: p = "#000000",
|
|
3397
|
-
enableRotation:
|
|
3398
|
-
enableZoom:
|
|
3396
|
+
backgroundColor: p = "var(--nice-text, #000000)",
|
|
3397
|
+
enableRotation: y = !0,
|
|
3398
|
+
enableZoom: m = !0,
|
|
3399
3399
|
showControls: $ = !0,
|
|
3400
3400
|
measurements: w = [],
|
|
3401
|
-
surfaces:
|
|
3401
|
+
surfaces: F = [],
|
|
3402
3402
|
labels: J = [],
|
|
3403
3403
|
selection: te,
|
|
3404
|
-
highlightColor: V = "#
|
|
3404
|
+
highlightColor: V = "var(--nice-warning, #ffff00)",
|
|
3405
3405
|
spin: L = !1,
|
|
3406
3406
|
spinSpeed: H = 0.5,
|
|
3407
3407
|
onAtomClick: oe,
|
|
@@ -3410,99 +3410,99 @@ function rn({
|
|
|
3410
3410
|
className: pe,
|
|
3411
3411
|
styleOverride: se
|
|
3412
3412
|
}) {
|
|
3413
|
-
const ne =
|
|
3413
|
+
const ne = Ae(null), [Y, ce] = j(null), [ue, me] = j({
|
|
3414
3414
|
rotX: 0,
|
|
3415
3415
|
rotY: 0,
|
|
3416
3416
|
rotZ: 0,
|
|
3417
3417
|
zoom: 1,
|
|
3418
3418
|
panX: 0,
|
|
3419
3419
|
panY: 0
|
|
3420
|
-
}), [xe,
|
|
3420
|
+
}), [xe, X] = j(!1), [Z, ae] = j(
|
|
3421
3421
|
null
|
|
3422
|
-
), [G,
|
|
3423
|
-
|
|
3422
|
+
), [G, C] = j(null), [Q, ee] = j(n);
|
|
3423
|
+
Xe(() => {
|
|
3424
3424
|
if (!e) {
|
|
3425
3425
|
ce(null);
|
|
3426
3426
|
return;
|
|
3427
3427
|
}
|
|
3428
3428
|
typeof e == "string" ? (t === "pdb" || console.warn(`Format ${t} parsing not implemented, using PDB parser`), ce(Ve(e))) : ce(e);
|
|
3429
|
-
}, [e, t]),
|
|
3429
|
+
}, [e, t]), Xe(() => {
|
|
3430
3430
|
if (!L)
|
|
3431
3431
|
return;
|
|
3432
3432
|
const g = setInterval(() => {
|
|
3433
|
-
|
|
3433
|
+
me((M) => ({ ...M, rotY: (M.rotY + H) % 360 }));
|
|
3434
3434
|
}, 16);
|
|
3435
3435
|
return () => clearInterval(g);
|
|
3436
3436
|
}, [L, H]);
|
|
3437
3437
|
const { center: re, scale: ie } = K(() => {
|
|
3438
|
-
if (!
|
|
3438
|
+
if (!Y || Y.atoms.length === 0)
|
|
3439
3439
|
return { center: { x: 0, y: 0, z: 0 }, scale: 1 };
|
|
3440
|
-
let g = 1 / 0, M = -1 / 0,
|
|
3441
|
-
for (const
|
|
3442
|
-
g = Math.min(g,
|
|
3440
|
+
let g = 1 / 0, M = -1 / 0, z = 1 / 0, W = -1 / 0, T = 1 / 0, le = -1 / 0;
|
|
3441
|
+
for (const ye of Y.atoms)
|
|
3442
|
+
g = Math.min(g, ye.x), M = Math.max(M, ye.x), z = Math.min(z, ye.y), W = Math.max(W, ye.y), T = Math.min(T, ye.z), le = Math.max(le, ye.z);
|
|
3443
3443
|
const fe = {
|
|
3444
3444
|
x: (g + M) / 2,
|
|
3445
|
-
y: (
|
|
3446
|
-
z: (
|
|
3447
|
-
}, be = Math.max(M - g,
|
|
3445
|
+
y: (z + W) / 2,
|
|
3446
|
+
z: (T + le) / 2
|
|
3447
|
+
}, be = Math.max(M - g, W - z, le - T), ge = be > 0 ? 35 / be : 1;
|
|
3448
3448
|
return { center: fe, scale: ge };
|
|
3449
|
-
}, [
|
|
3449
|
+
}, [Y]), A = K(() => Y ? Y.atoms.filter((g) => !i && g.element === "H" || !s && g.residueName === "HOH" ? !1 : g.visible !== !1).map((g) => ({
|
|
3450
3450
|
atom: g,
|
|
3451
|
-
...
|
|
3452
|
-
})).sort((g, M) => g.depth - M.depth) : [], [
|
|
3453
|
-
const M =
|
|
3454
|
-
if (!M || !
|
|
3451
|
+
...je(g.x, g.y, g.z, ue, re, ie)
|
|
3452
|
+
})).sort((g, M) => g.depth - M.depth) : [], [Y, ue, re, ie, i, s]), k = K(() => Y ? Y.bonds.filter((g) => g.visible !== !1).map((g) => {
|
|
3453
|
+
const M = Y.atoms[g.atom1], z = Y.atoms[g.atom2];
|
|
3454
|
+
if (!M || !z || !i && (M.element === "H" || z.element === "H"))
|
|
3455
3455
|
return null;
|
|
3456
|
-
const
|
|
3456
|
+
const W = je(M.x, M.y, M.z, ue, re, ie), T = je(z.x, z.y, z.z, ue, re, ie);
|
|
3457
3457
|
return {
|
|
3458
3458
|
bond: g,
|
|
3459
|
-
x1:
|
|
3460
|
-
y1:
|
|
3461
|
-
x2:
|
|
3462
|
-
y2:
|
|
3463
|
-
depth: (
|
|
3459
|
+
x1: W.x,
|
|
3460
|
+
y1: W.y,
|
|
3461
|
+
x2: T.x,
|
|
3462
|
+
y2: T.y,
|
|
3463
|
+
depth: (W.depth + T.depth) / 2,
|
|
3464
3464
|
color1: M.color,
|
|
3465
|
-
color2:
|
|
3465
|
+
color2: z.color
|
|
3466
3466
|
};
|
|
3467
|
-
}).filter(Boolean).sort((g, M) => g.depth - M.depth) : [], [
|
|
3467
|
+
}).filter(Boolean).sort((g, M) => g.depth - M.depth) : [], [Y, ue, re, ie, i]), d = P(
|
|
3468
3468
|
(g) => {
|
|
3469
|
-
|
|
3469
|
+
y && (X(!0), ae({ x: g.clientX, y: g.clientY, view: { ...ue } }));
|
|
3470
3470
|
},
|
|
3471
|
-
[
|
|
3471
|
+
[y, ue]
|
|
3472
3472
|
), x = P(
|
|
3473
3473
|
(g) => {
|
|
3474
3474
|
if (!xe || !Z)
|
|
3475
3475
|
return;
|
|
3476
|
-
const M = g.clientX - Z.x,
|
|
3477
|
-
g.shiftKey ?
|
|
3476
|
+
const M = g.clientX - Z.x, z = g.clientY - Z.y;
|
|
3477
|
+
g.shiftKey ? me({
|
|
3478
3478
|
...Z.view,
|
|
3479
3479
|
panX: Z.view.panX + M * 0.1,
|
|
3480
|
-
panY: Z.view.panY +
|
|
3481
|
-
}) :
|
|
3480
|
+
panY: Z.view.panY + z * 0.1
|
|
3481
|
+
}) : me({
|
|
3482
3482
|
...Z.view,
|
|
3483
3483
|
rotY: Z.view.rotY + M * 0.5,
|
|
3484
|
-
rotX: Z.view.rotX +
|
|
3484
|
+
rotX: Z.view.rotX + z * 0.5
|
|
3485
3485
|
});
|
|
3486
3486
|
},
|
|
3487
3487
|
[xe, Z]
|
|
3488
|
-
),
|
|
3489
|
-
|
|
3490
|
-
}, []),
|
|
3488
|
+
), S = P(() => {
|
|
3489
|
+
X(!1), ae(null);
|
|
3490
|
+
}, []), E = P(
|
|
3491
3491
|
(g) => {
|
|
3492
|
-
if (!
|
|
3492
|
+
if (!m)
|
|
3493
3493
|
return;
|
|
3494
3494
|
g.preventDefault();
|
|
3495
3495
|
const M = g.deltaY > 0 ? 0.9 : 1.1;
|
|
3496
|
-
|
|
3496
|
+
me((z) => ({ ...z, zoom: Math.max(0.1, Math.min(10, z.zoom * M)) }));
|
|
3497
3497
|
},
|
|
3498
|
-
[
|
|
3499
|
-
),
|
|
3498
|
+
[m]
|
|
3499
|
+
), N = P(
|
|
3500
3500
|
(g) => {
|
|
3501
3501
|
switch (Q) {
|
|
3502
3502
|
case "space-filling":
|
|
3503
3503
|
return (Lt[g.element] || 1.5) * 4;
|
|
3504
3504
|
case "ball-stick":
|
|
3505
|
-
return (
|
|
3505
|
+
return (Fe[g.element] || 0.5) * 3;
|
|
3506
3506
|
case "stick":
|
|
3507
3507
|
case "wireframe":
|
|
3508
3508
|
return 2;
|
|
@@ -3511,11 +3511,11 @@ function rn({
|
|
|
3511
3511
|
}
|
|
3512
3512
|
},
|
|
3513
3513
|
[Q]
|
|
3514
|
-
),
|
|
3514
|
+
), _ = P(
|
|
3515
3515
|
(g) => (Q === "wireframe" ? 1 : Q === "stick" ? 3 : 2) * (g.order || 1),
|
|
3516
3516
|
[Q]
|
|
3517
3517
|
);
|
|
3518
|
-
return
|
|
3518
|
+
return Y ? /* @__PURE__ */ u(
|
|
3519
3519
|
"div",
|
|
3520
3520
|
{
|
|
3521
3521
|
ref: ne,
|
|
@@ -3531,9 +3531,9 @@ function rn({
|
|
|
3531
3531
|
},
|
|
3532
3532
|
onMouseDown: d,
|
|
3533
3533
|
onMouseMove: x,
|
|
3534
|
-
onMouseUp:
|
|
3535
|
-
onMouseLeave:
|
|
3536
|
-
onWheel:
|
|
3534
|
+
onMouseUp: S,
|
|
3535
|
+
onMouseLeave: S,
|
|
3536
|
+
onWheel: E,
|
|
3537
3537
|
children: [
|
|
3538
3538
|
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", style: { position: "absolute" }, children: [
|
|
3539
3539
|
Q !== "space-filling" && k.map((g, M) => /* @__PURE__ */ o(
|
|
@@ -3543,31 +3543,31 @@ function rn({
|
|
|
3543
3543
|
y1: `${g.y1}%`,
|
|
3544
3544
|
x2: `${g.x2}%`,
|
|
3545
3545
|
y2: `${g.y2}%`,
|
|
3546
|
-
stroke: g.bond.color || "#888888",
|
|
3547
|
-
strokeWidth:
|
|
3546
|
+
stroke: g.bond.color || "var(--nice-text-secondary, #888888)",
|
|
3547
|
+
strokeWidth: _(g.bond),
|
|
3548
3548
|
strokeLinecap: "round"
|
|
3549
3549
|
},
|
|
3550
3550
|
`bond-${M}`
|
|
3551
3551
|
)),
|
|
3552
|
-
|
|
3552
|
+
A.map(({ atom: g, x: M, y: z }) => {
|
|
3553
3553
|
var fe;
|
|
3554
|
-
const
|
|
3554
|
+
const W = (fe = te == null ? void 0 : te.atoms) == null ? void 0 : fe.includes(g.id), T = (G == null ? void 0 : G.id) === g.id, le = N(g);
|
|
3555
3555
|
return /* @__PURE__ */ u("g", { children: [
|
|
3556
3556
|
/* @__PURE__ */ o(
|
|
3557
3557
|
"circle",
|
|
3558
3558
|
{
|
|
3559
3559
|
cx: `${M}%`,
|
|
3560
|
-
cy: `${
|
|
3560
|
+
cy: `${z}%`,
|
|
3561
3561
|
r: le,
|
|
3562
|
-
fill: g.color || tt[g.element] || "#808080",
|
|
3563
|
-
stroke:
|
|
3564
|
-
strokeWidth:
|
|
3562
|
+
fill: g.color || tt[g.element] || "var(--nice-text-secondary, #808080)",
|
|
3563
|
+
stroke: W ? V : T ? "var(--nice-bg, #fff)" : "none",
|
|
3564
|
+
strokeWidth: W || T ? 2 : 0,
|
|
3565
3565
|
style: { cursor: "pointer" },
|
|
3566
3566
|
onMouseEnter: () => {
|
|
3567
|
-
|
|
3567
|
+
C(g), U == null || U(g);
|
|
3568
3568
|
},
|
|
3569
3569
|
onMouseLeave: () => {
|
|
3570
|
-
|
|
3570
|
+
C(null), U == null || U(null);
|
|
3571
3571
|
},
|
|
3572
3572
|
onClick: () => oe == null ? void 0 : oe(g)
|
|
3573
3573
|
}
|
|
@@ -3576,8 +3576,8 @@ function rn({
|
|
|
3576
3576
|
"text",
|
|
3577
3577
|
{
|
|
3578
3578
|
x: `${M}%`,
|
|
3579
|
-
y: `${
|
|
3580
|
-
fill: "#
|
|
3579
|
+
y: `${z - le * 0.15}%`,
|
|
3580
|
+
fill: "var(--nice-bg, #fff)",
|
|
3581
3581
|
fontSize: "10",
|
|
3582
3582
|
textAnchor: "middle",
|
|
3583
3583
|
dominantBaseline: "middle",
|
|
@@ -3590,19 +3590,19 @@ function rn({
|
|
|
3590
3590
|
w.map((g) => {
|
|
3591
3591
|
if (g.atoms.length < 2)
|
|
3592
3592
|
return null;
|
|
3593
|
-
const M =
|
|
3594
|
-
if (!M || !
|
|
3593
|
+
const M = Y.atoms[g.atoms[0]], z = Y.atoms[g.atoms[1]];
|
|
3594
|
+
if (!M || !z)
|
|
3595
3595
|
return null;
|
|
3596
|
-
const
|
|
3596
|
+
const W = je(M.x, M.y, M.z, ue, re, ie), T = je(z.x, z.y, z.z, ue, re, ie);
|
|
3597
3597
|
return /* @__PURE__ */ u("g", { children: [
|
|
3598
3598
|
/* @__PURE__ */ o(
|
|
3599
3599
|
"line",
|
|
3600
3600
|
{
|
|
3601
|
-
x1: `${
|
|
3602
|
-
y1: `${
|
|
3603
|
-
x2: `${
|
|
3604
|
-
y2: `${
|
|
3605
|
-
stroke: g.color || "#
|
|
3601
|
+
x1: `${W.x}%`,
|
|
3602
|
+
y1: `${W.y}%`,
|
|
3603
|
+
x2: `${T.x}%`,
|
|
3604
|
+
y2: `${T.y}%`,
|
|
3605
|
+
stroke: g.color || "var(--nice-warning, #ffff00)",
|
|
3606
3606
|
strokeWidth: 1,
|
|
3607
3607
|
strokeDasharray: "3,3"
|
|
3608
3608
|
}
|
|
@@ -3610,9 +3610,9 @@ function rn({
|
|
|
3610
3610
|
/* @__PURE__ */ u(
|
|
3611
3611
|
"text",
|
|
3612
3612
|
{
|
|
3613
|
-
x: `${(
|
|
3614
|
-
y: `${(
|
|
3615
|
-
fill: g.color || "#
|
|
3613
|
+
x: `${(W.x + T.x) / 2}%`,
|
|
3614
|
+
y: `${(W.y + T.y) / 2 - 1}%`,
|
|
3615
|
+
fill: g.color || "var(--nice-warning, #ffff00)",
|
|
3616
3616
|
fontSize: "10",
|
|
3617
3617
|
textAnchor: "middle",
|
|
3618
3618
|
children: [
|
|
@@ -3625,17 +3625,17 @@ function rn({
|
|
|
3625
3625
|
] }, g.id);
|
|
3626
3626
|
})
|
|
3627
3627
|
] }),
|
|
3628
|
-
/* @__PURE__ */ u("div", { style: { position: "absolute", top: 8, left: 8, color: "#
|
|
3629
|
-
/* @__PURE__ */ o("div", { style: { fontWeight: "bold" }, children:
|
|
3628
|
+
/* @__PURE__ */ u("div", { style: { position: "absolute", top: 8, left: 8, color: "var(--nice-bg, #fff)", fontSize: "0.8rem" }, children: [
|
|
3629
|
+
/* @__PURE__ */ o("div", { style: { fontWeight: "bold" }, children: Y.name }),
|
|
3630
3630
|
/* @__PURE__ */ u("div", { children: [
|
|
3631
|
-
|
|
3631
|
+
Y.atoms.length,
|
|
3632
3632
|
" atoms, ",
|
|
3633
|
-
|
|
3633
|
+
Y.bonds.length,
|
|
3634
3634
|
" bonds"
|
|
3635
3635
|
] }),
|
|
3636
|
-
|
|
3636
|
+
Y.formula && /* @__PURE__ */ u("div", { children: [
|
|
3637
3637
|
"Formula: ",
|
|
3638
|
-
|
|
3638
|
+
Y.formula
|
|
3639
3639
|
] })
|
|
3640
3640
|
] }),
|
|
3641
3641
|
G && /* @__PURE__ */ u(
|
|
@@ -3645,8 +3645,8 @@ function rn({
|
|
|
3645
3645
|
position: "absolute",
|
|
3646
3646
|
bottom: 8,
|
|
3647
3647
|
left: 8,
|
|
3648
|
-
background: "rgba(0,0,0,0.8)",
|
|
3649
|
-
color: "#
|
|
3648
|
+
background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
|
|
3649
|
+
color: "var(--nice-bg, #fff)",
|
|
3650
3650
|
padding: "4px 8px",
|
|
3651
3651
|
borderRadius: 4,
|
|
3652
3652
|
fontSize: "0.75rem"
|
|
@@ -3710,7 +3710,7 @@ function rn({
|
|
|
3710
3710
|
/* @__PURE__ */ o(
|
|
3711
3711
|
"button",
|
|
3712
3712
|
{
|
|
3713
|
-
onClick: () =>
|
|
3713
|
+
onClick: () => me({ rotX: 0, rotY: 0, rotZ: 0, zoom: 1, panX: 0, panY: 0 }),
|
|
3714
3714
|
style: { padding: "2px 4px", fontSize: "0.75rem", cursor: "pointer" },
|
|
3715
3715
|
children: "Reset View"
|
|
3716
3716
|
}
|
|
@@ -3731,14 +3731,14 @@ function rn({
|
|
|
3731
3731
|
display: "flex",
|
|
3732
3732
|
alignItems: "center",
|
|
3733
3733
|
justifyContent: "center",
|
|
3734
|
-
color: "#666",
|
|
3734
|
+
color: "var(--nice-text-secondary, #666)",
|
|
3735
3735
|
...se
|
|
3736
3736
|
},
|
|
3737
3737
|
children: "Load a molecule (PDB, MOL, SDF)"
|
|
3738
3738
|
}
|
|
3739
3739
|
);
|
|
3740
3740
|
}
|
|
3741
|
-
function
|
|
3741
|
+
function Wt(e) {
|
|
3742
3742
|
let t = 0, n = 0;
|
|
3743
3743
|
function r() {
|
|
3744
3744
|
var l;
|
|
@@ -3820,11 +3820,11 @@ function on({
|
|
|
3820
3820
|
showLeafLabels: c = !0,
|
|
3821
3821
|
showInternalLabels: h = !1,
|
|
3822
3822
|
labelFontSize: p = 11,
|
|
3823
|
-
branchWidth:
|
|
3824
|
-
branchColor:
|
|
3825
|
-
nodeColor: $ = "#333333",
|
|
3826
|
-
highlightColor: w = "#
|
|
3827
|
-
clades:
|
|
3823
|
+
branchWidth: y = 1.5,
|
|
3824
|
+
branchColor: m = "var(--nice-text-secondary, #666666)",
|
|
3825
|
+
nodeColor: $ = "var(--nice-text, #333333)",
|
|
3826
|
+
highlightColor: w = "var(--nice-primary, #2196f3)",
|
|
3827
|
+
clades: F = [],
|
|
3828
3828
|
annotations: J = [],
|
|
3829
3829
|
colorScale: te,
|
|
3830
3830
|
width: V = "100%",
|
|
@@ -3836,10 +3836,10 @@ function on({
|
|
|
3836
3836
|
onNodeClick: pe,
|
|
3837
3837
|
onNodeHover: se,
|
|
3838
3838
|
onBranchClick: ne,
|
|
3839
|
-
className:
|
|
3839
|
+
className: Y,
|
|
3840
3840
|
style: ce
|
|
3841
3841
|
}) {
|
|
3842
|
-
const ue =
|
|
3842
|
+
const ue = Ae(null), [me, xe] = j(1), [X, Z] = j({ x: 0, y: 0 }), [ae, G] = j(!1), [C, Q] = j(null), [ee, re] = j(null), [ie, A] = j(t), [k, d] = j(/* @__PURE__ */ new Set()), x = K(() => e ? typeof e == "string" ? Wt(e) : e : null, [e]), S = K(() => {
|
|
3843
3843
|
if (!x)
|
|
3844
3844
|
return null;
|
|
3845
3845
|
const v = (D) => {
|
|
@@ -3851,36 +3851,36 @@ function on({
|
|
|
3851
3851
|
};
|
|
3852
3852
|
};
|
|
3853
3853
|
return v(x);
|
|
3854
|
-
}, [x, k]), { positions:
|
|
3855
|
-
if (!
|
|
3854
|
+
}, [x, k]), { positions: E, leafCount: N, maxX: _ } = K(() => {
|
|
3855
|
+
if (!S)
|
|
3856
3856
|
return { positions: { x: /* @__PURE__ */ new Map(), y: /* @__PURE__ */ new Map() }, leafCount: 0, maxX: 0 };
|
|
3857
|
-
const v = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), B = rt(
|
|
3858
|
-
it(
|
|
3857
|
+
const v = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), B = rt(S);
|
|
3858
|
+
it(S, D, { value: 0 }), ot(S, v, 0);
|
|
3859
3859
|
const f = Math.max(...Array.from(v.values()));
|
|
3860
3860
|
return { positions: { x: v, y: D }, leafCount: B, maxX: f || 1 };
|
|
3861
|
-
}, [
|
|
3862
|
-
const B = D / (
|
|
3861
|
+
}, [S]), g = K(() => S ? nt(S) : [], [S]), M = typeof V == "number" ? V : 800, z = typeof L == "number" ? L : 500, W = M - H * 2, T = z - H * 2, le = (v) => H + v / _ * W * 0.7, fe = (v) => H + v / (N - 1 || 1) * T, be = (v, D) => {
|
|
3862
|
+
const B = D / (N - 1 || 1) * 2 * Math.PI - Math.PI / 2, f = v / _ * Math.min(W, T) * 0.4;
|
|
3863
3863
|
return {
|
|
3864
3864
|
x: M / 2 + f * Math.cos(B),
|
|
3865
|
-
y:
|
|
3865
|
+
y: z / 2 + f * Math.sin(B)
|
|
3866
3866
|
};
|
|
3867
3867
|
}, ge = (v) => {
|
|
3868
|
-
const D =
|
|
3868
|
+
const D = E.x.get(v) || 0, B = E.y.get(v) || 0;
|
|
3869
3869
|
return ie === "radial" || ie === "circular" ? be(D, B) : { x: le(D), y: fe(B) };
|
|
3870
|
-
},
|
|
3870
|
+
}, ye = P(
|
|
3871
3871
|
(v) => {
|
|
3872
|
-
U && (G(!0), Q({ x: v.clientX, y: v.clientY, pan: { ...
|
|
3872
|
+
U && (G(!0), Q({ x: v.clientX, y: v.clientY, pan: { ...X } }));
|
|
3873
3873
|
},
|
|
3874
|
-
[U,
|
|
3874
|
+
[U, X]
|
|
3875
3875
|
), we = P(
|
|
3876
3876
|
(v) => {
|
|
3877
|
-
if (!ae || !
|
|
3877
|
+
if (!ae || !C)
|
|
3878
3878
|
return;
|
|
3879
|
-
const D = v.clientX -
|
|
3880
|
-
Z({ x:
|
|
3879
|
+
const D = v.clientX - C.x, B = v.clientY - C.y;
|
|
3880
|
+
Z({ x: C.pan.x + D, y: C.pan.y + B });
|
|
3881
3881
|
},
|
|
3882
|
-
[ae,
|
|
3883
|
-
),
|
|
3882
|
+
[ae, C]
|
|
3883
|
+
), Se = P(() => {
|
|
3884
3884
|
G(!1), Q(null);
|
|
3885
3885
|
}, []), Le = P(
|
|
3886
3886
|
(v) => {
|
|
@@ -3891,12 +3891,12 @@ function on({
|
|
|
3891
3891
|
xe((B) => Math.max(0.1, Math.min(5, B * D)));
|
|
3892
3892
|
},
|
|
3893
3893
|
[oe]
|
|
3894
|
-
),
|
|
3894
|
+
), _e = P((v) => {
|
|
3895
3895
|
d((D) => {
|
|
3896
3896
|
const B = new Set(D);
|
|
3897
3897
|
return B.has(v) ? B.delete(v) : B.add(v), B;
|
|
3898
3898
|
});
|
|
3899
|
-
}, []),
|
|
3899
|
+
}, []), We = (v, D) => {
|
|
3900
3900
|
const B = ge(v.id), f = ge(D.id);
|
|
3901
3901
|
if (ie === "radial" || ie === "circular")
|
|
3902
3902
|
return /* @__PURE__ */ o(
|
|
@@ -3906,8 +3906,8 @@ function on({
|
|
|
3906
3906
|
y1: B.y,
|
|
3907
3907
|
x2: f.x,
|
|
3908
3908
|
y2: f.y,
|
|
3909
|
-
stroke: D.color ||
|
|
3910
|
-
strokeWidth:
|
|
3909
|
+
stroke: D.color || m,
|
|
3910
|
+
strokeWidth: y
|
|
3911
3911
|
}
|
|
3912
3912
|
);
|
|
3913
3913
|
switch (n) {
|
|
@@ -3916,8 +3916,8 @@ function on({
|
|
|
3916
3916
|
"path",
|
|
3917
3917
|
{
|
|
3918
3918
|
d: `M${B.x},${B.y} H${f.x} V${f.y}`,
|
|
3919
|
-
stroke: D.color ||
|
|
3920
|
-
strokeWidth:
|
|
3919
|
+
stroke: D.color || m,
|
|
3920
|
+
strokeWidth: y,
|
|
3921
3921
|
fill: "none"
|
|
3922
3922
|
}
|
|
3923
3923
|
);
|
|
@@ -3929,21 +3929,22 @@ function on({
|
|
|
3929
3929
|
y1: B.y,
|
|
3930
3930
|
x2: f.x,
|
|
3931
3931
|
y2: f.y,
|
|
3932
|
-
stroke: D.color ||
|
|
3933
|
-
strokeWidth:
|
|
3932
|
+
stroke: D.color || m,
|
|
3933
|
+
strokeWidth: y
|
|
3934
3934
|
}
|
|
3935
3935
|
);
|
|
3936
|
-
case "curved":
|
|
3936
|
+
case "curved": {
|
|
3937
3937
|
const b = (B.x + f.x) / 2;
|
|
3938
3938
|
return /* @__PURE__ */ o(
|
|
3939
3939
|
"path",
|
|
3940
3940
|
{
|
|
3941
3941
|
d: `M${B.x},${B.y} C${b},${B.y} ${b},${f.y} ${f.x},${f.y}`,
|
|
3942
|
-
stroke: D.color ||
|
|
3943
|
-
strokeWidth:
|
|
3942
|
+
stroke: D.color || m,
|
|
3943
|
+
strokeWidth: y,
|
|
3944
3944
|
fill: "none"
|
|
3945
3945
|
}
|
|
3946
3946
|
);
|
|
3947
|
+
}
|
|
3947
3948
|
default:
|
|
3948
3949
|
return /* @__PURE__ */ o(
|
|
3949
3950
|
"line",
|
|
@@ -3952,26 +3953,27 @@ function on({
|
|
|
3952
3953
|
y1: B.y,
|
|
3953
3954
|
x2: f.x,
|
|
3954
3955
|
y2: f.y,
|
|
3955
|
-
stroke: D.color ||
|
|
3956
|
-
strokeWidth:
|
|
3956
|
+
stroke: D.color || m,
|
|
3957
|
+
strokeWidth: y
|
|
3957
3958
|
}
|
|
3958
3959
|
);
|
|
3959
3960
|
}
|
|
3960
|
-
},
|
|
3961
|
-
const D = ge(v.id), B = !v.children || v.children.length === 0 || v.collapsed, f = (ee == null ? void 0 : ee.id) === v.id, b = f ? i * 1.5 : i,
|
|
3961
|
+
}, Ne = (v) => {
|
|
3962
|
+
const D = ge(v.id), B = !v.children || v.children.length === 0 || v.collapsed, f = (ee == null ? void 0 : ee.id) === v.id, b = f ? i * 1.5 : i, O = (() => {
|
|
3962
3963
|
switch (r) {
|
|
3963
3964
|
case "circle":
|
|
3964
3965
|
return /* @__PURE__ */ o("circle", { cx: D.x, cy: D.y, r: b });
|
|
3965
3966
|
case "square":
|
|
3966
3967
|
return /* @__PURE__ */ o("rect", { x: D.x - b, y: D.y - b, width: b * 2, height: b * 2 });
|
|
3967
|
-
case "triangle":
|
|
3968
|
-
const
|
|
3968
|
+
case "triangle": {
|
|
3969
|
+
const I = b * 1.5;
|
|
3969
3970
|
return /* @__PURE__ */ o(
|
|
3970
3971
|
"polygon",
|
|
3971
3972
|
{
|
|
3972
|
-
points: `${D.x},${D.y -
|
|
3973
|
+
points: `${D.x},${D.y - I} ${D.x - I},${D.y + I} ${D.x + I},${D.y + I}`
|
|
3973
3974
|
}
|
|
3974
3975
|
);
|
|
3976
|
+
}
|
|
3975
3977
|
case "diamond":
|
|
3976
3978
|
return /* @__PURE__ */ o(
|
|
3977
3979
|
"polygon",
|
|
@@ -3986,7 +3988,7 @@ function on({
|
|
|
3986
3988
|
}
|
|
3987
3989
|
})();
|
|
3988
3990
|
return /* @__PURE__ */ u("g", { children: [
|
|
3989
|
-
|
|
3991
|
+
O && /* @__PURE__ */ o(
|
|
3990
3992
|
"g",
|
|
3991
3993
|
{
|
|
3992
3994
|
fill: v.highlighted ? w : v.color || $,
|
|
@@ -4001,9 +4003,9 @@ function on({
|
|
|
4001
4003
|
},
|
|
4002
4004
|
onClick: () => pe == null ? void 0 : pe(v),
|
|
4003
4005
|
onDoubleClick: () => {
|
|
4004
|
-
v.children && v.children.length > 0 &&
|
|
4006
|
+
v.children && v.children.length > 0 && _e(v.id);
|
|
4005
4007
|
},
|
|
4006
|
-
children:
|
|
4008
|
+
children: O
|
|
4007
4009
|
}
|
|
4008
4010
|
),
|
|
4009
4011
|
v.collapsed && v.children && /* @__PURE__ */ o(
|
|
@@ -4020,7 +4022,7 @@ function on({
|
|
|
4020
4022
|
x: D.x + i + 5,
|
|
4021
4023
|
y: D.y,
|
|
4022
4024
|
fontSize: p,
|
|
4023
|
-
fill: "#333",
|
|
4025
|
+
fill: "var(--nice-text, #333)",
|
|
4024
4026
|
dominantBaseline: "middle",
|
|
4025
4027
|
children: v.name
|
|
4026
4028
|
}
|
|
@@ -4031,7 +4033,7 @@ function on({
|
|
|
4031
4033
|
x: D.x,
|
|
4032
4034
|
y: D.y - i - 3,
|
|
4033
4035
|
fontSize: p * 0.9,
|
|
4034
|
-
fill: "#666",
|
|
4036
|
+
fill: "var(--nice-text-secondary, #666)",
|
|
4035
4037
|
textAnchor: "middle",
|
|
4036
4038
|
children: v.name
|
|
4037
4039
|
}
|
|
@@ -4042,39 +4044,39 @@ function on({
|
|
|
4042
4044
|
x: D.x,
|
|
4043
4045
|
y: D.y - i - 2,
|
|
4044
4046
|
fontSize: p * 0.8,
|
|
4045
|
-
fill: "#
|
|
4047
|
+
fill: "var(--nice-accent-pink, #e91e63)",
|
|
4046
4048
|
textAnchor: "middle",
|
|
4047
4049
|
children: v.bootstrap.toFixed(0)
|
|
4048
4050
|
}
|
|
4049
4051
|
)
|
|
4050
4052
|
] }, v.id);
|
|
4051
|
-
},
|
|
4053
|
+
}, Ee = (v) => {
|
|
4052
4054
|
const D = [];
|
|
4053
4055
|
if (v.children && !v.collapsed)
|
|
4054
4056
|
for (const B of v.children)
|
|
4055
|
-
D.push(/* @__PURE__ */ o("g", { children:
|
|
4057
|
+
D.push(/* @__PURE__ */ o("g", { children: We(v, B) }, `branch-${v.id}-${B.id}`)), D.push(...Ee(B));
|
|
4056
4058
|
return D;
|
|
4057
4059
|
};
|
|
4058
|
-
return
|
|
4060
|
+
return S ? /* @__PURE__ */ u(
|
|
4059
4061
|
"div",
|
|
4060
4062
|
{
|
|
4061
4063
|
ref: ue,
|
|
4062
|
-
className: `nice-phylogenetic-tree ${
|
|
4064
|
+
className: `nice-phylogenetic-tree ${Y || ""}`,
|
|
4063
4065
|
style: {
|
|
4064
4066
|
width: V,
|
|
4065
4067
|
height: L,
|
|
4066
4068
|
position: "relative",
|
|
4067
4069
|
overflow: "hidden",
|
|
4068
|
-
background: "#
|
|
4069
|
-
border: "1px solid #
|
|
4070
|
+
background: "var(--nice-bg-secondary, #fafafa)",
|
|
4071
|
+
border: "1px solid var(--nice-border, #e0e0e0)",
|
|
4070
4072
|
borderRadius: 4,
|
|
4071
4073
|
cursor: ae ? "grabbing" : "grab",
|
|
4072
4074
|
...ce
|
|
4073
4075
|
},
|
|
4074
|
-
onMouseDown:
|
|
4076
|
+
onMouseDown: ye,
|
|
4075
4077
|
onMouseMove: we,
|
|
4076
|
-
onMouseUp:
|
|
4077
|
-
onMouseLeave:
|
|
4078
|
+
onMouseUp: Se,
|
|
4079
|
+
onMouseLeave: Se,
|
|
4078
4080
|
onWheel: Le,
|
|
4079
4081
|
children: [
|
|
4080
4082
|
/* @__PURE__ */ u(
|
|
@@ -4083,25 +4085,25 @@ function on({
|
|
|
4083
4085
|
width: "100%",
|
|
4084
4086
|
height: "100%",
|
|
4085
4087
|
style: {
|
|
4086
|
-
transform: `translate(${
|
|
4088
|
+
transform: `translate(${X.x}px, ${X.y}px) scale(${me})`,
|
|
4087
4089
|
transformOrigin: "center center"
|
|
4088
4090
|
},
|
|
4089
4091
|
children: [
|
|
4090
|
-
|
|
4092
|
+
F.map((v) => {
|
|
4091
4093
|
const D = g.filter((R) => v.nodeIds.includes(R.id));
|
|
4092
4094
|
if (D.length === 0)
|
|
4093
4095
|
return null;
|
|
4094
|
-
const B = D.map((R) => ge(R.id)), f = Math.min(...B.map((R) => R.x)) - 10, b = Math.max(...B.map((R) => R.x)) + 10,
|
|
4096
|
+
const B = D.map((R) => ge(R.id)), f = Math.min(...B.map((R) => R.x)) - 10, b = Math.max(...B.map((R) => R.x)) + 10, O = Math.min(...B.map((R) => R.y)) - 10, I = Math.max(...B.map((R) => R.y)) + 10;
|
|
4095
4097
|
return /* @__PURE__ */ u("g", { children: [
|
|
4096
4098
|
/* @__PURE__ */ o(
|
|
4097
4099
|
"rect",
|
|
4098
4100
|
{
|
|
4099
4101
|
x: f,
|
|
4100
|
-
y:
|
|
4102
|
+
y: O,
|
|
4101
4103
|
width: b - f,
|
|
4102
|
-
height:
|
|
4103
|
-
fill: v.background || `${v.color}20` || "#
|
|
4104
|
-
stroke: v.color || "#
|
|
4104
|
+
height: I - O,
|
|
4105
|
+
fill: v.background || `${v.color}20` || "var(--nice-primary-bg, #e3f2fd)",
|
|
4106
|
+
stroke: v.color || "var(--nice-primary, #2196f3)",
|
|
4105
4107
|
strokeWidth: 1,
|
|
4106
4108
|
strokeDasharray: "4,2",
|
|
4107
4109
|
rx: 4
|
|
@@ -4111,17 +4113,17 @@ function on({
|
|
|
4111
4113
|
"text",
|
|
4112
4114
|
{
|
|
4113
4115
|
x: b + 5,
|
|
4114
|
-
y: (
|
|
4116
|
+
y: (O + I) / 2,
|
|
4115
4117
|
fontSize: 10,
|
|
4116
|
-
fill: v.color || "#666",
|
|
4118
|
+
fill: v.color || "var(--nice-text-secondary, #666)",
|
|
4117
4119
|
dominantBaseline: "middle",
|
|
4118
4120
|
children: v.name
|
|
4119
4121
|
}
|
|
4120
4122
|
)
|
|
4121
4123
|
] }, v.id);
|
|
4122
4124
|
}),
|
|
4123
|
-
|
|
4124
|
-
g.map((v) =>
|
|
4125
|
+
Ee(S),
|
|
4126
|
+
g.map((v) => Ne(v)),
|
|
4125
4127
|
J.map((v) => {
|
|
4126
4128
|
if (!g.find((b) => b.id === v.nodeId))
|
|
4127
4129
|
return null;
|
|
@@ -4137,7 +4139,7 @@ function on({
|
|
|
4137
4139
|
x: B.x + f.x,
|
|
4138
4140
|
y: B.y + f.y,
|
|
4139
4141
|
fontSize: v.fontSize || 9,
|
|
4140
|
-
fill: v.color || "#
|
|
4142
|
+
fill: v.color || "var(--nice-danger, #ff5722)",
|
|
4141
4143
|
textAnchor: v.position === "left" ? "end" : v.position === "right" ? "start" : "middle",
|
|
4142
4144
|
dominantBaseline: "middle",
|
|
4143
4145
|
children: v.text
|
|
@@ -4148,10 +4150,10 @@ function on({
|
|
|
4148
4150
|
]
|
|
4149
4151
|
}
|
|
4150
4152
|
),
|
|
4151
|
-
/* @__PURE__ */ u("div", { style: { position: "absolute", top: 8, left: 8, fontSize: "0.75rem", color: "#666" }, children: [
|
|
4153
|
+
/* @__PURE__ */ u("div", { style: { position: "absolute", top: 8, left: 8, fontSize: "0.75rem", color: "var(--nice-text-secondary, #666)" }, children: [
|
|
4152
4154
|
g.length,
|
|
4153
4155
|
" nodes • ",
|
|
4154
|
-
|
|
4156
|
+
N,
|
|
4155
4157
|
" leaves"
|
|
4156
4158
|
] }),
|
|
4157
4159
|
ee && /* @__PURE__ */ u(
|
|
@@ -4161,11 +4163,11 @@ function on({
|
|
|
4161
4163
|
position: "absolute",
|
|
4162
4164
|
bottom: 8,
|
|
4163
4165
|
left: 8,
|
|
4164
|
-
background: "rgba(255,255,255,0.95)",
|
|
4166
|
+
background: "var(--nice-overlay-light-95, rgba(255, 255, 255, 0.95))",
|
|
4165
4167
|
padding: "4px 8px",
|
|
4166
4168
|
borderRadius: 4,
|
|
4167
4169
|
fontSize: "0.75rem",
|
|
4168
|
-
boxShadow: "0 1px 4px rgba(0,0,0,0.1)"
|
|
4170
|
+
boxShadow: "0 1px 4px var(--nice-overlay-10, rgba(0, 0, 0, 0.1))"
|
|
4169
4171
|
},
|
|
4170
4172
|
children: [
|
|
4171
4173
|
/* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("b", { children: ee.name || ee.id }) }),
|
|
@@ -4200,7 +4202,7 @@ function on({
|
|
|
4200
4202
|
"select",
|
|
4201
4203
|
{
|
|
4202
4204
|
value: ie,
|
|
4203
|
-
onChange: (v) =>
|
|
4205
|
+
onChange: (v) => A(v.target.value),
|
|
4204
4206
|
style: { padding: "2px 4px", fontSize: "0.75rem" },
|
|
4205
4207
|
children: [
|
|
4206
4208
|
/* @__PURE__ */ o("option", { value: "rectangular", children: "Rectangular" }),
|
|
@@ -4235,16 +4237,16 @@ function on({
|
|
|
4235
4237
|
) : /* @__PURE__ */ o(
|
|
4236
4238
|
"div",
|
|
4237
4239
|
{
|
|
4238
|
-
className: `nice-phylogenetic-tree nice-phylogenetic-tree--empty ${
|
|
4240
|
+
className: `nice-phylogenetic-tree nice-phylogenetic-tree--empty ${Y || ""}`,
|
|
4239
4241
|
style: {
|
|
4240
4242
|
width: V,
|
|
4241
4243
|
height: L,
|
|
4242
4244
|
display: "flex",
|
|
4243
4245
|
alignItems: "center",
|
|
4244
4246
|
justifyContent: "center",
|
|
4245
|
-
background: "#
|
|
4246
|
-
color: "#666",
|
|
4247
|
-
border: "1px dashed #
|
|
4247
|
+
background: "var(--nice-bg-secondary, #f5f5f5)",
|
|
4248
|
+
color: "var(--nice-text-secondary, #666)",
|
|
4249
|
+
border: "1px dashed var(--nice-border, #ccc)",
|
|
4248
4250
|
borderRadius: 4,
|
|
4249
4251
|
...ce
|
|
4250
4252
|
},
|
|
@@ -4253,22 +4255,22 @@ function on({
|
|
|
4253
4255
|
);
|
|
4254
4256
|
}
|
|
4255
4257
|
const De = (e) => e * Math.PI / 180;
|
|
4256
|
-
function
|
|
4258
|
+
function Ot(e, t, n, r) {
|
|
4257
4259
|
const i = (t + 180) / 360 * n, s = De(e), a = Math.log(Math.tan(Math.PI / 4 + s / 2)), l = r / 2 - n * a / (2 * Math.PI);
|
|
4258
4260
|
return { x: i, y: l };
|
|
4259
4261
|
}
|
|
4260
|
-
function
|
|
4262
|
+
function Tt(e, t, n, r) {
|
|
4261
4263
|
const i = (t + 180) / 360 * n, s = (90 - e) / 180 * r;
|
|
4262
4264
|
return { x: i, y: s };
|
|
4263
4265
|
}
|
|
4264
|
-
function
|
|
4266
|
+
function Xt(e, t, n, r, i, s) {
|
|
4265
4267
|
const a = De(e), l = De(t), c = De(i), h = De(s);
|
|
4266
4268
|
if (Math.sin(c) * Math.sin(a) + Math.cos(c) * Math.cos(a) * Math.cos(l - h) < 0)
|
|
4267
4269
|
return { x: 0, y: 0, visible: !1 };
|
|
4268
|
-
const
|
|
4269
|
-
return { x:
|
|
4270
|
+
const y = Math.min(n, r) / 2 - 10, m = n / 2 + y * Math.cos(a) * Math.sin(l - h), $ = r / 2 - y * (Math.cos(c) * Math.sin(a) - Math.sin(c) * Math.cos(a) * Math.cos(l - h));
|
|
4271
|
+
return { x: m, y: $, visible: !0 };
|
|
4270
4272
|
}
|
|
4271
|
-
function
|
|
4273
|
+
function Yt(e, t, n, r) {
|
|
4272
4274
|
const i = [
|
|
4273
4275
|
[0, 1, 0],
|
|
4274
4276
|
[5, 0.9986, 0.062],
|
|
@@ -4291,10 +4293,10 @@ function _t(e, t, n, r) {
|
|
|
4291
4293
|
[90, 0.5322, 1]
|
|
4292
4294
|
], s = Math.abs(e);
|
|
4293
4295
|
let a = 1, l = 0;
|
|
4294
|
-
for (let
|
|
4295
|
-
if (s >= i[
|
|
4296
|
-
const
|
|
4297
|
-
a = i[
|
|
4296
|
+
for (let y = 0; y < i.length - 1; y++)
|
|
4297
|
+
if (s >= i[y][0] && s <= i[y + 1][0]) {
|
|
4298
|
+
const m = (s - i[y][0]) / 5;
|
|
4299
|
+
a = i[y][1] + m * (i[y + 1][1] - i[y][1]), l = i[y][2] + m * (i[y + 1][2] - i[y][2]);
|
|
4298
4300
|
break;
|
|
4299
4301
|
}
|
|
4300
4302
|
const c = n / (2 * Math.PI), h = n / 2 + c * De(t) * a, p = r / 2 - c * l * 1.3523 * Math.sign(e);
|
|
@@ -4320,12 +4322,12 @@ function sn({
|
|
|
4320
4322
|
zoom: c = 1,
|
|
4321
4323
|
showGraticule: h = !0,
|
|
4322
4324
|
graticuleInterval: p = 30,
|
|
4323
|
-
showCoastlines:
|
|
4324
|
-
showBorders:
|
|
4325
|
+
showCoastlines: y = !0,
|
|
4326
|
+
showBorders: m = !1,
|
|
4325
4327
|
landColor: $ = "#D4E6C3",
|
|
4326
4328
|
oceanColor: w = "#A8D4E6",
|
|
4327
|
-
borderColor:
|
|
4328
|
-
graticuleColor: J = "#
|
|
4329
|
+
borderColor: F = "var(--nice-text-muted, #999999)",
|
|
4330
|
+
graticuleColor: J = "var(--nice-border, #cccccc)",
|
|
4329
4331
|
width: te = "100%",
|
|
4330
4332
|
height: V = 400,
|
|
4331
4333
|
enablePan: L = !0,
|
|
@@ -4336,79 +4338,79 @@ function sn({
|
|
|
4336
4338
|
showLayerControl: pe = !1,
|
|
4337
4339
|
onMarkerClick: se,
|
|
4338
4340
|
onMarkerHover: ne,
|
|
4339
|
-
onMapClick:
|
|
4341
|
+
onMapClick: Y,
|
|
4340
4342
|
onPolygonClick: ce,
|
|
4341
4343
|
onBoundsChange: ue,
|
|
4342
|
-
className:
|
|
4344
|
+
className: me,
|
|
4343
4345
|
style: xe
|
|
4344
4346
|
}) {
|
|
4345
|
-
var
|
|
4346
|
-
const
|
|
4347
|
+
var Ee, v, D, B;
|
|
4348
|
+
const X = Ae(null), [Z, ae] = j(l), [G, C] = j(c), [Q, ee] = j(!1), [re, ie] = j(null), [A, k] = j(null), [d, x] = j(e), [S, E] = j(
|
|
4347
4349
|
new Set(t.filter((f) => f.visible !== !1).map((f) => f.id))
|
|
4348
|
-
),
|
|
4350
|
+
), N = typeof te == "number" ? te : 800, _ = typeof V == "number" ? V : 400, g = P(
|
|
4349
4351
|
(f, b) => {
|
|
4350
4352
|
switch (d) {
|
|
4351
4353
|
case "mercator":
|
|
4352
|
-
return
|
|
4354
|
+
return Ot(f, b, N, _);
|
|
4353
4355
|
case "orthographic":
|
|
4354
|
-
return
|
|
4356
|
+
return Xt(f, b, N, _, Z.lat, Z.lng);
|
|
4355
4357
|
case "robinson":
|
|
4356
|
-
return
|
|
4358
|
+
return Yt(f, b, N, _);
|
|
4357
4359
|
case "equirectangular":
|
|
4358
4360
|
default:
|
|
4359
|
-
return
|
|
4361
|
+
return Tt(f, b, N, _);
|
|
4360
4362
|
}
|
|
4361
4363
|
},
|
|
4362
|
-
[d,
|
|
4364
|
+
[d, N, _, Z]
|
|
4363
4365
|
), M = P(
|
|
4364
4366
|
(f, b) => {
|
|
4365
|
-
const
|
|
4366
|
-
return { lat: Math.max(-90, Math.min(90,
|
|
4367
|
+
const O = f / N * 360 - 180, I = 90 - b / _ * 180;
|
|
4368
|
+
return { lat: Math.max(-90, Math.min(90, I)), lng: Math.max(-180, Math.min(180, O)) };
|
|
4367
4369
|
},
|
|
4368
|
-
[
|
|
4369
|
-
),
|
|
4370
|
+
[N, _]
|
|
4371
|
+
), z = K(() => {
|
|
4370
4372
|
const f = [];
|
|
4371
4373
|
for (let b = -90 + p; b < 90; b += p) {
|
|
4372
|
-
let
|
|
4373
|
-
for (let
|
|
4374
|
-
const R = g(b,
|
|
4375
|
-
R.visible !== !1 && (
|
|
4374
|
+
let O = "";
|
|
4375
|
+
for (let I = -180; I <= 180; I += 5) {
|
|
4376
|
+
const R = g(b, I);
|
|
4377
|
+
R.visible !== !1 && (O += O === "" ? `M${R.x},${R.y}` : ` L${R.x},${R.y}`);
|
|
4376
4378
|
}
|
|
4377
|
-
|
|
4379
|
+
O && f.push(O);
|
|
4378
4380
|
}
|
|
4379
4381
|
for (let b = -180; b <= 180; b += p) {
|
|
4380
|
-
let
|
|
4381
|
-
for (let
|
|
4382
|
-
const R = g(
|
|
4383
|
-
R.visible !== !1 && (
|
|
4382
|
+
let O = "";
|
|
4383
|
+
for (let I = -90; I <= 90; I += 5) {
|
|
4384
|
+
const R = g(I, b);
|
|
4385
|
+
R.visible !== !1 && (O += O === "" ? `M${R.x},${R.y}` : ` L${R.x},${R.y}`);
|
|
4384
4386
|
}
|
|
4385
|
-
|
|
4387
|
+
O && f.push(O);
|
|
4386
4388
|
}
|
|
4387
4389
|
return f;
|
|
4388
|
-
}, [g, p]),
|
|
4390
|
+
}, [g, p]), W = K(() => {
|
|
4389
4391
|
if (d === "orthographic") {
|
|
4390
|
-
const f = Math.min(
|
|
4391
|
-
return `M${
|
|
4392
|
-
A${f},${f} 0 1,1 ${
|
|
4393
|
-
A${f},${f} 0 1,1 ${
|
|
4392
|
+
const f = Math.min(N, _) / 2 - 10;
|
|
4393
|
+
return `M${N / 2 + f},${_ / 2}
|
|
4394
|
+
A${f},${f} 0 1,1 ${N / 2 - f},${_ / 2}
|
|
4395
|
+
A${f},${f} 0 1,1 ${N / 2 + f},${_ / 2}`;
|
|
4394
4396
|
}
|
|
4395
4397
|
return null;
|
|
4396
|
-
}, [d,
|
|
4398
|
+
}, [d, N, _]), T = K(() => {
|
|
4397
4399
|
const f = [...n];
|
|
4398
4400
|
for (const b of t)
|
|
4399
|
-
|
|
4401
|
+
S.has(b.id) && b.markers && f.push(...b.markers);
|
|
4400
4402
|
return f;
|
|
4401
|
-
}, [n, t,
|
|
4403
|
+
}, [n, t, S]), le = K(() => {
|
|
4402
4404
|
const f = [...r];
|
|
4403
4405
|
for (const b of t)
|
|
4404
|
-
|
|
4406
|
+
S.has(b.id) && b.polylines && f.push(...b.polylines);
|
|
4405
4407
|
return f;
|
|
4406
|
-
}, [r, t,
|
|
4408
|
+
}, [r, t, S]), fe = K(() => {
|
|
4407
4409
|
const f = [...i];
|
|
4408
4410
|
for (const b of t)
|
|
4409
|
-
|
|
4411
|
+
S.has(b.id) && b.polygons && f.push(...b.polygons);
|
|
4410
4412
|
return f;
|
|
4411
|
-
}, [i, t,
|
|
4413
|
+
}, [i, t, S]), be = P(
|
|
4412
4414
|
(f) => {
|
|
4413
4415
|
L && (ee(!0), ie({ x: f.clientX, y: f.clientY, center: { ...Z } }));
|
|
4414
4416
|
},
|
|
@@ -4417,14 +4419,14 @@ function sn({
|
|
|
4417
4419
|
(f) => {
|
|
4418
4420
|
if (!Q || !re)
|
|
4419
4421
|
return;
|
|
4420
|
-
const b = f.clientX - re.x,
|
|
4422
|
+
const b = f.clientX - re.x, O = f.clientY - re.y, I = -(b / N) * 360 / G, R = O / _ * 180 / G;
|
|
4421
4423
|
ae({
|
|
4422
4424
|
lat: Math.max(-85, Math.min(85, re.center.lat + R)),
|
|
4423
|
-
lng: (re.center.lng +
|
|
4425
|
+
lng: (re.center.lng + I + 180) % 360 - 180
|
|
4424
4426
|
});
|
|
4425
4427
|
},
|
|
4426
|
-
[Q, re,
|
|
4427
|
-
),
|
|
4428
|
+
[Q, re, N, _, G]
|
|
4429
|
+
), ye = P(() => {
|
|
4428
4430
|
ee(!1), ie(null);
|
|
4429
4431
|
}, []), we = P(
|
|
4430
4432
|
(f) => {
|
|
@@ -4432,41 +4434,41 @@ function sn({
|
|
|
4432
4434
|
return;
|
|
4433
4435
|
f.preventDefault();
|
|
4434
4436
|
const b = f.deltaY > 0 ? 0.9 : 1.1;
|
|
4435
|
-
|
|
4437
|
+
C((O) => Math.max(0.5, Math.min(20, O * b)));
|
|
4436
4438
|
},
|
|
4437
4439
|
[H]
|
|
4438
|
-
),
|
|
4440
|
+
), Se = P(
|
|
4439
4441
|
(f) => {
|
|
4440
4442
|
var R;
|
|
4441
|
-
if (!
|
|
4443
|
+
if (!Y)
|
|
4442
4444
|
return;
|
|
4443
|
-
const b = (R =
|
|
4445
|
+
const b = (R = X.current) == null ? void 0 : R.getBoundingClientRect();
|
|
4444
4446
|
if (!b)
|
|
4445
4447
|
return;
|
|
4446
|
-
const
|
|
4447
|
-
|
|
4448
|
+
const O = f.clientX - b.left, I = f.clientY - b.top;
|
|
4449
|
+
Y(M(O, I));
|
|
4448
4450
|
},
|
|
4449
|
-
[
|
|
4451
|
+
[Y, M]
|
|
4450
4452
|
), Le = (f) => {
|
|
4451
4453
|
const b = g(f.position.lat, f.position.lng);
|
|
4452
4454
|
if (b.visible === !1)
|
|
4453
4455
|
return null;
|
|
4454
|
-
const
|
|
4456
|
+
const O = (A == null ? void 0 : A.id) === f.id, I = (f.size || 8) * (O ? 1.3 : 1), R = (() => {
|
|
4455
4457
|
switch (f.shape) {
|
|
4456
4458
|
case "square":
|
|
4457
|
-
return /* @__PURE__ */ o("rect", { x: b.x -
|
|
4459
|
+
return /* @__PURE__ */ o("rect", { x: b.x - I / 2, y: b.y - I / 2, width: I, height: I });
|
|
4458
4460
|
case "triangle":
|
|
4459
4461
|
return /* @__PURE__ */ o(
|
|
4460
4462
|
"polygon",
|
|
4461
4463
|
{
|
|
4462
|
-
points: `${b.x},${b.y -
|
|
4464
|
+
points: `${b.x},${b.y - I} ${b.x - I},${b.y + I / 2} ${b.x + I},${b.y + I / 2}`
|
|
4463
4465
|
}
|
|
4464
4466
|
);
|
|
4465
4467
|
case "diamond":
|
|
4466
4468
|
return /* @__PURE__ */ o(
|
|
4467
4469
|
"polygon",
|
|
4468
4470
|
{
|
|
4469
|
-
points: `${b.x},${b.y -
|
|
4471
|
+
points: `${b.x},${b.y - I} ${b.x + I},${b.y} ${b.x},${b.y + I} ${b.x - I},${b.y}`
|
|
4470
4472
|
}
|
|
4471
4473
|
);
|
|
4472
4474
|
case "pin":
|
|
@@ -4474,22 +4476,22 @@ function sn({
|
|
|
4474
4476
|
"path",
|
|
4475
4477
|
{
|
|
4476
4478
|
d: `M${b.x},${b.y}
|
|
4477
|
-
c0,-${
|
|
4478
|
-
a${
|
|
4479
|
-
c0,${
|
|
4479
|
+
c0,-${I * 1.5} -${I},-${I * 2} -${I},-${I * 2.5}
|
|
4480
|
+
a${I},${I} 0 1,1 ${I * 2},0
|
|
4481
|
+
c0,${I * 0.5} -${I},${I} -${I},${I * 2.5}`
|
|
4480
4482
|
}
|
|
4481
4483
|
);
|
|
4482
4484
|
case "circle":
|
|
4483
4485
|
default:
|
|
4484
|
-
return /* @__PURE__ */ o("circle", { cx: b.x, cy: b.y, r:
|
|
4486
|
+
return /* @__PURE__ */ o("circle", { cx: b.x, cy: b.y, r: I / 2 });
|
|
4485
4487
|
}
|
|
4486
4488
|
})();
|
|
4487
4489
|
return /* @__PURE__ */ u(
|
|
4488
4490
|
"g",
|
|
4489
4491
|
{
|
|
4490
|
-
fill: f.color || "#
|
|
4491
|
-
stroke:
|
|
4492
|
-
strokeWidth:
|
|
4492
|
+
fill: f.color || "var(--nice-accent-pink, #e91e63)",
|
|
4493
|
+
stroke: O ? "var(--nice-text, #000)" : "var(--nice-bg, #fff)",
|
|
4494
|
+
strokeWidth: O ? 2 : 1,
|
|
4493
4495
|
style: { cursor: "pointer" },
|
|
4494
4496
|
onMouseEnter: () => {
|
|
4495
4497
|
k(f), ne == null || ne(f);
|
|
@@ -4497,48 +4499,48 @@ function sn({
|
|
|
4497
4499
|
onMouseLeave: () => {
|
|
4498
4500
|
k(null), ne == null || ne(null);
|
|
4499
4501
|
},
|
|
4500
|
-
onClick: (
|
|
4501
|
-
|
|
4502
|
+
onClick: (Ce) => {
|
|
4503
|
+
Ce.stopPropagation(), se == null || se(f);
|
|
4502
4504
|
},
|
|
4503
4505
|
children: [
|
|
4504
4506
|
R,
|
|
4505
|
-
f.label && /* @__PURE__ */ o("text", { x: b.x +
|
|
4507
|
+
f.label && /* @__PURE__ */ o("text", { x: b.x + I, y: b.y, fontSize: 10, fill: "var(--nice-text, #333)", dominantBaseline: "middle", children: f.label })
|
|
4506
4508
|
]
|
|
4507
4509
|
},
|
|
4508
4510
|
f.id
|
|
4509
4511
|
);
|
|
4510
|
-
},
|
|
4512
|
+
}, _e = (f) => {
|
|
4511
4513
|
if (f.path.length < 2)
|
|
4512
4514
|
return null;
|
|
4513
|
-
const b = f.path.map((
|
|
4514
|
-
const R = g(
|
|
4515
|
-
return R.visible === !1 ? "" :
|
|
4515
|
+
const b = f.path.map((O, I) => {
|
|
4516
|
+
const R = g(O.lat, O.lng);
|
|
4517
|
+
return R.visible === !1 ? "" : I === 0 ? `M${R.x},${R.y}` : `L${R.x},${R.y}`;
|
|
4516
4518
|
}).filter(Boolean).join(" ");
|
|
4517
4519
|
return b ? /* @__PURE__ */ o(
|
|
4518
4520
|
"path",
|
|
4519
4521
|
{
|
|
4520
4522
|
d: b,
|
|
4521
4523
|
fill: "none",
|
|
4522
|
-
stroke: f.color || "#
|
|
4524
|
+
stroke: f.color || "var(--nice-primary, #2196f3)",
|
|
4523
4525
|
strokeWidth: f.width || 2,
|
|
4524
4526
|
strokeDasharray: f.style === "dashed" ? "8,4" : f.style === "dotted" ? "2,2" : void 0,
|
|
4525
4527
|
markerEnd: f.arrows ? "url(#arrow)" : void 0
|
|
4526
4528
|
},
|
|
4527
4529
|
f.id
|
|
4528
4530
|
) : null;
|
|
4529
|
-
},
|
|
4531
|
+
}, We = (f) => {
|
|
4530
4532
|
if (f.path.length < 3)
|
|
4531
4533
|
return null;
|
|
4532
|
-
const b = f.path.map((
|
|
4533
|
-
const R = g(
|
|
4534
|
-
return R.visible === !1 ? "" :
|
|
4534
|
+
const b = f.path.map((O, I) => {
|
|
4535
|
+
const R = g(O.lat, O.lng);
|
|
4536
|
+
return R.visible === !1 ? "" : I === 0 ? `M${R.x},${R.y}` : `L${R.x},${R.y}`;
|
|
4535
4537
|
}).filter(Boolean).join(" ") + " Z";
|
|
4536
4538
|
return /* @__PURE__ */ o(
|
|
4537
4539
|
"path",
|
|
4538
4540
|
{
|
|
4539
4541
|
d: b,
|
|
4540
4542
|
fill: f.fillColor || "#4CAF5040",
|
|
4541
|
-
stroke: f.strokeColor || "#
|
|
4543
|
+
stroke: f.strokeColor || "var(--nice-success, #4caf50)",
|
|
4542
4544
|
strokeWidth: f.strokeWidth || 1,
|
|
4543
4545
|
fillOpacity: f.fillOpacity || 0.5,
|
|
4544
4546
|
style: { cursor: "pointer" },
|
|
@@ -4546,54 +4548,54 @@ function sn({
|
|
|
4546
4548
|
},
|
|
4547
4549
|
f.id
|
|
4548
4550
|
);
|
|
4549
|
-
},
|
|
4551
|
+
}, Ne = K(() => {
|
|
4550
4552
|
if (!U.show)
|
|
4551
4553
|
return null;
|
|
4552
|
-
const f = 111, b =
|
|
4554
|
+
const f = 111, b = N / 360 * G, O = f / b, I = O * 100, R = Math.pow(10, Math.floor(Math.log10(I))), Ce = R * (I / R >= 5 ? 5 : I / R >= 2 ? 2 : 1);
|
|
4553
4555
|
return {
|
|
4554
|
-
width:
|
|
4555
|
-
label:
|
|
4556
|
+
width: Ce / O,
|
|
4557
|
+
label: Ce >= 1e3 ? `${Ce / 1e3} km` : `${Ce} km`
|
|
4556
4558
|
};
|
|
4557
|
-
}, [U.show,
|
|
4559
|
+
}, [U.show, N, G]);
|
|
4558
4560
|
return /* @__PURE__ */ u(
|
|
4559
4561
|
"div",
|
|
4560
4562
|
{
|
|
4561
|
-
ref:
|
|
4562
|
-
className: `nice-geographic-map ${
|
|
4563
|
+
ref: X,
|
|
4564
|
+
className: `nice-geographic-map ${me || ""}`,
|
|
4563
4565
|
style: {
|
|
4564
4566
|
width: te,
|
|
4565
4567
|
height: V,
|
|
4566
4568
|
position: "relative",
|
|
4567
4569
|
overflow: "hidden",
|
|
4568
4570
|
background: w,
|
|
4569
|
-
border: "1px solid #
|
|
4571
|
+
border: "1px solid var(--nice-border, #ccc)",
|
|
4570
4572
|
borderRadius: 4,
|
|
4571
4573
|
cursor: Q ? "grabbing" : "grab",
|
|
4572
4574
|
...xe
|
|
4573
4575
|
},
|
|
4574
4576
|
onMouseDown: be,
|
|
4575
4577
|
onMouseMove: ge,
|
|
4576
|
-
onMouseUp:
|
|
4577
|
-
onMouseLeave:
|
|
4578
|
+
onMouseUp: ye,
|
|
4579
|
+
onMouseLeave: ye,
|
|
4578
4580
|
onWheel: we,
|
|
4579
|
-
onClick:
|
|
4581
|
+
onClick: Se,
|
|
4580
4582
|
children: [
|
|
4581
4583
|
/* @__PURE__ */ u("svg", { width: "100%", height: "100%", children: [
|
|
4582
|
-
/* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o("marker", { id: "arrow", markerWidth: "10", markerHeight: "10", refX: "9", refY: "3", orient: "auto", children: /* @__PURE__ */ o("path", { d: "M0,0 L0,6 L9,3 z", fill: "#
|
|
4583
|
-
d === "orthographic" &&
|
|
4584
|
-
/* @__PURE__ */ o("path", { d:
|
|
4584
|
+
/* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o("marker", { id: "arrow", markerWidth: "10", markerHeight: "10", refX: "9", refY: "3", orient: "auto", children: /* @__PURE__ */ o("path", { d: "M0,0 L0,6 L9,3 z", fill: "var(--nice-primary, #2196f3)" }) }) }),
|
|
4585
|
+
d === "orthographic" && W && /* @__PURE__ */ u(ze, { children: [
|
|
4586
|
+
/* @__PURE__ */ o("path", { d: W, fill: w, stroke: "var(--nice-text-muted, #999)", strokeWidth: 1 }),
|
|
4585
4587
|
/* @__PURE__ */ o(
|
|
4586
4588
|
"circle",
|
|
4587
4589
|
{
|
|
4588
|
-
cx:
|
|
4589
|
-
cy:
|
|
4590
|
-
r: Math.min(
|
|
4590
|
+
cx: N / 2,
|
|
4591
|
+
cy: _ / 2,
|
|
4592
|
+
r: Math.min(N, _) / 2 - 11,
|
|
4591
4593
|
fill: $,
|
|
4592
4594
|
opacity: 0.3
|
|
4593
4595
|
}
|
|
4594
4596
|
)
|
|
4595
4597
|
] }),
|
|
4596
|
-
h &&
|
|
4598
|
+
h && z.map((f, b) => /* @__PURE__ */ o(
|
|
4597
4599
|
"path",
|
|
4598
4600
|
{
|
|
4599
4601
|
d: f,
|
|
@@ -4604,27 +4606,27 @@ function sn({
|
|
|
4604
4606
|
},
|
|
4605
4607
|
`graticule-${b}`
|
|
4606
4608
|
)),
|
|
4607
|
-
|
|
4609
|
+
y && d !== "orthographic" && /* @__PURE__ */ o("g", { transform: `scale(${N / 100}, ${_ / 100})`, children: /* @__PURE__ */ o(
|
|
4608
4610
|
"path",
|
|
4609
4611
|
{
|
|
4610
4612
|
d: qt,
|
|
4611
4613
|
fill: $,
|
|
4612
|
-
stroke:
|
|
4614
|
+
stroke: F,
|
|
4613
4615
|
strokeWidth: 0.2
|
|
4614
4616
|
}
|
|
4615
4617
|
) }),
|
|
4616
|
-
fe.map(
|
|
4617
|
-
le.map(
|
|
4618
|
-
|
|
4618
|
+
fe.map(We),
|
|
4619
|
+
le.map(_e),
|
|
4620
|
+
T.map(Le)
|
|
4619
4621
|
] }),
|
|
4620
|
-
|
|
4622
|
+
Ne && /* @__PURE__ */ u(
|
|
4621
4623
|
"div",
|
|
4622
4624
|
{
|
|
4623
4625
|
style: {
|
|
4624
4626
|
position: "absolute",
|
|
4625
|
-
[(
|
|
4627
|
+
[(Ee = U.position) != null && Ee.includes("bottom") ? "bottom" : "top"]: 8,
|
|
4626
4628
|
[(v = U.position) != null && v.includes("right") ? "right" : "left"]: 8,
|
|
4627
|
-
background: "rgba(255,255,255,0.9)",
|
|
4629
|
+
background: "var(--nice-overlay-light-90, rgba(255, 255, 255, 0.9))",
|
|
4628
4630
|
padding: "4px 8px",
|
|
4629
4631
|
borderRadius: 4,
|
|
4630
4632
|
fontSize: "0.7rem"
|
|
@@ -4634,14 +4636,14 @@ function sn({
|
|
|
4634
4636
|
"div",
|
|
4635
4637
|
{
|
|
4636
4638
|
style: {
|
|
4637
|
-
width:
|
|
4639
|
+
width: Ne.width,
|
|
4638
4640
|
height: 4,
|
|
4639
|
-
background: "#333",
|
|
4641
|
+
background: "var(--nice-text, #333)",
|
|
4640
4642
|
marginBottom: 2
|
|
4641
4643
|
}
|
|
4642
4644
|
}
|
|
4643
4645
|
),
|
|
4644
|
-
/* @__PURE__ */ o("div", { children:
|
|
4646
|
+
/* @__PURE__ */ o("div", { children: Ne.label })
|
|
4645
4647
|
]
|
|
4646
4648
|
}
|
|
4647
4649
|
),
|
|
@@ -4652,7 +4654,7 @@ function sn({
|
|
|
4652
4654
|
position: "absolute",
|
|
4653
4655
|
[(D = de.position) != null && D.includes("bottom") ? "bottom" : "top"]: 8,
|
|
4654
4656
|
[(B = de.position) != null && B.includes("left") ? "left" : "right"]: 8,
|
|
4655
|
-
background: "rgba(255,255,255,0.95)",
|
|
4657
|
+
background: "var(--nice-overlay-light-95, rgba(255, 255, 255, 0.95))",
|
|
4656
4658
|
padding: 8,
|
|
4657
4659
|
borderRadius: 4,
|
|
4658
4660
|
fontSize: "0.75rem",
|
|
@@ -4677,23 +4679,23 @@ function sn({
|
|
|
4677
4679
|
]
|
|
4678
4680
|
}
|
|
4679
4681
|
),
|
|
4680
|
-
(
|
|
4682
|
+
(A == null ? void 0 : A.tooltip) && /* @__PURE__ */ o(
|
|
4681
4683
|
"div",
|
|
4682
4684
|
{
|
|
4683
4685
|
style: {
|
|
4684
4686
|
position: "absolute",
|
|
4685
|
-
top: g(
|
|
4686
|
-
left: g(
|
|
4687
|
+
top: g(A.position.lat, A.position.lng).y - 30,
|
|
4688
|
+
left: g(A.position.lat, A.position.lng).x,
|
|
4687
4689
|
transform: "translateX(-50%)",
|
|
4688
|
-
background: "rgba(0,0,0,0.8)",
|
|
4689
|
-
color: "#
|
|
4690
|
+
background: "var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",
|
|
4691
|
+
color: "var(--nice-bg, #fff)",
|
|
4690
4692
|
padding: "4px 8px",
|
|
4691
4693
|
borderRadius: 4,
|
|
4692
4694
|
fontSize: "0.75rem",
|
|
4693
4695
|
pointerEvents: "none",
|
|
4694
4696
|
whiteSpace: "nowrap"
|
|
4695
4697
|
},
|
|
4696
|
-
children:
|
|
4698
|
+
children: A.tooltip
|
|
4697
4699
|
}
|
|
4698
4700
|
),
|
|
4699
4701
|
/* @__PURE__ */ u(
|
|
@@ -4703,11 +4705,11 @@ function sn({
|
|
|
4703
4705
|
position: "absolute",
|
|
4704
4706
|
bottom: 8,
|
|
4705
4707
|
right: 8,
|
|
4706
|
-
background: "rgba(255,255,255,0.9)",
|
|
4708
|
+
background: "var(--nice-overlay-light-90, rgba(255, 255, 255, 0.9))",
|
|
4707
4709
|
padding: "2px 6px",
|
|
4708
4710
|
borderRadius: 4,
|
|
4709
4711
|
fontSize: "0.7rem",
|
|
4710
|
-
color: "#666"
|
|
4712
|
+
color: "var(--nice-text-secondary, #666)"
|
|
4711
4713
|
},
|
|
4712
4714
|
children: [
|
|
4713
4715
|
Z.lat.toFixed(2),
|
|
@@ -4724,7 +4726,7 @@ function sn({
|
|
|
4724
4726
|
position: "absolute",
|
|
4725
4727
|
top: 8,
|
|
4726
4728
|
left: 8,
|
|
4727
|
-
background: "rgba(255,255,255,0.95)",
|
|
4729
|
+
background: "var(--nice-overlay-light-95, rgba(255, 255, 255, 0.95))",
|
|
4728
4730
|
padding: 8,
|
|
4729
4731
|
borderRadius: 4,
|
|
4730
4732
|
fontSize: "0.75rem"
|
|
@@ -4740,10 +4742,10 @@ function sn({
|
|
|
4740
4742
|
"input",
|
|
4741
4743
|
{
|
|
4742
4744
|
type: "checkbox",
|
|
4743
|
-
checked:
|
|
4745
|
+
checked: S.has(f.id),
|
|
4744
4746
|
onChange: (b) => {
|
|
4745
|
-
const
|
|
4746
|
-
b.target.checked ?
|
|
4747
|
+
const O = new Set(S);
|
|
4748
|
+
b.target.checked ? O.add(f.id) : O.delete(f.id), E(O);
|
|
4747
4749
|
}
|
|
4748
4750
|
}
|
|
4749
4751
|
),
|
|
@@ -4785,7 +4787,7 @@ function sn({
|
|
|
4785
4787
|
"button",
|
|
4786
4788
|
{
|
|
4787
4789
|
onClick: () => {
|
|
4788
|
-
|
|
4790
|
+
C(1), ae({ lat: 0, lng: 0 });
|
|
4789
4791
|
},
|
|
4790
4792
|
style: { padding: "2px 4px", fontSize: "0.75rem", cursor: "pointer" },
|
|
4791
4793
|
children: "Reset View"
|
|
@@ -4799,7 +4801,7 @@ function sn({
|
|
|
4799
4801
|
);
|
|
4800
4802
|
}
|
|
4801
4803
|
export {
|
|
4802
|
-
|
|
4804
|
+
Ct as CitationService,
|
|
4803
4805
|
ft as DataAnalysisService,
|
|
4804
4806
|
ct as LabNotebookProvider,
|
|
4805
4807
|
lt as LabNotebookService,
|
|
@@ -4816,5 +4818,5 @@ export {
|
|
|
4816
4818
|
Gt as createDataAnalysisService,
|
|
4817
4819
|
Kt as createLabNotebookService,
|
|
4818
4820
|
et as useCitation,
|
|
4819
|
-
|
|
4821
|
+
Te as useLabNotebook
|
|
4820
4822
|
};
|