@biolibs/bionet-scene 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -2
- package/dist/explorer.d.ts +57 -0
- package/dist/explorer.d.ts.map +1 -0
- package/dist/explorer.js +77 -0
- package/dist/explorer.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/scene.d.ts +49 -0
- package/dist/scene.d.ts.map +1 -0
- package/dist/scene.js +239 -0
- package/dist/scene.js.map +1 -0
- package/dist/view.d.ts +132 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +161 -0
- package/dist/view.js.map +1 -0
- package/package.json +57 -4
- package/scene.css +43 -0
- package/src/explorer.tsx +112 -0
- package/src/index.ts +17 -0
- package/src/scene.tsx +337 -0
- package/src/view.ts +251 -0
package/README.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @biolibs/bionet-scene
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A lab in three dimensions. Rooms, freezers, boxes and tubes drawn as edges in the Bionet theme — glowing on black, or plainly on a pale ground — with a camera that moves from the whole lab down to one position in a box.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @biolibs/bionet-scene @biolibs/bionet-space @biolibs/bionet-theme three @react-three/fiber @react-three/drei @react-three/postprocessing
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## The whole thing
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import "@biolibs/bionet-theme/theme.css";
|
|
13
|
+
import "@biolibs/bionet-scene/scene.css";
|
|
14
|
+
import { exampleLab } from "@biolibs/bionet-space";
|
|
15
|
+
import { LabExplorer } from "@biolibs/bionet-scene";
|
|
16
|
+
|
|
17
|
+
<LabExplorer layout={exampleLab()} labName="The Wren Lab"
|
|
18
|
+
neighbours={[{ id: "https://lab-thistle.onrender.com", name: "Thistle Lab" }]} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Press a freezer to look into it, a box to take it out, a tube to pick it. The line at the top is the way back. Typing a part's name lights up every box holding one, and Return goes to the first. It fills whatever it is put in, and follows the system's light or dark setting unless `theme` pins one.
|
|
22
|
+
|
|
23
|
+
three.js needs a canvas, so in Next.js load it in the browser only: `dynamic(() => import("@biolibs/bionet-scene").then((m) => m.LabExplorer), { ssr: false })`.
|
|
24
|
+
|
|
25
|
+
## A real lab
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { useLab } from "@biolibs/bionet-react";
|
|
29
|
+
import { LabView } from "@biolibs/bionet-scene";
|
|
30
|
+
|
|
31
|
+
const lab = useLab()?.lab;
|
|
32
|
+
lab && <LabView lab={lab} name={lab.name ?? "Lab"} />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`LabView` draws a lab from its own record: the places its members added and where they put each
|
|
36
|
+
tube. Until the lab has a place it says there is nothing to draw yet.
|
|
37
|
+
|
|
38
|
+
## What to draw is decided before anything is drawn
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { exampleLab } from "@biolibs/bionet-space";
|
|
42
|
+
import { focusOn, sceneView } from "@biolibs/bionet-scene";
|
|
43
|
+
|
|
44
|
+
const lab = exampleLab();
|
|
45
|
+
sceneView(lab, { place: null }).level; // "lab"
|
|
46
|
+
sceneView(lab, { place: null }).tubes.length; // 0: from across the room, no tube is worth drawing
|
|
47
|
+
sceneView(lab, { place: "minus80-s3-B-4" }).level; // "box"
|
|
48
|
+
focusOn(lab, "tube-1622"); // { place: "minus80-s3-B-4", item: "tube-1622" }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`sceneView` turns a lab and a focus into a list: each place with its colour's meaning and how strongly to draw it, the tubes and empty positions of the box being looked at, where the camera stands, and the way back. It is plain data and is tested without a graphics card. `LabScene` draws that list and reports what was pressed; `LabExplorer` is `LabScene` with the crumbs, the search and the picked tube's card.
|
|
52
|
+
|
|
53
|
+
## What is fixed
|
|
54
|
+
|
|
55
|
+
There are no options for how the scene looks. Colours come from `@biolibs/bionet-theme` by meaning (`yours`, `theirs`, `held`, `found`, `attention`), and sizes come from the lab's own data.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Layout, type RecordedLab } from "@biolibs/bionet-space";
|
|
2
|
+
import { type Theme } from "@biolibs/bionet-theme";
|
|
3
|
+
import { type Neighbour } from "./scene.js";
|
|
4
|
+
import { type Focus } from "./view.js";
|
|
5
|
+
/**
|
|
6
|
+
* A lab in three dimensions, with the controls to move around it.
|
|
7
|
+
*
|
|
8
|
+
* Press a freezer to look into it, a box to open it, a tube to pick it. The line at the top is the
|
|
9
|
+
* way back. Typing a part's name lights up every box that holds one, and Return goes to the first.
|
|
10
|
+
*
|
|
11
|
+
* @param props - `layout` is the lab; `labName` is what to call it; `neighbours` are other labs to
|
|
12
|
+
* draw beside it; `theme` pins a theme, which otherwise follows the system; `focus` is where to
|
|
13
|
+
* start; `onNeighbour` is told when another lab is pressed.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import "@biolibs/bionet-theme/theme.css";
|
|
18
|
+
* import "@biolibs/bionet-scene/scene.css";
|
|
19
|
+
* import { exampleLab } from "@biolibs/bionet-space";
|
|
20
|
+
* import { LabExplorer } from "@biolibs/bionet-scene";
|
|
21
|
+
*
|
|
22
|
+
* <LabExplorer layout={exampleLab()} labName="The Wren Lab" />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function LabExplorer({ layout, labName, neighbours, theme, focus: start, onNeighbour }: {
|
|
26
|
+
layout: Layout;
|
|
27
|
+
labName?: string;
|
|
28
|
+
neighbours?: readonly Neighbour[];
|
|
29
|
+
theme?: Theme;
|
|
30
|
+
focus?: Focus;
|
|
31
|
+
onNeighbour?: (id: string) => void;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* A lab's own record of itself, drawn.
|
|
35
|
+
*
|
|
36
|
+
* It takes the lab as plain data — what `@biolibs/bionet-client` gives a window fits as it is — so
|
|
37
|
+
* it can be put in a desktop window or on a web page alike. Until the lab has said where anything
|
|
38
|
+
* is kept there is nothing to draw, and it says so.
|
|
39
|
+
*
|
|
40
|
+
* @param props - `lab` is the lab's places, items and parts; `name` is what to call it; `theme` pins
|
|
41
|
+
* a theme; `neighbours` are other labs to draw beside it.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* import { LabView } from "@biolibs/bionet-scene";
|
|
46
|
+
*
|
|
47
|
+
* // `lab` is the lab as a window is given it: the `lab` of a client's snapshot fits as it is.
|
|
48
|
+
* <LabView lab={lab} name={lab.name ?? "Lab"} />
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function LabView({ lab, name, theme, neighbours }: {
|
|
52
|
+
lab: RecordedLab;
|
|
53
|
+
name?: string;
|
|
54
|
+
theme?: Theme;
|
|
55
|
+
neighbours?: readonly Neighbour[];
|
|
56
|
+
}): import("react").JSX.Element;
|
|
57
|
+
//# sourceMappingURL=explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer.d.ts","sourceRoot":"","sources":["../src/explorer.tsx"],"names":[],"mappings":"AASA,OAAO,EAAsB,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAsB,KAAK,KAAK,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,OAAe,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE;IACrG,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACvI,+BA6CA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,EAAE,GAAG,EAAE,IAAY,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;IAAE,GAAG,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,+BAUtJ"}
|
package/dist/explorer.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* A lab to walk around: the scene, with the way back, a search, and what was picked.
|
|
5
|
+
*
|
|
6
|
+
* It is given a lab and keeps only what is being looked at and what was typed. Everything drawn
|
|
7
|
+
* comes from `sceneView`, so what is on screen is always the lab it was given.
|
|
8
|
+
*/
|
|
9
|
+
import { useMemo, useState } from "react";
|
|
10
|
+
import { layoutFrom, search } from "@biolibs/bionet-space";
|
|
11
|
+
import { THEME_ATTRIBUTE } from "@biolibs/bionet-theme";
|
|
12
|
+
import { LabScene, useSystemTheme } from "./scene.js";
|
|
13
|
+
import { focusOn, sceneView } from "./view.js";
|
|
14
|
+
/**
|
|
15
|
+
* A lab in three dimensions, with the controls to move around it.
|
|
16
|
+
*
|
|
17
|
+
* Press a freezer to look into it, a box to open it, a tube to pick it. The line at the top is the
|
|
18
|
+
* way back. Typing a part's name lights up every box that holds one, and Return goes to the first.
|
|
19
|
+
*
|
|
20
|
+
* @param props - `layout` is the lab; `labName` is what to call it; `neighbours` are other labs to
|
|
21
|
+
* draw beside it; `theme` pins a theme, which otherwise follows the system; `focus` is where to
|
|
22
|
+
* start; `onNeighbour` is told when another lab is pressed.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* import "@biolibs/bionet-theme/theme.css";
|
|
27
|
+
* import "@biolibs/bionet-scene/scene.css";
|
|
28
|
+
* import { exampleLab } from "@biolibs/bionet-space";
|
|
29
|
+
* import { LabExplorer } from "@biolibs/bionet-scene";
|
|
30
|
+
*
|
|
31
|
+
* <LabExplorer layout={exampleLab()} labName="The Wren Lab" />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function LabExplorer({ layout, labName = "Lab", neighbours, theme, focus: start, onNeighbour }) {
|
|
35
|
+
const system = useSystemTheme();
|
|
36
|
+
const shown = theme ?? system;
|
|
37
|
+
const [focus, setFocus] = useState(start ?? { place: null });
|
|
38
|
+
const [words, setWords] = useState("");
|
|
39
|
+
const found = useMemo(() => search(layout, words), [layout, words]);
|
|
40
|
+
const matches = useMemo(() => new Set(found.map((one) => one.item)), [found]);
|
|
41
|
+
const view = useMemo(() => sceneView(layout, focus, { matches, labName }), [layout, focus, matches, labName]);
|
|
42
|
+
const picked = view.tubes.find((tube) => tube.selected);
|
|
43
|
+
const where = view.crumbs.at(-1);
|
|
44
|
+
return (_jsxs("div", { className: "bionet-scene", [THEME_ATTRIBUTE]: shown, children: [_jsx(LabScene, { view: view, theme: shown, onFocus: setFocus, ...(neighbours === undefined ? {} : { neighbours }), ...(onNeighbour === undefined ? {} : { onNeighbour }) }), _jsx("nav", { className: "crumbs", "aria-label": "Where you are", children: view.crumbs.map((crumb, at) => (_jsxs("span", { children: [at > 0 && _jsx("span", { className: "sep", "aria-hidden": "true", children: "\u203A" }), at === view.crumbs.length - 1 ? _jsx("strong", { children: crumb.name })
|
|
45
|
+
: _jsx("button", { type: "button", onClick: () => setFocus({ place: crumb.id }), children: crumb.name })] }, crumb.id ?? "lab"))) }), _jsxs("form", { className: "search", role: "search", onSubmit: (event) => {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
const first = found[0];
|
|
48
|
+
if (first !== undefined)
|
|
49
|
+
setFocus(focusOn(layout, first.item) ?? focus);
|
|
50
|
+
}, children: [_jsx("input", { value: words, onChange: (event) => setWords(event.target.value), placeholder: "Find a part", "aria-label": "Find a part", spellCheck: false }), words.trim() !== "" && _jsx("span", { className: "count", children: found.length === 0 ? "none" : `${found.length} found` })] }), _jsxs("p", { className: "status", children: [view.holding.toLocaleString("en-US"), " ", view.holding === 1 ? "tube" : "tubes", " in ", where.name, view.level !== "box" && _jsx("span", { className: "hint", children: " \u00B7 press something to look into it" })] }), picked !== undefined && (_jsxs("aside", { className: "picked", "aria-live": "polite", children: [_jsx("strong", { children: picked.name }), _jsx("span", { children: picked.amount }), _jsxs("span", { children: ["position ", picked.position, " \u00B7 ", where.name] })] }))] }));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A lab's own record of itself, drawn.
|
|
54
|
+
*
|
|
55
|
+
* It takes the lab as plain data — what `@biolibs/bionet-client` gives a window fits as it is — so
|
|
56
|
+
* it can be put in a desktop window or on a web page alike. Until the lab has said where anything
|
|
57
|
+
* is kept there is nothing to draw, and it says so.
|
|
58
|
+
*
|
|
59
|
+
* @param props - `lab` is the lab's places, items and parts; `name` is what to call it; `theme` pins
|
|
60
|
+
* a theme; `neighbours` are other labs to draw beside it.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* import { LabView } from "@biolibs/bionet-scene";
|
|
65
|
+
*
|
|
66
|
+
* // `lab` is the lab as a window is given it: the `lab` of a client's snapshot fits as it is.
|
|
67
|
+
* <LabView lab={lab} name={lab.name ?? "Lab"} />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function LabView({ lab, name = "Lab", theme, neighbours }) {
|
|
71
|
+
const layout = useMemo(() => layoutFrom(lab, { room: name }), [lab.places, lab.items, lab.parts, name]);
|
|
72
|
+
if (layout.places.length === 0) {
|
|
73
|
+
return (_jsx("div", { className: "bionet-scene empty", ...(theme === undefined ? {} : { [THEME_ATTRIBUTE]: theme }), children: _jsx("p", { children: "Nothing to draw yet. Add a place \u2014 a freezer, then the boxes in it \u2014 and it appears here." }) }));
|
|
74
|
+
}
|
|
75
|
+
return _jsx(LabExplorer, { layout: layout, labName: name, ...(theme === undefined ? {} : { theme }), ...(neighbours === undefined ? {} : { neighbours }) });
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=explorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer.js","sourceRoot":"","sources":["../src/explorer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAiC,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAc,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAkB,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAElG;IACC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,KAAK,IAAI,MAAM,CAAC;IAC9B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAQ,KAAK,IAAI,EAAE,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AAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,KAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,GAAI,CAAC;AAC1J,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* `@biolibs/bionet-scene`: a lab in three dimensions.
|
|
4
|
+
*
|
|
5
|
+
* The same lab is drawn from four distances — the whole lab, one freezer, one box, one tube — and
|
|
6
|
+
* pressing something moves to the next. It is drawn as edges in the Bionet theme: glowing on black,
|
|
7
|
+
* or plainly on a pale ground.
|
|
8
|
+
*
|
|
9
|
+
* - `view.ts` — what to draw at each distance, as plain data, with nothing drawn
|
|
10
|
+
* - `scene.tsx` — that list, drawn with three.js
|
|
11
|
+
* - `explorer.tsx` — the scene with the way back, a search, and what was picked
|
|
12
|
+
*
|
|
13
|
+
* Import `@biolibs/bionet-theme/theme.css` and `@biolibs/bionet-scene/scene.css` once.
|
|
14
|
+
*/
|
|
15
|
+
export * from "./view.js";
|
|
16
|
+
export * from "./scene.js";
|
|
17
|
+
export * from "./explorer.js";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* `@biolibs/bionet-scene`: a lab in three dimensions.
|
|
4
|
+
*
|
|
5
|
+
* The same lab is drawn from four distances — the whole lab, one freezer, one box, one tube — and
|
|
6
|
+
* pressing something moves to the next. It is drawn as edges in the Bionet theme: glowing on black,
|
|
7
|
+
* or plainly on a pale ground.
|
|
8
|
+
*
|
|
9
|
+
* - `view.ts` — what to draw at each distance, as plain data, with nothing drawn
|
|
10
|
+
* - `scene.tsx` — that list, drawn with three.js
|
|
11
|
+
* - `explorer.tsx` — the scene with the way back, a search, and what was picked
|
|
12
|
+
*
|
|
13
|
+
* Import `@biolibs/bionet-theme/theme.css` and `@biolibs/bionet-scene/scene.css` once.
|
|
14
|
+
*/
|
|
15
|
+
export * from "./view.js";
|
|
16
|
+
export * from "./scene.js";
|
|
17
|
+
export * from "./explorer.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
package/dist/scene.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Color } from "three";
|
|
2
|
+
import { type Meaning, type Theme } from "@biolibs/bionet-theme";
|
|
3
|
+
import type { Focus, SceneView } from "./view.js";
|
|
4
|
+
/** Another lab, drawn beside this one. */
|
|
5
|
+
export interface Neighbour {
|
|
6
|
+
/** Something to tell it apart by, such as its address. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** What it is called. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** A line about it, such as how many parts it offers. */
|
|
11
|
+
note?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The colour and opacity to draw something in.
|
|
15
|
+
*
|
|
16
|
+
* @param tone - What its colour means.
|
|
17
|
+
* @param theme - Which theme is showing.
|
|
18
|
+
* @param strength - How strongly to draw it, from 0 to 1.
|
|
19
|
+
* @returns In the dark theme a colour that may be brighter than white, which is what the bloom
|
|
20
|
+
* picks up; in the light theme the plain colour, made fainter by opacity.
|
|
21
|
+
*/
|
|
22
|
+
export declare function paint(tone: Meaning, theme: Theme, strength: number): {
|
|
23
|
+
color: Color;
|
|
24
|
+
opacity: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Which theme the system is asking for.
|
|
28
|
+
*
|
|
29
|
+
* @returns `dark` or `light`, and again whenever the system changes its mind.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useSystemTheme(): Theme;
|
|
32
|
+
/**
|
|
33
|
+
* A lab, drawn.
|
|
34
|
+
*
|
|
35
|
+
* It holds no state about the lab and decides nothing about it: it is given a view from
|
|
36
|
+
* `sceneView` and reports what was pressed.
|
|
37
|
+
*
|
|
38
|
+
* @param props - `view` is what to draw; `theme` picks the colours; `onFocus` is told which place or
|
|
39
|
+
* tube was pressed; `neighbours` are other labs to draw beside this one, and `onNeighbour` is told
|
|
40
|
+
* when one is pressed.
|
|
41
|
+
*/
|
|
42
|
+
export declare function LabScene({ view, theme, onFocus, neighbours, onNeighbour }: {
|
|
43
|
+
view: SceneView;
|
|
44
|
+
theme: Theme;
|
|
45
|
+
onFocus: (focus: Focus) => void;
|
|
46
|
+
neighbours?: readonly Neighbour[];
|
|
47
|
+
onNeighbour?: (id: string) => void;
|
|
48
|
+
}): import("react").JSX.Element;
|
|
49
|
+
//# sourceMappingURL=scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../src/scene.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAe,KAAK,EACa,MAAM,OAAO,CAAC;AACtD,OAAO,EAAU,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAoC,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEpF,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,0DAA0D;IAC1D,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAOD;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAItG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAUtC;AA4MD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAe,EAAE,WAAW,EAAE,EAAE;IAC/E,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACvI,+BAqDA"}
|
package/dist/scene.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* The scene: a list of things to draw, drawn.
|
|
5
|
+
*
|
|
6
|
+
* Everything worth deciding was decided in `view.ts`. This turns each place into the edges of a
|
|
7
|
+
* box, each tube into a cylinder and each empty position into a ring, in the colours the theme
|
|
8
|
+
* gives for what they mean, and moves the camera to where the view says to stand.
|
|
9
|
+
*
|
|
10
|
+
* In the dark theme the edges are drawn brighter than white and a bloom pass makes them glow. In
|
|
11
|
+
* the light theme the same edges are drawn plainly on a pale ground: a glow needs something dark to
|
|
12
|
+
* glow against.
|
|
13
|
+
*/
|
|
14
|
+
import { Line, OrbitControls } from "@react-three/drei";
|
|
15
|
+
import { Canvas, useFrame, useThree } from "@react-three/fiber";
|
|
16
|
+
import { Bloom, EffectComposer } from "@react-three/postprocessing";
|
|
17
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
18
|
+
import { BoxGeometry, Color, CylinderGeometry, EdgesGeometry, Object3D, QuadraticBezierCurve3, RingGeometry, Vector3 } from "three";
|
|
19
|
+
import { colour } from "@biolibs/bionet-theme";
|
|
20
|
+
const BOX = new BoxGeometry(1, 1, 1);
|
|
21
|
+
const EDGES = new EdgesGeometry(BOX);
|
|
22
|
+
const TUBE = new CylinderGeometry(1, 1, 1, 24);
|
|
23
|
+
const RING = new RingGeometry(0.62, 1, 28).rotateX(-Math.PI / 2);
|
|
24
|
+
/**
|
|
25
|
+
* The colour and opacity to draw something in.
|
|
26
|
+
*
|
|
27
|
+
* @param tone - What its colour means.
|
|
28
|
+
* @param theme - Which theme is showing.
|
|
29
|
+
* @param strength - How strongly to draw it, from 0 to 1.
|
|
30
|
+
* @returns In the dark theme a colour that may be brighter than white, which is what the bloom
|
|
31
|
+
* picks up; in the light theme the plain colour, made fainter by opacity.
|
|
32
|
+
*/
|
|
33
|
+
export function paint(tone, theme, strength) {
|
|
34
|
+
const color = new Color(colour(tone, theme));
|
|
35
|
+
return theme === "dark" ? { color: color.multiplyScalar(0.3 + strength * 2.3), opacity: 1 }
|
|
36
|
+
: { color, opacity: 0.22 + 0.78 * strength };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Which theme the system is asking for.
|
|
40
|
+
*
|
|
41
|
+
* @returns `dark` or `light`, and again whenever the system changes its mind.
|
|
42
|
+
*/
|
|
43
|
+
export function useSystemTheme() {
|
|
44
|
+
const [theme, setTheme] = useState("dark");
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const query = window.matchMedia("(prefers-color-scheme: dark)");
|
|
47
|
+
const read = () => setTheme(query.matches ? "dark" : "light");
|
|
48
|
+
read();
|
|
49
|
+
query.addEventListener("change", read);
|
|
50
|
+
return () => query.removeEventListener("change", read);
|
|
51
|
+
}, []);
|
|
52
|
+
return theme;
|
|
53
|
+
}
|
|
54
|
+
/** How big another lab is drawn, in metres. */
|
|
55
|
+
const NEIGHBOUR_SIZE = [1.8, 1.5, 1.8];
|
|
56
|
+
/**
|
|
57
|
+
* Keeps each label over its point as the camera moves.
|
|
58
|
+
*
|
|
59
|
+
* The labels are ordinary elements beside the canvas, drawn by the same React as everything else.
|
|
60
|
+
* This only moves them: once a frame it works out where each point falls on screen.
|
|
61
|
+
*/
|
|
62
|
+
function Follow({ labels, layer }) {
|
|
63
|
+
const point = useMemo(() => new Vector3(), []);
|
|
64
|
+
useFrame(({ camera, size }) => {
|
|
65
|
+
const elements = layer.current?.children;
|
|
66
|
+
if (elements === undefined)
|
|
67
|
+
return;
|
|
68
|
+
labels.forEach((label, index) => {
|
|
69
|
+
const element = elements[index];
|
|
70
|
+
if (element === undefined)
|
|
71
|
+
return;
|
|
72
|
+
point.set(...label.at).project(camera);
|
|
73
|
+
// Past the far side of the camera a point still projects onto the screen, mirrored.
|
|
74
|
+
const behind = point.z > 1 || point.z < -1;
|
|
75
|
+
element.style.visibility = behind ? "hidden" : "visible";
|
|
76
|
+
element.style.transform = `translate(${((point.x + 1) / 2) * size.width}px, ${((1 - point.y) / 2) * size.height}px) translate(-50%, -50%)`;
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
/** A click that was really the end of a drag is not a click. */
|
|
82
|
+
const dragged = (event) => event.delta > 4;
|
|
83
|
+
/**
|
|
84
|
+
* Whether a press on this was meant for it.
|
|
85
|
+
*
|
|
86
|
+
* A freezer stands inside a room, so a press on the freezer passes through the room's wall first.
|
|
87
|
+
* The press belongs to the smallest thing under the pointer, not the nearest.
|
|
88
|
+
*/
|
|
89
|
+
const meantFor = (event, volume) => !dragged(event) && event.intersections.every((hit) => {
|
|
90
|
+
const other = hit.object.userData.volume;
|
|
91
|
+
return other === undefined || other >= volume;
|
|
92
|
+
});
|
|
93
|
+
function PlaceBox({ place, theme, onPick }) {
|
|
94
|
+
const edge = paint(place.tone, theme, place.strength);
|
|
95
|
+
const face = colour(place.tone, theme);
|
|
96
|
+
const volume = place.size[0] * place.size[1] * place.size[2];
|
|
97
|
+
return (_jsxs("group", { position: place.center, children: [_jsx("lineSegments", { scale: place.size, geometry: EDGES, children: _jsx("lineBasicMaterial", { color: edge.color, transparent: true, opacity: edge.opacity, toneMapped: false }) }), (place.focusable || place.fill > 0) && (_jsx("mesh", { scale: place.size, geometry: BOX, userData: place.focusable ? { volume } : {}, onClick: place.focusable ? (event) => { if (meantFor(event, volume))
|
|
98
|
+
onPick(place.id); } : undefined, onPointerOver: place.focusable ? (event) => { event.stopPropagation(); document.body.style.cursor = "pointer"; } : undefined, onPointerOut: place.focusable ? () => { document.body.style.cursor = ""; } : undefined, children: _jsx("meshBasicMaterial", { color: face, transparent: true, opacity: theme === "dark" ? place.fill : place.fill * 1.6, depthWrite: false, toneMapped: false }) }))] }));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The tubes of a box: a quiet body with a bright rim.
|
|
102
|
+
*
|
|
103
|
+
* A box of solid glowing cylinders reads as one bright slab. Only the rims glow, so each tube stays
|
|
104
|
+
* its own.
|
|
105
|
+
*/
|
|
106
|
+
function Tubes({ tubes, theme, onPick }) {
|
|
107
|
+
const bodies = useRef(null);
|
|
108
|
+
const rims = useRef(null);
|
|
109
|
+
useLayoutEffect(() => {
|
|
110
|
+
const body = bodies.current;
|
|
111
|
+
const rim = rims.current;
|
|
112
|
+
if (body === null || rim === null)
|
|
113
|
+
return;
|
|
114
|
+
const at = new Object3D();
|
|
115
|
+
tubes.forEach((tube, index) => {
|
|
116
|
+
const tone = tube.selected ? "ink" : tube.tone;
|
|
117
|
+
at.position.set(...tube.center);
|
|
118
|
+
at.scale.set(tube.radius, tube.height, tube.radius);
|
|
119
|
+
at.updateMatrix();
|
|
120
|
+
body.setMatrixAt(index, at.matrix);
|
|
121
|
+
body.setColorAt(index, theme === "dark" ? new Color(colour(tone, theme)).multiplyScalar(tube.selected ? 0.8 : 0.34) : new Color(colour(tone, theme)));
|
|
122
|
+
at.position.set(tube.center[0], tube.center[1] + tube.height / 2 + 0.0004, tube.center[2]);
|
|
123
|
+
at.scale.set(tube.radius, 1, tube.radius);
|
|
124
|
+
at.updateMatrix();
|
|
125
|
+
rim.setMatrixAt(index, at.matrix);
|
|
126
|
+
rim.setColorAt(index, theme === "dark" ? paint(tone, theme, tube.selected ? 1 : 0.6).color : new Color(colour("surface", theme)));
|
|
127
|
+
});
|
|
128
|
+
for (const mesh of [body, rim]) {
|
|
129
|
+
mesh.instanceMatrix.needsUpdate = true;
|
|
130
|
+
if (mesh.instanceColor !== null)
|
|
131
|
+
mesh.instanceColor.needsUpdate = true;
|
|
132
|
+
mesh.computeBoundingSphere();
|
|
133
|
+
}
|
|
134
|
+
}, [tubes, theme]);
|
|
135
|
+
if (tubes.length === 0)
|
|
136
|
+
return null;
|
|
137
|
+
return (_jsxs(_Fragment, { children: [_jsx("instancedMesh", { ref: bodies, args: [TUBE, undefined, tubes.length], userData: { volume: 0 }, onClick: (event) => { if (dragged(event) || event.instanceId === undefined)
|
|
138
|
+
return; event.stopPropagation(); onPick(tubes[event.instanceId]); }, onPointerOver: () => { document.body.style.cursor = "pointer"; }, onPointerOut: () => { document.body.style.cursor = ""; }, children: _jsx("meshBasicMaterial", { toneMapped: false }) }, `body-${tubes.length}`), _jsx("instancedMesh", { ref: rims, args: [RING, undefined, tubes.length], children: _jsx("meshBasicMaterial", { toneMapped: false }) }, `rim-${tubes.length}`)] }));
|
|
139
|
+
}
|
|
140
|
+
function EmptySlots({ slots, theme }) {
|
|
141
|
+
const mesh = useRef(null);
|
|
142
|
+
useLayoutEffect(() => {
|
|
143
|
+
const instanced = mesh.current;
|
|
144
|
+
if (instanced === null)
|
|
145
|
+
return;
|
|
146
|
+
const at = new Object3D();
|
|
147
|
+
slots.forEach((slot, index) => {
|
|
148
|
+
at.position.set(slot.center[0], slot.center[1] + 0.0005, slot.center[2]);
|
|
149
|
+
at.scale.set(slot.radius, 1, slot.radius);
|
|
150
|
+
at.updateMatrix();
|
|
151
|
+
instanced.setMatrixAt(index, at.matrix);
|
|
152
|
+
});
|
|
153
|
+
instanced.instanceMatrix.needsUpdate = true;
|
|
154
|
+
instanced.computeBoundingSphere();
|
|
155
|
+
}, [slots]);
|
|
156
|
+
if (slots.length === 0)
|
|
157
|
+
return null;
|
|
158
|
+
const ring = paint("dim", theme, 0.35);
|
|
159
|
+
return (_jsx("instancedMesh", { ref: mesh, args: [RING, undefined, slots.length], children: _jsx("meshBasicMaterial", { color: ring.color, transparent: true, opacity: theme === "dark" ? 0.7 : 0.5, toneMapped: false }) }, slots.length));
|
|
160
|
+
}
|
|
161
|
+
/** Another lab: a quiet outline beside this one, and a line to it that something travels along. */
|
|
162
|
+
function NeighbourLab({ neighbour, from, to, theme, onPick }) {
|
|
163
|
+
const pulse = useRef(null);
|
|
164
|
+
const curve = useMemo(() => new QuadraticBezierCurve3(new Vector3(...from), new Vector3((from[0] + to[0]) / 2, from[1] + 1.6, (from[2] + to[2]) / 2), new Vector3(...to)), [from, to]);
|
|
165
|
+
const points = useMemo(() => curve.getPoints(40), [curve]);
|
|
166
|
+
useFrame(({ clock }) => { pulse.current?.position.copy(curve.getPoint((clock.elapsedTime * 0.22) % 1)); });
|
|
167
|
+
const edge = paint("theirs", theme, 0.7);
|
|
168
|
+
const size = NEIGHBOUR_SIZE;
|
|
169
|
+
return (_jsxs(_Fragment, { children: [_jsxs("group", { position: [to[0] + size[0] / 2, size[1] / 2, to[2]], children: [_jsx("lineSegments", { scale: size, geometry: EDGES, children: _jsx("lineBasicMaterial", { color: edge.color, transparent: true, opacity: edge.opacity, toneMapped: false }) }), _jsx("mesh", { scale: size, geometry: BOX, onClick: onPick === undefined ? undefined : (event) => { if (dragged(event))
|
|
170
|
+
return; event.stopPropagation(); onPick(neighbour.id); }, children: _jsx("meshBasicMaterial", { color: colour("theirs", theme), transparent: true, opacity: 0.03, depthWrite: false, toneMapped: false }) })] }), _jsx(Line, { points: points, color: paint("theirs", theme, 0.5).color, lineWidth: 1.2, transparent: true, opacity: theme === "dark" ? 0.9 : 0.6, toneMapped: false }), _jsxs("mesh", { ref: pulse, children: [_jsx("sphereGeometry", { args: [0.07, 16, 16] }), _jsx("meshBasicMaterial", { color: paint("yours", theme, 1).color, toneMapped: false })] })] }));
|
|
171
|
+
}
|
|
172
|
+
/** Moves the camera to where the view says to stand, then leaves it to the person. */
|
|
173
|
+
function Rig({ view }) {
|
|
174
|
+
const camera = useThree((state) => state.camera);
|
|
175
|
+
const controls = useThree((state) => state.controls);
|
|
176
|
+
const left = useRef(0);
|
|
177
|
+
const first = useRef(true);
|
|
178
|
+
const position = useMemo(() => new Vector3(...view.pose.position), [view.pose]);
|
|
179
|
+
const target = useMemo(() => new Vector3(...view.pose.target), [view.pose]);
|
|
180
|
+
useEffect(() => { left.current = 1.6; }, [position, target]);
|
|
181
|
+
useFrame((_, delta) => {
|
|
182
|
+
if (controls === null || left.current <= 0)
|
|
183
|
+
return;
|
|
184
|
+
if (first.current) {
|
|
185
|
+
// The first look is not a journey: start where the view says to stand.
|
|
186
|
+
first.current = false;
|
|
187
|
+
camera.position.copy(position);
|
|
188
|
+
controls.target.copy(target);
|
|
189
|
+
left.current = 0;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
left.current -= delta;
|
|
193
|
+
const step = 1 - Math.exp(-delta * 5.5);
|
|
194
|
+
camera.position.lerp(position, step);
|
|
195
|
+
controls.target.lerp(target, step);
|
|
196
|
+
}
|
|
197
|
+
controls.update();
|
|
198
|
+
});
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A lab, drawn.
|
|
203
|
+
*
|
|
204
|
+
* It holds no state about the lab and decides nothing about it: it is given a view from
|
|
205
|
+
* `sceneView` and reports what was pressed.
|
|
206
|
+
*
|
|
207
|
+
* @param props - `view` is what to draw; `theme` picks the colours; `onFocus` is told which place or
|
|
208
|
+
* tube was pressed; `neighbours` are other labs to draw beside this one, and `onNeighbour` is told
|
|
209
|
+
* when one is pressed.
|
|
210
|
+
*/
|
|
211
|
+
export function LabScene({ view, theme, onFocus, neighbours = [], onNeighbour }) {
|
|
212
|
+
const rooms = view.places.filter((place) => place.kind === "room");
|
|
213
|
+
const right = Math.max(0, ...rooms.map((room) => room.center[0] + room.size[0] / 2));
|
|
214
|
+
const middle = rooms.length === 0 ? 0 : rooms.reduce((sum, room) => sum + room.center[2], 0) / rooms.length;
|
|
215
|
+
const rule = paint("rule", theme, 0.5);
|
|
216
|
+
const beside = neighbours.map((neighbour, index) => ({
|
|
217
|
+
neighbour,
|
|
218
|
+
from: [right, 1.2, middle + index * 0.4],
|
|
219
|
+
to: [right + 1.2, 0.8, middle + (index - (neighbours.length - 1) / 2) * 2.6],
|
|
220
|
+
}));
|
|
221
|
+
const picked = view.tubes.find((tube) => tube.selected);
|
|
222
|
+
const labels = [
|
|
223
|
+
...view.places.filter((place) => place.labelled).map((place) => ({
|
|
224
|
+
key: place.id, at: [place.center[0], place.center[1] + place.size[1] / 2, place.center[2]],
|
|
225
|
+
content: _jsx("span", { className: `tag tone-${place.tone}`, children: place.name }),
|
|
226
|
+
})),
|
|
227
|
+
...beside.map(({ neighbour, to }) => ({
|
|
228
|
+
key: `lab ${neighbour.id}`, at: [to[0] + NEIGHBOUR_SIZE[0] / 2, NEIGHBOUR_SIZE[1], to[2]],
|
|
229
|
+
content: _jsxs("span", { className: "tag tone-theirs", children: [neighbour.name, neighbour.note !== undefined && _jsx("small", { children: neighbour.note })] }),
|
|
230
|
+
})),
|
|
231
|
+
...(picked === undefined ? [] : [{
|
|
232
|
+
key: `tube ${picked.item}`, at: [picked.center[0], picked.center[1] + picked.height, picked.center[2]],
|
|
233
|
+
content: _jsxs("span", { className: "tag tone-ink raised", children: [picked.name, " \u00B7 ", picked.position] }),
|
|
234
|
+
}]),
|
|
235
|
+
];
|
|
236
|
+
const layer = useRef(null);
|
|
237
|
+
return (_jsxs("div", { className: "stage", children: [_jsxs(Canvas, { camera: { fov: 45, near: 0.01, far: 400, position: view.pose.position }, dpr: [1, 2], gl: { antialias: true }, children: [_jsx("color", { attach: "background", args: [colour("ground", theme)] }), _jsx("gridHelper", { args: [60, 60, rule.color, rule.color], position: [0, -0.002, 0], children: _jsx("lineBasicMaterial", { attach: "material", color: rule.color, transparent: true, opacity: theme === "dark" ? 0.5 : 0.7, toneMapped: false }) }), view.places.map((place) => _jsx(PlaceBox, { place: place, theme: theme, onPick: (id) => onFocus({ place: id }) }, place.id)), _jsx(EmptySlots, { slots: view.empty, theme: theme }), _jsx(Tubes, { tubes: view.tubes, theme: theme, onPick: (tube) => onFocus({ place: tube.place, item: tube.item }) }), beside.map(({ neighbour, from, to }) => (_jsx(NeighbourLab, { neighbour: neighbour, theme: theme, onPick: onNeighbour, from: from, to: to }, neighbour.id))), _jsx(Follow, { labels: labels, layer: layer }), _jsx(OrbitControls, { makeDefault: true, enableDamping: true, dampingFactor: 0.12, maxPolarAngle: Math.PI / 2 - 0.03, minDistance: 0.08, maxDistance: 60 }), _jsx(Rig, { view: view }), theme === "dark" && (_jsx(EffectComposer, { children: _jsx(Bloom, { mipmapBlur: true, intensity: 0.85, luminanceThreshold: 0.55, luminanceSmoothing: 0.3 }) }))] }), _jsx("div", { className: "pins", ref: layer, children: labels.map((label) => _jsx("div", { className: "pin", children: label.content }, label.key)) })] }));
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=scene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../src/scene.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE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