@johnoscott/isometric-engine 0.0.0-stage → 0.10.1
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/EDITOR-GUIDE.md +355 -0
- package/LICENSE +21 -0
- package/LICENSES/ajv.txt +22 -0
- package/LICENSES/lucide-static.txt +43 -0
- package/LICENSES/yaml.txt +13 -0
- package/README.md +62 -2
- package/assets/app.css +269 -0
- package/assets/default-theme.yaml +99 -0
- package/assets/icons.svg +1 -0
- package/assets/marks.css +39 -0
- package/assets/skin.css +181 -0
- package/iso-editor.d.ts +4 -0
- package/iso-editor.js +550 -0
- package/iso-render.d.ts +3 -0
- package/iso-render.js +388 -0
- package/iso-systems.d.ts +4 -0
- package/iso-systems.js +389 -0
- package/js/iso-core/compile-schema.js +22 -0
- package/js/iso-core/depth.js +55 -0
- package/js/iso-core/errors.js +65 -0
- package/js/iso-core/glyphs.js +100 -0
- package/js/iso-core/index.js +55 -0
- package/js/iso-core/kernel.js +158 -0
- package/js/iso-core/metrics.json +1 -0
- package/js/iso-core/package.json +6 -0
- package/js/iso-core/parse.js +79 -0
- package/js/iso-core/schema-errors.js +170 -0
- package/js/iso-core/shims/crypto.js +125 -0
- package/js/iso-core/shims/path.js +49 -0
- package/js/iso-core/svg-dom.js +144 -0
- package/js/iso-core/theme.js +48 -0
- package/js/iso-core/vdom.js +48 -0
- package/js/iso-editor/adapter.js +0 -0
- package/js/iso-editor/clipboard.js +152 -0
- package/js/iso-editor/commands.js +173 -0
- package/js/iso-editor/complete.js +55 -0
- package/js/iso-editor/doc.js +182 -0
- package/js/iso-editor/index.js +105 -0
- package/js/iso-editor/model.js +210 -0
- package/js/iso-editor/outline.js +111 -0
- package/js/iso-editor/package.json +6 -0
- package/js/iso-editor/path.js +19 -0
- package/js/iso-editor/providers.js +96 -0
- package/js/iso-editor/schema-nav.js +117 -0
- package/js/iso-editor/splice.js +443 -0
- package/js/iso-editor/storage-keys.js +6 -0
- package/js/iso-editor/ui/actions.js +116 -0
- package/js/iso-editor/ui/canvas-layer.js +0 -0
- package/js/iso-editor/ui/canvas.js +1403 -0
- package/js/iso-editor/ui/clip.js +133 -0
- package/js/iso-editor/ui/dialog.js +26 -0
- package/js/iso-editor/ui/flat-canvas.js +54 -0
- package/js/iso-editor/ui/icons.js +15 -0
- package/js/iso-editor/ui/keys.js +26 -0
- package/js/iso-editor/ui/later.js +28 -0
- package/js/iso-editor/ui/layer.js +11 -0
- package/js/iso-editor/ui/menu.js +105 -0
- package/js/iso-editor/ui/monaco-entry.js +2 -0
- package/js/iso-editor/ui/mount-kit.js +0 -0
- package/js/iso-editor/ui/mount.js +767 -0
- package/js/iso-editor/ui/pane.js +0 -0
- package/js/iso-editor/ui/part.js +0 -0
- package/js/iso-editor/ui/plain-icons.js +34 -0
- package/js/iso-editor/ui/props.js +314 -0
- package/js/iso-editor/ui/scope-css.js +81 -0
- package/js/iso-editor/ui/setup.js +149 -0
- package/js/iso-editor/ui/text.js +323 -0
- package/js/iso-editor/ui/tree.js +728 -0
- package/js/iso-editor/validate.js +33 -0
- package/js/iso-editor/window/protocol.js +8 -0
- package/js/iso-objects/assemble.js +43 -0
- package/js/iso-objects/assets.js +88 -0
- package/js/iso-objects/board.js +162 -0
- package/js/iso-objects/compile.js +60 -0
- package/js/iso-objects/css.js +154 -0
- package/js/iso-objects/flat.js +696 -0
- package/js/iso-objects/focus.js +16 -0
- package/js/iso-objects/geometry.js +76 -0
- package/js/iso-objects/index.js +93 -0
- package/js/iso-objects/kinds.js +12 -0
- package/js/iso-objects/labels.js +325 -0
- package/js/iso-objects/package.json +6 -0
- package/js/iso-objects/place.js +347 -0
- package/js/iso-objects/route.js +461 -0
- package/js/iso-objects/scene.js +350 -0
- package/js/iso-objects/steps.js +246 -0
- package/js/iso-objects/types.js +0 -0
- package/js/iso-systems/catalog.js +42 -0
- package/js/iso-systems/compile.js +34 -0
- package/js/iso-systems/css.js +8 -0
- package/js/iso-systems/index.js +16 -0
- package/js/iso-systems/nodes.js +124 -0
- package/js/iso-systems/package.json +6 -0
- package/js/iso-systems/schema.json +311 -0
- package/js/iso-systems/validate.js +35 -0
- package/js/iso-viewer/bundle.js +20 -0
- package/js/iso-viewer/card-motion.js +228 -0
- package/js/iso-viewer/dom.js +14 -0
- package/js/iso-viewer/dual-view.js +212 -0
- package/js/iso-viewer/flat-view.js +124 -0
- package/js/iso-viewer/history.js +990 -0
- package/js/iso-viewer/index.js +98 -0
- package/js/iso-viewer/morph.js +192 -0
- package/js/iso-viewer/overlay.js +199 -0
- package/js/iso-viewer/package.json +6 -0
- package/js/iso-viewer/page.js +138 -0
- package/js/iso-viewer/player.js +409 -0
- package/js/iso-viewer/still.js +81 -0
- package/js/iso-viewer/timeline-contract.js +14 -0
- package/js/iso-viewer/timeline-engine.js +475 -0
- package/js/iso-viewer/timeline-export.js +36 -0
- package/js/iso-viewer/timeline-scale.js +116 -0
- package/js/iso-viewer/timeline-scope.js +58 -0
- package/js/iso-viewer/timeline-search.js +216 -0
- package/js/iso-viewer/timeline-time.js +55 -0
- package/js/iso-viewer/view-css.js +68 -0
- package/js/iso-viewer/viewport.js +177 -0
- package/package.json +511 -4
- package/src/iso-core/compile-schema.ts +23 -0
- package/src/iso-core/depth.ts +56 -0
- package/src/iso-core/errors.ts +73 -0
- package/src/iso-core/glyphs.ts +108 -0
- package/src/iso-core/index.ts +27 -0
- package/src/iso-core/kernel.ts +163 -0
- package/src/iso-core/metrics.json +1 -0
- package/src/iso-core/package.json +6 -0
- package/src/iso-core/parse.ts +91 -0
- package/src/iso-core/schema-errors.ts +163 -0
- package/src/iso-core/shims/crypto.ts +37 -0
- package/src/iso-core/shims/path.ts +24 -0
- package/src/iso-core/svg-dom.ts +103 -0
- package/src/iso-core/theme.ts +64 -0
- package/src/iso-core/vdom.ts +41 -0
- package/src/iso-editor/adapter.ts +147 -0
- package/src/iso-editor/clipboard.ts +163 -0
- package/src/iso-editor/commands.ts +191 -0
- package/src/iso-editor/complete.ts +73 -0
- package/src/iso-editor/doc.ts +207 -0
- package/src/iso-editor/index.ts +67 -0
- package/src/iso-editor/model.ts +234 -0
- package/src/iso-editor/outline.ts +126 -0
- package/src/iso-editor/package.json +6 -0
- package/src/iso-editor/path.ts +18 -0
- package/src/iso-editor/providers.ts +113 -0
- package/src/iso-editor/schema-nav.ts +129 -0
- package/src/iso-editor/splice.ts +477 -0
- package/src/iso-editor/storage-keys.ts +6 -0
- package/src/iso-editor/ui/actions.ts +119 -0
- package/src/iso-editor/ui/app.css +230 -0
- package/src/iso-editor/ui/canvas-layer.ts +56 -0
- package/src/iso-editor/ui/canvas.ts +1227 -0
- package/src/iso-editor/ui/clip.ts +97 -0
- package/src/iso-editor/ui/dialog.ts +25 -0
- package/src/iso-editor/ui/flat-canvas.ts +51 -0
- package/src/iso-editor/ui/icons.ts +21 -0
- package/src/iso-editor/ui/keys.ts +30 -0
- package/src/iso-editor/ui/later.ts +22 -0
- package/src/iso-editor/ui/layer.ts +7 -0
- package/src/iso-editor/ui/marks.css +39 -0
- package/src/iso-editor/ui/menu.ts +67 -0
- package/src/iso-editor/ui/monaco-entry.ts +6 -0
- package/src/iso-editor/ui/mount-kit.ts +35 -0
- package/src/iso-editor/ui/mount.ts +684 -0
- package/src/iso-editor/ui/pane.ts +45 -0
- package/src/iso-editor/ui/part.ts +45 -0
- package/src/iso-editor/ui/plain-icons.ts +83 -0
- package/src/iso-editor/ui/props.ts +347 -0
- package/src/iso-editor/ui/scope-css.ts +65 -0
- package/src/iso-editor/ui/setup.ts +153 -0
- package/src/iso-editor/ui/skin.css +181 -0
- package/src/iso-editor/ui/text.ts +262 -0
- package/src/iso-editor/ui/tree.ts +657 -0
- package/src/iso-editor/validate.ts +62 -0
- package/src/iso-editor/window/protocol.ts +33 -0
- package/src/iso-objects/assemble.ts +57 -0
- package/src/iso-objects/assets.ts +122 -0
- package/src/iso-objects/board.ts +169 -0
- package/src/iso-objects/compile.ts +76 -0
- package/src/iso-objects/css.ts +163 -0
- package/src/iso-objects/flat.ts +653 -0
- package/src/iso-objects/focus.ts +14 -0
- package/src/iso-objects/geometry.ts +86 -0
- package/src/iso-objects/index.ts +33 -0
- package/src/iso-objects/kinds.ts +56 -0
- package/src/iso-objects/labels.ts +310 -0
- package/src/iso-objects/package.json +6 -0
- package/src/iso-objects/place.ts +318 -0
- package/src/iso-objects/route.ts +444 -0
- package/src/iso-objects/scene.ts +376 -0
- package/src/iso-objects/steps.ts +234 -0
- package/src/iso-objects/types.ts +68 -0
- package/src/iso-systems/catalog.ts +31 -0
- package/src/iso-systems/compile.ts +39 -0
- package/src/iso-systems/css.ts +9 -0
- package/src/iso-systems/index.ts +12 -0
- package/src/iso-systems/nodes.ts +126 -0
- package/src/iso-systems/package.json +6 -0
- package/src/iso-systems/schema.json +311 -0
- package/src/iso-systems/validate.ts +34 -0
- package/src/iso-viewer/bundle.ts +15 -0
- package/src/iso-viewer/card-motion.ts +237 -0
- package/src/iso-viewer/dom.ts +13 -0
- package/src/iso-viewer/dual-view.ts +212 -0
- package/src/iso-viewer/flat-view.ts +127 -0
- package/src/iso-viewer/history.ts +781 -0
- package/src/iso-viewer/index.ts +40 -0
- package/src/iso-viewer/morph.ts +191 -0
- package/src/iso-viewer/overlay.ts +212 -0
- package/src/iso-viewer/package.json +6 -0
- package/src/iso-viewer/page.ts +150 -0
- package/src/iso-viewer/player.ts +321 -0
- package/src/iso-viewer/still.ts +74 -0
- package/src/iso-viewer/timeline-contract.ts +342 -0
- package/src/iso-viewer/timeline-engine.ts +420 -0
- package/src/iso-viewer/timeline-export.ts +31 -0
- package/src/iso-viewer/timeline-scale.ts +129 -0
- package/src/iso-viewer/timeline-scope.ts +56 -0
- package/src/iso-viewer/timeline-search.ts +198 -0
- package/src/iso-viewer/timeline-time.ts +54 -0
- package/src/iso-viewer/view-css.ts +59 -0
- package/src/iso-viewer/viewport.ts +142 -0
- package/types/iso-core/compile-schema.d.ts +11 -0
- package/types/iso-core/depth.d.ts +6 -0
- package/types/iso-core/errors.d.ts +24 -0
- package/types/iso-core/glyphs.d.ts +19 -0
- package/types/iso-core/index.d.ts +17 -0
- package/types/iso-core/kernel.d.ts +130 -0
- package/types/iso-core/metrics.json +1 -0
- package/types/iso-core/parse.d.ts +18 -0
- package/types/iso-core/schema-errors.d.ts +14 -0
- package/types/iso-core/shims/crypto.d.ts +9 -0
- package/types/iso-core/svg-dom.d.ts +15 -0
- package/types/iso-core/theme.d.ts +38 -0
- package/types/iso-core/vdom.d.ts +26 -0
- package/types/iso-editor/adapter.d.ts +178 -0
- package/types/iso-editor/clipboard.d.ts +23 -0
- package/types/iso-editor/commands.d.ts +32 -0
- package/types/iso-editor/complete.d.ts +25 -0
- package/types/iso-editor/doc.d.ts +50 -0
- package/types/iso-editor/index.d.ts +57 -0
- package/types/iso-editor/model.d.ts +96 -0
- package/types/iso-editor/outline.d.ts +28 -0
- package/types/iso-editor/path.d.ts +7 -0
- package/types/iso-editor/providers.d.ts +43 -0
- package/types/iso-editor/schema-nav.d.ts +34 -0
- package/types/iso-editor/splice.d.ts +53 -0
- package/types/iso-editor/storage-keys.d.ts +5 -0
- package/types/iso-editor/ui/actions.d.ts +23 -0
- package/types/iso-editor/ui/canvas-layer.d.ts +65 -0
- package/types/iso-editor/ui/canvas.d.ts +307 -0
- package/types/iso-editor/ui/clip.d.ts +14 -0
- package/types/iso-editor/ui/dialog.d.ts +7 -0
- package/types/iso-editor/ui/flat-canvas.d.ts +2 -0
- package/types/iso-editor/ui/icons.d.ts +5 -0
- package/types/iso-editor/ui/keys.d.ts +7 -0
- package/types/iso-editor/ui/later.d.ts +12 -0
- package/types/iso-editor/ui/layer.d.ts +2 -0
- package/types/iso-editor/ui/menu.d.ts +21 -0
- package/types/iso-editor/ui/mount-kit.d.ts +31 -0
- package/types/iso-editor/ui/mount.d.ts +146 -0
- package/types/iso-editor/ui/pane.d.ts +60 -0
- package/types/iso-editor/ui/part.d.ts +40 -0
- package/types/iso-editor/ui/plain-icons.d.ts +10 -0
- package/types/iso-editor/ui/props.d.ts +57 -0
- package/types/iso-editor/ui/scope-css.d.ts +5 -0
- package/types/iso-editor/ui/setup.d.ts +49 -0
- package/types/iso-editor/ui/text.d.ts +19 -0
- package/types/iso-editor/ui/tree.d.ts +100 -0
- package/types/iso-editor/validate.d.ts +36 -0
- package/types/iso-editor/window/protocol.d.ts +60 -0
- package/types/iso-objects/assemble.d.ts +35 -0
- package/types/iso-objects/assets.d.ts +49 -0
- package/types/iso-objects/board.d.ts +36 -0
- package/types/iso-objects/compile.d.ts +35 -0
- package/types/iso-objects/css.d.ts +16 -0
- package/types/iso-objects/flat.d.ts +130 -0
- package/types/iso-objects/focus.d.ts +1 -0
- package/types/iso-objects/geometry.d.ts +59 -0
- package/types/iso-objects/index.d.ts +26 -0
- package/types/iso-objects/kinds.d.ts +53 -0
- package/types/iso-objects/labels.d.ts +92 -0
- package/types/iso-objects/place.d.ts +25 -0
- package/types/iso-objects/route.d.ts +67 -0
- package/types/iso-objects/scene.d.ts +63 -0
- package/types/iso-objects/steps.d.ts +90 -0
- package/types/iso-objects/types.d.ts +140 -0
- package/types/iso-systems/catalog.d.ts +4 -0
- package/types/iso-systems/compile.d.ts +6 -0
- package/types/iso-systems/css.d.ts +3 -0
- package/types/iso-systems/index.d.ts +5 -0
- package/types/iso-systems/nodes.d.ts +3 -0
- package/types/iso-viewer/card-motion.d.ts +56 -0
- package/types/iso-viewer/dom.d.ts +1 -0
- package/types/iso-viewer/dual-view.d.ts +44 -0
- package/types/iso-viewer/flat-view.d.ts +25 -0
- package/types/iso-viewer/history.d.ts +91 -0
- package/types/iso-viewer/index.d.ts +31 -0
- package/types/iso-viewer/morph.d.ts +28 -0
- package/types/iso-viewer/overlay.d.ts +135 -0
- package/types/iso-viewer/page.d.ts +13 -0
- package/types/iso-viewer/still.d.ts +26 -0
- package/types/iso-viewer/timeline-contract.d.ts +345 -0
- package/types/iso-viewer/timeline-engine.d.ts +20 -0
- package/types/iso-viewer/timeline-export.d.ts +5 -0
- package/types/iso-viewer/timeline-scale.d.ts +44 -0
- package/types/iso-viewer/timeline-scope.d.ts +33 -0
- package/types/iso-viewer/timeline-search.d.ts +52 -0
- package/types/iso-viewer/timeline-time.d.ts +8 -0
- package/types/iso-viewer/view-css.d.ts +7 -0
- package/types/iso-viewer/viewport.d.ts +50 -0
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import { didYouMean } from "../iso-core/errors.js";
|
|
2
|
+
import { WALL_T } from "./place.js";
|
|
3
|
+
import { regionKind } from "./kinds.js";
|
|
4
|
+
const GRID = 0.2;
|
|
5
|
+
const OUT = 0.05;
|
|
6
|
+
const LANE = 0.6;
|
|
7
|
+
const INFLATE = 0.25;
|
|
8
|
+
const sideNormal = { n: [0, -1], s: [0, 1], e: [1, 0], w: [-1, 0] };
|
|
9
|
+
function parseEnd(s) {
|
|
10
|
+
const m = /^(.*?)(?:\.(n|e|s|w|top))?$/.exec(s);
|
|
11
|
+
return { id: m[1], side: m[2] };
|
|
12
|
+
}
|
|
13
|
+
const floors = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
function floorAt(layout, x, y) {
|
|
15
|
+
let fs = floors.get(layout);
|
|
16
|
+
if (!fs) {
|
|
17
|
+
fs = [];
|
|
18
|
+
for (const r of layout.items) {
|
|
19
|
+
if (r.type !== "region") continue;
|
|
20
|
+
if (!regionKind(layout.catalog, r.region.kind)?.floor) continue;
|
|
21
|
+
let d = 0;
|
|
22
|
+
for (let a = r.parent; a; a = a.parent) d++;
|
|
23
|
+
fs.push({ r, d });
|
|
24
|
+
}
|
|
25
|
+
floors.set(layout, fs);
|
|
26
|
+
}
|
|
27
|
+
let best = 0, depth = -1;
|
|
28
|
+
for (const { r, d } of fs) {
|
|
29
|
+
const b = r.box, e = 1e-6;
|
|
30
|
+
if (x >= b.x0 - e && x <= b.x1 + e && y >= b.y0 - e && y <= b.y1 + e && d > depth) {
|
|
31
|
+
depth = d;
|
|
32
|
+
best = r.floor;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return best;
|
|
36
|
+
}
|
|
37
|
+
function autoSide(a, b) {
|
|
38
|
+
const ac = [(a.x0 + a.x1) / 2, (a.y0 + a.y1) / 2], bc = [(b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2];
|
|
39
|
+
const dx = bc[0] - ac[0], dy = bc[1] - ac[1];
|
|
40
|
+
const gapX = Math.max(b.x0 - a.x1, a.x0 - b.x1), gapY = Math.max(b.y0 - a.y1, a.y0 - b.y1);
|
|
41
|
+
if (gapX > 0 && (gapY <= 0 || gapX >= gapY)) return dx > 0 ? "e" : "w";
|
|
42
|
+
if (gapY > 0) return dy > 0 ? "s" : "n";
|
|
43
|
+
return Math.abs(dx) >= Math.abs(dy) ? dx > 0 ? "e" : "w" : dy > 0 ? "s" : "n";
|
|
44
|
+
}
|
|
45
|
+
const ROUTE_BUDGET = 5e5;
|
|
46
|
+
function routeAll(scene, scenePath, layout, src, kinds, snap) {
|
|
47
|
+
const diags = [];
|
|
48
|
+
const err = (path, message, hint, severity = "error") => {
|
|
49
|
+
const p = src.locate(path);
|
|
50
|
+
diags.push({ severity, message, line: p.line, col: p.col, path, hint });
|
|
51
|
+
};
|
|
52
|
+
const raws = scene.routes ?? [];
|
|
53
|
+
const budget = { left: ROUTE_BUDGET };
|
|
54
|
+
let overBudget = 0;
|
|
55
|
+
const nodeIds = () => layout.items.map((i) => i.id);
|
|
56
|
+
const seen = /* @__PURE__ */ new Map();
|
|
57
|
+
const routes = [];
|
|
58
|
+
const ends = [];
|
|
59
|
+
raws.forEach((raw, i) => {
|
|
60
|
+
const path = `${scenePath}/routes/${i}`;
|
|
61
|
+
if (seen.has(raw.id) || layout.byId.has(raw.id)) err(path + "/id", `duplicate id "${raw.id}"`);
|
|
62
|
+
seen.set(raw.id, i);
|
|
63
|
+
const kind = raw.kind ?? "send";
|
|
64
|
+
if (!kinds.has(kind)) err(path + "/kind", `unknown flow kind "${kind}"` + dym(kind, kinds), `kinds: ${[...kinds].join(", ")}; add one under "kinds:"`);
|
|
65
|
+
const r = { id: raw.id, raw, path, kind, points: [] };
|
|
66
|
+
const get = (s, key2) => {
|
|
67
|
+
const { id } = parseEnd(s);
|
|
68
|
+
const p = layout.byId.get(id);
|
|
69
|
+
if (!p) {
|
|
70
|
+
err(`${path}/${key2}`, `unknown node "${id}"` + dym(id, nodeIds()));
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
return p;
|
|
74
|
+
};
|
|
75
|
+
r.from = get(raw.from, "from");
|
|
76
|
+
r.to = get(raw.to, "to");
|
|
77
|
+
routes.push(r);
|
|
78
|
+
ends.push({ r });
|
|
79
|
+
});
|
|
80
|
+
const slots = /* @__PURE__ */ new Map();
|
|
81
|
+
for (const it of ends) {
|
|
82
|
+
const { r } = it;
|
|
83
|
+
if (!r.from || !r.to || r.raw.points) continue;
|
|
84
|
+
const fs = parseEnd(r.raw.from).side, ts = parseEnd(r.raw.to).side;
|
|
85
|
+
const first = r.raw.via?.[0], last = r.raw.via?.[r.raw.via.length - 1];
|
|
86
|
+
const toward = (v, fallback) => {
|
|
87
|
+
if (Array.isArray(v)) return { x0: v[0], x1: v[0], y0: v[1], y1: v[1], z0: 0, z1: 0 };
|
|
88
|
+
if (typeof v === "string") {
|
|
89
|
+
const p = layout.byId.get(parseEnd(v).id);
|
|
90
|
+
if (p) return p.box;
|
|
91
|
+
}
|
|
92
|
+
return fallback.box;
|
|
93
|
+
};
|
|
94
|
+
const mk = (n, s, other) => {
|
|
95
|
+
const side = s ?? autoSide(n.box, other);
|
|
96
|
+
return { node: n, side, explicit: !!s, p: [0, 0], z: 0 };
|
|
97
|
+
};
|
|
98
|
+
it.a = mk(r.from, fs, toward(first, r.to));
|
|
99
|
+
it.b = mk(r.to, ts, toward(last, r.from));
|
|
100
|
+
const ob = toward(first, r.to), oa = toward(last, r.from);
|
|
101
|
+
for (const [e, o] of [[it.a, ob], [it.b, oa]]) {
|
|
102
|
+
const key2 = `${e.node.id}.${e.side}`;
|
|
103
|
+
if (!slots.has(key2)) slots.set(key2, []);
|
|
104
|
+
slots.get(key2).push({ e, other: [(o.x0 + o.x1) / 2, (o.y0 + o.y1) / 2] });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const [, list] of slots) {
|
|
108
|
+
const e0 = list[0].e, b = e0.node.box, side = e0.side;
|
|
109
|
+
const along = side === "e" || side === "w" ? 1 : 0;
|
|
110
|
+
list.sort((p, q) => p.other[along] - q.other[along]);
|
|
111
|
+
const lo = along ? b.y0 : b.x0, hi = along ? b.y1 : b.x1, mid = (lo + hi) / 2;
|
|
112
|
+
const span = Math.max(0, hi - lo - 0.3), step = list.length > 1 ? Math.min(LANE, span / (list.length - 1)) : 0;
|
|
113
|
+
list.forEach((s, i) => {
|
|
114
|
+
const off = (i - (list.length - 1) / 2) * step;
|
|
115
|
+
const c = mid + off;
|
|
116
|
+
const z = s.e.node.box.z0;
|
|
117
|
+
if (side === "top") {
|
|
118
|
+
s.e.p = [(b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2];
|
|
119
|
+
s.e.z = b.z1;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const [nx, ny] = sideNormal[side];
|
|
123
|
+
s.e.p = along ? [nx > 0 ? b.x1 + OUT : b.x0 - OUT, c] : [c, ny > 0 ? b.y1 + OUT : b.y0 - OUT];
|
|
124
|
+
s.e.z = z;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const obstacles = [];
|
|
128
|
+
for (const p of layout.items) {
|
|
129
|
+
if (p.type === "node") obstacles.push(p.box);
|
|
130
|
+
}
|
|
131
|
+
const walls = [];
|
|
132
|
+
for (const f of layout.items.filter((p) => regionKind(layout.catalog, p.region?.kind)?.shape === "walled")) {
|
|
133
|
+
const { x0, y0, x1, y1 } = f.box, t = WALL_T, g = f.region.gate;
|
|
134
|
+
const sides = [
|
|
135
|
+
[{ x0, y0, x1, y1: y0 + t, z0: 0, z1: 0 }, "n"],
|
|
136
|
+
[{ x0, y0: y1 - t, x1, y1, z0: 0, z1: 0 }, "s"],
|
|
137
|
+
[{ x0, y0, x1: x0 + t, y1, z0: 0, z1: 0 }, "w"],
|
|
138
|
+
[{ x0: x1 - t, y0, x1, y1, z0: 0, z1: 0 }, "e"]
|
|
139
|
+
];
|
|
140
|
+
for (const [w, side] of sides) {
|
|
141
|
+
if (g && g.side === side) {
|
|
142
|
+
if (g.node) continue;
|
|
143
|
+
const at = g.at ?? 0.5, gw = g.width ?? 2;
|
|
144
|
+
if (side === "e" || side === "w") {
|
|
145
|
+
const c = y0 + (y1 - y0) * at;
|
|
146
|
+
walls.push({ ...w, y1: c - gw / 2 }, { ...w, y0: c + gw / 2 });
|
|
147
|
+
} else {
|
|
148
|
+
const c = x0 + (x1 - x0) * at;
|
|
149
|
+
walls.push({ ...w, x1: c - gw / 2 }, { ...w, x0: c + gw / 2 });
|
|
150
|
+
}
|
|
151
|
+
} else walls.push(w);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const used = /* @__PURE__ */ new Map();
|
|
155
|
+
for (const it of ends) {
|
|
156
|
+
const { r, a, b } = it;
|
|
157
|
+
if (r.raw.points) {
|
|
158
|
+
r.points = r.raw.points.map((q) => [q[0], q[1], q.length > 2 ? q[2] : floorAt(layout, q[0], q[1]) + 0.01]);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (!a || !b) continue;
|
|
162
|
+
const vias = [];
|
|
163
|
+
(r.raw.via ?? []).forEach((v, vi) => {
|
|
164
|
+
if (Array.isArray(v)) {
|
|
165
|
+
if (snap) {
|
|
166
|
+
const q = (u) => Math.round(Math.round(u / snap) * snap * 1e9) / 1e9;
|
|
167
|
+
v.forEach((u, k) => {
|
|
168
|
+
if (Math.abs(u / snap - Math.round(u / snap)) > 1e-6) err(`${r.path}/via/${vi}/${k}`, `${u} is not on the ${snap} grid; it is drawn at ${q(u)}`, void 0, "warning");
|
|
169
|
+
});
|
|
170
|
+
vias.push({ p: [q(v[0]), q(v[1])] });
|
|
171
|
+
} else vias.push({ p: [v[0], v[1]] });
|
|
172
|
+
} else {
|
|
173
|
+
const { id, side } = parseEnd(v), n = layout.byId.get(id);
|
|
174
|
+
if (!n) {
|
|
175
|
+
err(`${r.path}/via/${vi}`, `unknown node "${id}"` + dym(id, nodeIds()));
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const s = side && side !== "top" ? side : "n";
|
|
179
|
+
const [nx, ny] = sideNormal[s], bx = n.box;
|
|
180
|
+
vias.push({ p: [nx ? nx > 0 ? bx.x1 + 0.4 : bx.x0 - 0.4 : (bx.x0 + bx.x1) / 2, ny ? ny > 0 ? bx.y1 + 0.4 : bx.y0 - 0.4 : (bx.y0 + bx.y1) / 2] });
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
const obs = obstacles.filter((o) => o !== a.node.box && o !== b.node.box).concat(r.raw.cross ? [] : walls);
|
|
184
|
+
const blockers = obs.filter((o) => !contains(a.node.box, o) && !contains(b.node.box, o) && !contains(o, a.node.box) && !contains(o, b.node.box));
|
|
185
|
+
const startDir = a.side === "top" ? void 0 : sideNormal[a.side];
|
|
186
|
+
const endDir = b.side === "top" ? void 0 : sideNormal[b.side];
|
|
187
|
+
const stops = [a.p, ...vias.map((v) => v.p), b.p];
|
|
188
|
+
let pts2 = [a.p];
|
|
189
|
+
let dir = startDir;
|
|
190
|
+
let ok = true;
|
|
191
|
+
for (let i = 0; i + 1 < stops.length; i++) {
|
|
192
|
+
const last = i + 2 === stops.length;
|
|
193
|
+
const seg = astar(stops[i], stops[i + 1], blockers, used, dir, last && endDir ? [-endDir[0], -endDir[1]] : void 0, budget);
|
|
194
|
+
if (!seg) {
|
|
195
|
+
ok = false;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
pts2.push(...seg.slice(1));
|
|
199
|
+
const n = pts2.length;
|
|
200
|
+
if (n >= 2) {
|
|
201
|
+
const dx = Math.sign(pts2[n - 1][0] - pts2[n - 2][0]), dy = Math.sign(pts2[n - 1][1] - pts2[n - 2][1]);
|
|
202
|
+
dir = [dx, dy];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (!ok && budget.left <= 0) {
|
|
206
|
+
overBudget++;
|
|
207
|
+
pts2 = [a.p, [b.p[0], a.p[1]], b.p];
|
|
208
|
+
} else if (!ok) {
|
|
209
|
+
err(r.path, `no path found for route "${r.id}" from "${a.node.id}" to "${b.node.id}"`, 'add "via" points, or use "points" to draw it by hand', "warning");
|
|
210
|
+
pts2 = [a.p, [b.p[0], a.p[1]], b.p];
|
|
211
|
+
}
|
|
212
|
+
pts2 = simplify(pts2);
|
|
213
|
+
for (let i = 0; i + 1 < pts2.length; i++) mark(used, pts2[i], pts2[i + 1]);
|
|
214
|
+
r.points = withHeights(layout, pts2, a, b);
|
|
215
|
+
}
|
|
216
|
+
if (overBudget) err(scenePath, `${overBudget} of ${routes.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${ROUTE_BUDGET.toLocaleString("en")} search steps)`, 'split it into scenes, or give the busiest routes "via" points or "points"', "warning");
|
|
217
|
+
return { routes, diags };
|
|
218
|
+
}
|
|
219
|
+
function contains(outer, inner) {
|
|
220
|
+
return inner.x0 >= outer.x0 - 1e-6 && inner.x1 <= outer.x1 + 1e-6 && inner.y0 >= outer.y0 - 1e-6 && inner.y1 <= outer.y1 + 1e-6 && inner.z0 >= outer.z1 - 1e-6;
|
|
221
|
+
}
|
|
222
|
+
const key = (x, y) => `${Math.round(x / GRID)},${Math.round(y / GRID)}`;
|
|
223
|
+
function mark(used, a, b) {
|
|
224
|
+
const n = Math.max(1, Math.round(Math.hypot(b[0] - a[0], b[1] - a[1]) / GRID));
|
|
225
|
+
for (let i = 0; i <= n; i++) {
|
|
226
|
+
const k = key(a[0] + (b[0] - a[0]) * i / n, a[1] + (b[1] - a[1]) * i / n);
|
|
227
|
+
used.set(k, (used.get(k) ?? 0) + 1);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function blocked(x, y, obs) {
|
|
231
|
+
for (const o of obs) if (x > o.x0 - INFLATE && x < o.x1 + INFLATE && y > o.y0 - INFLATE && y < o.y1 + INFLATE) return true;
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
function astar(a, b, obs, used, startDir, endDir, budget = { left: Infinity }) {
|
|
235
|
+
if ((Math.abs(a[0] - b[0]) < 1e-6 || Math.abs(a[1] - b[1]) < 1e-6) && clear(a, b, obs)) {
|
|
236
|
+
const d = [Math.sign(b[0] - a[0]), Math.sign(b[1] - a[1])];
|
|
237
|
+
const okStart = !startDir || startDir[0] === d[0] && startDir[1] === d[1];
|
|
238
|
+
const okEnd = !endDir || endDir[0] === d[0] && endDir[1] === d[1];
|
|
239
|
+
if (okStart && okEnd) return [a, b];
|
|
240
|
+
}
|
|
241
|
+
if (budget.left <= 0) return null;
|
|
242
|
+
const gx = (x) => Math.round((x - a[0]) / GRID), gy = (y) => Math.round((y - a[1]) / GRID);
|
|
243
|
+
const X = (i) => a[0] + i * GRID, Y = (j) => a[1] + j * GRID;
|
|
244
|
+
const ti = gx(b[0]), tj = gy(b[1]);
|
|
245
|
+
const pad = 30;
|
|
246
|
+
const minI = Math.min(0, ti) - pad, maxI = Math.max(0, ti) + pad, minJ = Math.min(0, tj) - pad, maxJ = Math.max(0, tj) + pad;
|
|
247
|
+
const BEND = 1.2, STEP = GRID, USED = 0.06;
|
|
248
|
+
const dirs = [[1, 0], [-1, 0], [0, 1], [0, -1]];
|
|
249
|
+
const W = maxI - minI + 1, H = maxJ - minJ + 1;
|
|
250
|
+
const cell = (i, j) => (i - minI) * H + (j - minJ);
|
|
251
|
+
const blockedAt = new Int8Array(W * H).fill(-1);
|
|
252
|
+
const usedAt = new Float64Array(W * H).fill(-1);
|
|
253
|
+
const best = new Float64Array(W * H * 4).fill(Infinity);
|
|
254
|
+
const isBlocked = (i, j) => {
|
|
255
|
+
const c = cell(i, j);
|
|
256
|
+
if (blockedAt[c] < 0) blockedAt[c] = blocked(X(i), Y(j), obs) ? 1 : 0;
|
|
257
|
+
return blockedAt[c] === 1;
|
|
258
|
+
};
|
|
259
|
+
const usedCost = (i, j) => {
|
|
260
|
+
const c = cell(i, j);
|
|
261
|
+
if (usedAt[c] < 0) usedAt[c] = used.get(key(X(i), Y(j))) ?? 0;
|
|
262
|
+
return usedAt[c];
|
|
263
|
+
};
|
|
264
|
+
const open = openList();
|
|
265
|
+
const h = (i, j) => (Math.abs(i - ti) + Math.abs(j - tj)) * STEP;
|
|
266
|
+
const sd = startDir ? dirs.findIndex((d) => d[0] === startDir[0] && d[1] === startDir[1]) : -1;
|
|
267
|
+
open.push({ i: 0, j: 0, d: sd, g: 0, f: h(0, 0), idx: 0, hp: 0 });
|
|
268
|
+
const startNear = (i, j) => Math.abs(i) + Math.abs(j) <= 2;
|
|
269
|
+
const endNear = (i, j) => Math.abs(i - ti) + Math.abs(j - tj) <= 2;
|
|
270
|
+
let iter = 0;
|
|
271
|
+
while (open.length() && iter++ < 2e5) {
|
|
272
|
+
if (budget.left-- <= 0) return null;
|
|
273
|
+
const s = open.take();
|
|
274
|
+
if (s.i === ti && s.j === tj) {
|
|
275
|
+
if (endDir && s.d >= 0 && (dirs[s.d][0] !== endDir[0] || dirs[s.d][1] !== endDir[1])) {
|
|
276
|
+
} else {
|
|
277
|
+
const out = [];
|
|
278
|
+
for (let q = s; q; q = q.prev) out.push([X(q.i), Y(q.j)]);
|
|
279
|
+
out.reverse();
|
|
280
|
+
out[0] = a;
|
|
281
|
+
return fixEnd(simplify(out), b);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
for (let di = 0; di < 4; di++) {
|
|
285
|
+
const d = dirs[di];
|
|
286
|
+
if (s.d >= 0 && d[0] === -dirs[s.d][0] && d[1] === -dirs[s.d][1]) continue;
|
|
287
|
+
const i = s.i + d[0], j = s.j + d[1];
|
|
288
|
+
if (i < minI || i > maxI || j < minJ || j > maxJ) continue;
|
|
289
|
+
if (!startNear(i, j) && !endNear(i, j) && isBlocked(i, j)) continue;
|
|
290
|
+
if ((startNear(i, j) || endNear(i, j)) && isBlocked(i, j) && !(i === ti && j === tj)) {
|
|
291
|
+
const out = startNear(i, j) ? startDir : endDir && [-endDir[0], -endDir[1]];
|
|
292
|
+
if (!out || (startNear(i, j) ? d[0] !== out[0] || d[1] !== out[1] : d[0] !== endDir[0] || d[1] !== endDir[1])) continue;
|
|
293
|
+
}
|
|
294
|
+
const bend = s.d >= 0 && s.d !== di ? BEND : 0;
|
|
295
|
+
const g = s.g + STEP + bend + usedCost(i, j) * USED;
|
|
296
|
+
const kk = cell(i, j) * 4 + di;
|
|
297
|
+
if (best[kk] <= g) continue;
|
|
298
|
+
best[kk] = g;
|
|
299
|
+
open.push({ i, j, d: di, g, f: g + h(i, j), prev: s, idx: 0, hp: 0 });
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
function openList() {
|
|
305
|
+
const arr = [], heap = [];
|
|
306
|
+
const less = (a, b) => a.f < b.f || a.f === b.f && a.idx < b.idx;
|
|
307
|
+
const swap = (x, y) => {
|
|
308
|
+
const t = heap[x];
|
|
309
|
+
heap[x] = heap[y];
|
|
310
|
+
heap[y] = t;
|
|
311
|
+
heap[x].hp = x;
|
|
312
|
+
heap[y].hp = y;
|
|
313
|
+
};
|
|
314
|
+
const up = (k) => {
|
|
315
|
+
while (k > 0) {
|
|
316
|
+
const p = k - 1 >> 1;
|
|
317
|
+
if (!less(heap[k], heap[p])) break;
|
|
318
|
+
swap(k, p);
|
|
319
|
+
k = p;
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const down = (k) => {
|
|
323
|
+
for (; ; ) {
|
|
324
|
+
const l = 2 * k + 1, r = l + 1;
|
|
325
|
+
let m = k;
|
|
326
|
+
if (l < heap.length && less(heap[l], heap[m])) m = l;
|
|
327
|
+
if (r < heap.length && less(heap[r], heap[m])) m = r;
|
|
328
|
+
if (m === k) return;
|
|
329
|
+
swap(k, m);
|
|
330
|
+
k = m;
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
return {
|
|
334
|
+
length: () => arr.length,
|
|
335
|
+
push(s) {
|
|
336
|
+
s.idx = arr.length;
|
|
337
|
+
arr.push(s);
|
|
338
|
+
s.hp = heap.length;
|
|
339
|
+
heap.push(s);
|
|
340
|
+
up(s.hp);
|
|
341
|
+
},
|
|
342
|
+
take() {
|
|
343
|
+
const s = heap[0], lastH = heap.pop();
|
|
344
|
+
if (heap.length) {
|
|
345
|
+
heap[0] = lastH;
|
|
346
|
+
lastH.hp = 0;
|
|
347
|
+
down(0);
|
|
348
|
+
}
|
|
349
|
+
const last = arr.pop();
|
|
350
|
+
if (last !== s) {
|
|
351
|
+
arr[s.idx] = last;
|
|
352
|
+
last.idx = s.idx;
|
|
353
|
+
up(last.hp);
|
|
354
|
+
}
|
|
355
|
+
return s;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function fixEnd(lat, b) {
|
|
360
|
+
const q = lat.map((x) => [x[0], x[1]]);
|
|
361
|
+
const n = q.length, L = q[n - 1];
|
|
362
|
+
if (n >= 2) {
|
|
363
|
+
const prev = q[n - 2];
|
|
364
|
+
if (Math.abs(prev[1] - L[1]) < 1e-9) {
|
|
365
|
+
prev[1] = b[1];
|
|
366
|
+
if (n >= 3 && Math.abs(q[n - 3][1] - L[1]) < 1e-9) q[n - 3][1] = b[1];
|
|
367
|
+
} else if (Math.abs(prev[0] - L[0]) < 1e-9) {
|
|
368
|
+
prev[0] = b[0];
|
|
369
|
+
if (n >= 3 && Math.abs(q[n - 3][0] - L[0]) < 1e-9) q[n - 3][0] = b[0];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
q[n - 1] = b;
|
|
373
|
+
return simplify(q);
|
|
374
|
+
}
|
|
375
|
+
function clear(a, b, obs) {
|
|
376
|
+
const n = Math.max(1, Math.round(Math.hypot(b[0] - a[0], b[1] - a[1]) / (GRID / 2)));
|
|
377
|
+
for (let i = 2; i < n - 1; i++) if (blocked(a[0] + (b[0] - a[0]) * i / n, a[1] + (b[1] - a[1]) * i / n, obs)) return false;
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
function simplify(p) {
|
|
381
|
+
const out = [];
|
|
382
|
+
for (const q of p) {
|
|
383
|
+
const n = out.length;
|
|
384
|
+
if (n && Math.abs(out[n - 1][0] - q[0]) < 1e-6 && Math.abs(out[n - 1][1] - q[1]) < 1e-6) continue;
|
|
385
|
+
if (n >= 2) {
|
|
386
|
+
const a = out[n - 2], b = out[n - 1];
|
|
387
|
+
const col = Math.abs(a[0] - b[0]) < 1e-6 && Math.abs(b[0] - q[0]) < 1e-6 || Math.abs(a[1] - b[1]) < 1e-6 && Math.abs(b[1] - q[1]) < 1e-6;
|
|
388
|
+
if (col) {
|
|
389
|
+
out[n - 1] = q;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
out.push(q);
|
|
394
|
+
}
|
|
395
|
+
return out;
|
|
396
|
+
}
|
|
397
|
+
function withHeights(layout, p, a, b) {
|
|
398
|
+
const edgesX = /* @__PURE__ */ new Set(), edgesY = /* @__PURE__ */ new Set();
|
|
399
|
+
for (const r of layout.items) {
|
|
400
|
+
if (r.type !== "region" || !regionKind(layout.catalog, r.region.kind)?.floor) continue;
|
|
401
|
+
edgesX.add(r.box.x0);
|
|
402
|
+
edgesX.add(r.box.x1);
|
|
403
|
+
edgesY.add(r.box.y0);
|
|
404
|
+
edgesY.add(r.box.y1);
|
|
405
|
+
}
|
|
406
|
+
const out = [];
|
|
407
|
+
const zf = (x, y) => floorAt(layout, x, y) + 0.01;
|
|
408
|
+
for (let i = 0; i + 1 < p.length; i++) {
|
|
409
|
+
const [x0, y0] = p[i], [x1, y1] = p[i + 1];
|
|
410
|
+
const cuts = [0, 1];
|
|
411
|
+
if (Math.abs(y0 - y1) < 1e-6) for (const e of edgesX) {
|
|
412
|
+
const t = (e - x0) / (x1 - x0);
|
|
413
|
+
if (t > 1e-6 && t < 1 - 1e-6) cuts.push(t);
|
|
414
|
+
}
|
|
415
|
+
else for (const e of edgesY) {
|
|
416
|
+
const t = (e - y0) / (y1 - y0);
|
|
417
|
+
if (t > 1e-6 && t < 1 - 1e-6) cuts.push(t);
|
|
418
|
+
}
|
|
419
|
+
cuts.sort((m, n) => m - n);
|
|
420
|
+
for (let c = 0; c + 1 < cuts.length; c++) {
|
|
421
|
+
const t0 = cuts[c], t1 = cuts[c + 1], tm = (t0 + t1) / 2;
|
|
422
|
+
const z = zf(x0 + (x1 - x0) * tm, y0 + (y1 - y0) * tm);
|
|
423
|
+
const P = [x0 + (x1 - x0) * t0, y0 + (y1 - y0) * t0, z], Q = [x0 + (x1 - x0) * t1, y0 + (y1 - y0) * t1, z];
|
|
424
|
+
const last = out[out.length - 1];
|
|
425
|
+
if (last && (Math.abs(last[0] - P[0]) > 1e-6 || Math.abs(last[1] - P[1]) > 1e-6 || Math.abs(last[2] - P[2]) > 1e-6)) out.push(P);
|
|
426
|
+
else if (!last) out.push(P);
|
|
427
|
+
out.push(Q);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if (out.length) {
|
|
431
|
+
out[0][2] = a.side === "top" ? a.z : a.node.box.z0 + 0.01;
|
|
432
|
+
out[out.length - 1][2] = b.side === "top" ? b.z : b.node.box.z0 + 0.01;
|
|
433
|
+
}
|
|
434
|
+
const res = [];
|
|
435
|
+
for (const q of out) {
|
|
436
|
+
const n = res.length;
|
|
437
|
+
if (n >= 2) {
|
|
438
|
+
const u = res[n - 2], v = res[n - 1];
|
|
439
|
+
const same = Math.abs(u[2] - v[2]) < 1e-9 && Math.abs(v[2] - q[2]) < 1e-9;
|
|
440
|
+
const col = Math.abs(u[0] - v[0]) < 1e-6 && Math.abs(v[0] - q[0]) < 1e-6 || Math.abs(u[1] - v[1]) < 1e-6 && Math.abs(v[1] - q[1]) < 1e-6;
|
|
441
|
+
if (same && col) {
|
|
442
|
+
res[n - 1] = q;
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
res.push(q);
|
|
447
|
+
}
|
|
448
|
+
return res;
|
|
449
|
+
}
|
|
450
|
+
function dym(w, c) {
|
|
451
|
+
const d = didYouMean(w, c);
|
|
452
|
+
return d ? ` (did you mean "${d}"?)` : "";
|
|
453
|
+
}
|
|
454
|
+
export {
|
|
455
|
+
ROUTE_BUDGET,
|
|
456
|
+
floorAt,
|
|
457
|
+
openList,
|
|
458
|
+
parseEnd,
|
|
459
|
+
routeAll,
|
|
460
|
+
simplify
|
|
461
|
+
};
|