@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.5d2eede → 6.4.0-pr.revamp.667.853b1ff

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.
Files changed (145) hide show
  1. package/README.md +56 -5
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +12 -1
  4. package/dist/3d.js +43 -24
  5. package/dist/CurrentPose/index.cjs +1 -0
  6. package/dist/CurrentPose/index.d.ts +3 -0
  7. package/dist/CurrentPose/index.js +9 -0
  8. package/dist/CurrentPoseBar/index.cjs +1 -1
  9. package/dist/CurrentPoseBar/index.js +1 -1
  10. package/dist/JoggingButtons/index.cjs +1 -1
  11. package/dist/JoggingButtons/index.js +1 -1
  12. package/dist/JoggingGizmo/index.cjs +1 -1
  13. package/dist/JoggingGizmo/index.d.ts +1 -0
  14. package/dist/JoggingGizmo/index.js +2 -2
  15. package/dist/JoggingJointSlider/index.cjs +1 -1
  16. package/dist/JoggingJointSlider/index.js +1 -1
  17. package/dist/RobotControl/index.cjs +1 -0
  18. package/dist/RobotControl/index.d.ts +3 -0
  19. package/dist/RobotControl/index.js +9 -0
  20. package/dist/RobotControlPanel/index.cjs +1 -1
  21. package/dist/RobotControlPanel/index.js +1 -1
  22. package/dist/RobotHeader/index.cjs +1 -1
  23. package/dist/RobotHeader/index.d.ts +4 -0
  24. package/dist/RobotHeader/index.js +8 -3
  25. package/dist/RobotScene/index.cjs +1 -0
  26. package/dist/RobotScene/index.d.ts +5 -0
  27. package/dist/RobotScene/index.js +11 -0
  28. package/dist/RobotView/index.cjs +1 -0
  29. package/dist/RobotView/index.d.ts +4 -0
  30. package/dist/RobotView/index.js +9 -0
  31. package/dist/SafetyBar/index.cjs +1 -1
  32. package/dist/SafetyBar/index.d.ts +1 -0
  33. package/dist/SafetyBar/index.js +4 -3
  34. package/dist/chunks/CurrentPose-DQ-FaAnr.js +52 -0
  35. package/dist/chunks/CurrentPose-fWc6ySnk.cjs +1 -0
  36. package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-B3-XLeu2.js} +2 -2
  37. package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-CSHQ26mR.cjs} +1 -1
  38. package/dist/chunks/{JoggingButtons-CXaozFVz.js → JoggingButtons-D4S2oJGt.js} +1 -1
  39. package/dist/chunks/{JoggingButtons-CbL-5LMK.cjs → JoggingButtons-nXLqJLIr.cjs} +1 -1
  40. package/dist/chunks/{JoggingGizmo-SuS9MmL7.js → JoggingGizmo-9wEBSe1P.js} +301 -280
  41. package/dist/chunks/JoggingGizmo-BJ3wDpAJ.cjs +1 -0
  42. package/dist/chunks/{JoggingGizmoOrientation-dzned4f4.cjs → JoggingGizmoOrientation-D9VS6nag.cjs} +1 -1
  43. package/dist/chunks/{JoggingGizmoOrientation-x_crT_64.js → JoggingGizmoOrientation-DYeHwowd.js} +1 -1
  44. package/dist/chunks/{JoggingJointSlider-R3_A9Ppj.cjs → JoggingJointSlider-D7AsxkrT.cjs} +1 -1
  45. package/dist/chunks/{JoggingJointSlider-CZ-k6XCa.js → JoggingJointSlider-DQneQhXH.js} +1 -1
  46. package/dist/chunks/Pose3-B_fLR-Wv.js +80 -0
  47. package/dist/chunks/Pose3-Ch4xVeXV.cjs +1 -0
  48. package/dist/chunks/PoseTransformer-dP4nzrPG.cjs +1 -0
  49. package/dist/chunks/PoseTransformer-tafab65c.js +454 -0
  50. package/dist/chunks/Robot-DEJXhv-D.cjs +1 -0
  51. package/dist/chunks/Robot-IG0yo_YD.js +428 -0
  52. package/dist/chunks/RobotControl-0tL4CY3m.cjs +1 -0
  53. package/dist/chunks/RobotControl-C59I0tMh.js +317 -0
  54. package/dist/chunks/RobotControlPanel-BXUgib6Z.cjs +1 -0
  55. package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-BzqLtecA.js} +264 -262
  56. package/dist/chunks/RobotScene-BS77SUtN.js +1230 -0
  57. package/dist/chunks/RobotScene-BjctJ5z1.cjs +1 -0
  58. package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +1 -0
  59. package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +25 -0
  60. package/dist/chunks/RobotView-BlV3MdCy.cjs +1 -0
  61. package/dist/chunks/RobotView-CGvHcO7j.js +158 -0
  62. package/dist/chunks/{converters-DAr6IQbG.js → converters-D9KpJ2HD.js} +2 -2
  63. package/dist/chunks/coordSystemLabel-BThpFG9n.cjs +1 -0
  64. package/dist/chunks/coordSystemLabel-Bfy9MUsV.js +6 -0
  65. package/dist/chunks/externalizeComponent-BW1UV6Gh.cjs +2 -0
  66. package/dist/chunks/{externalizeComponent-_w2d1_pz.js → externalizeComponent-TgclPxwg.js} +34 -10
  67. package/dist/chunks/{TrajectoryExecutionStore-DYVukgCz.js → loadRobotSession-BrXLZLOr.js} +1987 -1202
  68. package/dist/chunks/loadRobotSession-D84myCwy.cjs +3 -0
  69. package/dist/chunks/robotActivationOf-BCKyEgny.cjs +1 -0
  70. package/dist/chunks/robotActivationOf-DUbbBf7J.js +480 -0
  71. package/dist/chunks/{SafetyBar-RkN0I1Cb.js → robotSafetyOf-BGSW_Ql3.js} +45 -35
  72. package/dist/chunks/{SafetyBar-BVk-SH_0.cjs → robotSafetyOf-Y4NuRInk.cjs} +1 -1
  73. package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
  74. package/dist/chunks/useEveryFrame-DAuNawGP.js +155 -0
  75. package/dist/chunks/useWebGLRenderer-BozrbZz-.js +45 -0
  76. package/dist/chunks/useWebGLRenderer-CtddVDDb.cjs +1 -0
  77. package/dist/components/connectionWarning/ConnectionWarning.d.ts +21 -0
  78. package/dist/components/connectionWarning/connectionWarningOf.d.ts +11 -0
  79. package/dist/components/connectionWarning/timeAgo.d.ts +5 -0
  80. package/dist/components/currentPoseBar/CurrentPose.d.ts +23 -0
  81. package/dist/components/currentPoseBar/useCurrentPoseProps.d.ts +16 -0
  82. package/dist/components/jogging/coordSystemLabel.d.ts +7 -0
  83. package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +8 -1
  84. package/dist/components/robotControl/JogArea.d.ts +5 -2
  85. package/dist/components/robotControl/RobotControl.d.ts +23 -0
  86. package/dist/components/robotControl/poseText.d.ts +21 -5
  87. package/dist/components/robotControl/useRobotControlProps.d.ts +28 -0
  88. package/dist/components/robotHeader/robotActivationOf.d.ts +8 -0
  89. package/dist/components/robotHeader/robotSafetyOf.d.ts +11 -0
  90. package/dist/components/robotScene/JoggingAxes.d.ts +38 -0
  91. package/dist/components/robotScene/RobotScene.d.ts +28 -0
  92. package/dist/components/robotScene/RobotSceneView.d.ts +53 -0
  93. package/dist/components/robotScene/useRobotSceneProps.d.ts +18 -0
  94. package/dist/components/robotSession/RobotSessionProvider.d.ts +13 -0
  95. package/dist/components/robotView/RobotCanvas.d.ts +42 -0
  96. package/dist/components/robotView/RobotView.d.ts +23 -0
  97. package/dist/components/robotView/WebGLUnavailable.d.ts +5 -0
  98. package/dist/components/robots/DHRobot.d.ts +1 -1
  99. package/dist/components/robots/GenericRobot.d.ts +16 -1
  100. package/dist/components/robots/LinearAxis.d.ts +12 -11
  101. package/dist/components/robots/LinearAxisAnimator.d.ts +1 -1
  102. package/dist/components/robots/Robot.d.ts +26 -9
  103. package/dist/components/robots/SupportedLinearAxis.d.ts +16 -3
  104. package/dist/components/robots/SupportedRobot.d.ts +21 -3
  105. package/dist/components/robots/ghostStyle.d.ts +21 -0
  106. package/dist/components/robots/modelRotation.d.ts +14 -0
  107. package/dist/components/robots/robotModelLogic.d.ts +138 -6
  108. package/dist/components/robots/robotModelSource.d.ts +51 -0
  109. package/dist/components/utils/useWebGLRenderer.d.ts +32 -0
  110. package/dist/components/utils/webglSupport.d.ts +11 -0
  111. package/dist/core.cjs +1 -1
  112. package/dist/core.d.ts +17 -0
  113. package/dist/core.js +68 -39
  114. package/dist/index.cjs +1 -1
  115. package/dist/index.js +116 -68
  116. package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
  117. package/dist/lib/controllerStateSource.d.ts +6 -4
  118. package/dist/lib/motionGroupModelResources.d.ts +1 -0
  119. package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
  120. package/dist/lib/robotSession/RobotActivation.d.ts +59 -0
  121. package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
  122. package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
  123. package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
  124. package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
  125. package/dist/lib/robotSession/RobotSession.d.ts +84 -0
  126. package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
  127. package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
  128. package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
  129. package/dist/lib/robotSession/robotPose.d.ts +28 -0
  130. package/dist/nats.cjs +1 -0
  131. package/dist/nats.d.ts +4 -0
  132. package/dist/nats.js +131 -0
  133. package/package.json +11 -1
  134. package/dist/chunks/JoggingGizmo-DGbFLWgT.cjs +0 -1
  135. package/dist/chunks/Pose3-DIyg-aZA.cjs +0 -1
  136. package/dist/chunks/Pose3-pocKPrHN.js +0 -292
  137. package/dist/chunks/Robot-B3vKEVXP.cjs +0 -1
  138. package/dist/chunks/Robot-DXhaz1tq.js +0 -1272
  139. package/dist/chunks/RobotControlPanel-BXtBHEe9.cjs +0 -1
  140. package/dist/chunks/RobotHeader-DDmDkUoV.js +0 -244
  141. package/dist/chunks/RobotHeader-Daft80jq.cjs +0 -1
  142. package/dist/chunks/TrajectoryExecutionStore-CKfEoKo8.cjs +0 -3
  143. package/dist/chunks/externalizeComponent-BdxGBLIv.cjs +0 -2
  144. package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
  145. package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +0 -1
@@ -1,19 +1,22 @@
1
- import { jsxs as w, jsx as g, Fragment as bt } from "react/jsx-runtime";
2
- import T from "@mui/material/Box";
3
- import { useThree as Mt, useFrame as At, Canvas as wt } from "@react-three/fiber";
4
- import { Fragment as St, useRef as L, useEffect as k, useMemo as D, useState as et } from "react";
1
+ import { jsxs as S, jsx as g, Fragment as bt } from "react/jsx-runtime";
2
+ import _ from "@mui/material/Box";
3
+ import Mt from "@mui/material/Typography";
4
+ import { useThree as At, useFrame as wt, Canvas as St } from "@react-three/fiber";
5
+ import { Fragment as Et, useRef as C, useEffect as k, useMemo as B, useState as et } from "react";
6
+ import { useTranslation as vt } from "react-i18next";
5
7
  import { Vector3 as A, Quaternion as v, Matrix4 as ot } from "three";
6
- import { e as Et } from "./externalizeComponent-_w2d1_pz.js";
7
- import { c as vt, i as Rt, J as _, a as F, u as Tt } from "./joggingColors-CuT5u0H8.js";
8
- import { alpha as U, useTheme as rt } from "@mui/material/styles";
9
- const st = new A(0, 1, 0), I = 0.26, at = 0.1, _t = { x: "X", y: "Y", z: "Z" };
10
- function G(t) {
8
+ import { e as Rt } from "./externalizeComponent-TgclPxwg.js";
9
+ import { u as Tt } from "./useWebGLRenderer-BozrbZz-.js";
10
+ import { c as _t, i as It, J as P, a as G, u as Ot } from "./joggingColors-CuT5u0H8.js";
11
+ import { alpha as q, useTheme as rt } from "@mui/material/styles";
12
+ const st = new A(0, 1, 0), $ = 0.26, at = 0.1, Pt = { x: "X", y: "Y", z: "Z" };
13
+ function z(t) {
11
14
  var n;
12
- return ((n = vt[_t[t]].buttonBackgroundColor) == null ? void 0 : n.default) ?? "currentColor";
15
+ return ((n = _t[Pt[t]].buttonBackgroundColor) == null ? void 0 : n.default) ?? "currentColor";
13
16
  }
14
- const Ot = 200;
17
+ const Ft = 200;
15
18
  function H(t) {
16
- const n = t / Ot;
19
+ const n = t / Ft;
17
20
  return {
18
21
  /** Room around the gizmo for the labels, arrowheads and grab bars */
19
22
  marginPx: 30 * n,
@@ -32,38 +35,38 @@ function H(t) {
32
35
  labelFontPx: Math.max(10, 13 * n)
33
36
  };
34
37
  }
35
- function It(t, n, e) {
38
+ function $t(t, n, e) {
36
39
  return Math.max(1, Math.min(t, n) / 2 - e);
37
40
  }
38
- function Pt(t, n) {
39
- const { gripPx: e, grab: l } = H(t);
40
- return { radiusPx: n, gripPx: e, headLength: I, ...l };
41
+ function Nt(t, n) {
42
+ const { gripPx: e, grab: i } = H(t);
43
+ return { radiusPx: n, gripPx: e, headLength: $, ...i };
41
44
  }
42
- function Ft(t, n) {
43
- const { gripPx: e, grab: l } = H(t);
45
+ function Gt(t, n) {
46
+ const { gripPx: e, grab: i } = H(t);
44
47
  return {
45
48
  radiusPx: n,
46
49
  gripPx: e,
47
- beyondTipPx: l.beyondTipPx,
48
- headLength: I
50
+ beyondTipPx: i.beyondTipPx,
51
+ headLength: $
49
52
  };
50
53
  }
51
- function O(t, n) {
54
+ function F(t, n) {
52
55
  return (e) => {
53
56
  e ? t.current.set(n, e) : t.current.delete(n);
54
57
  };
55
58
  }
56
- const R = (t) => `${t.axis}${t.direction}`, ct = (t) => `label:${t}`, it = [0, 1], lt = (t, n) => `half:${R(t)}:${n}`, ut = (t) => `halo:${R(t)}`, ht = (t) => `focus:${R(t)}`, B = "polygon(0 0, 0 0, 0 0)";
59
+ const R = (t) => `${t.axis}${t.direction}`, ct = (t) => `label:${t}`, it = [0, 1], lt = (t, n) => `half:${R(t)}:${n}`, ut = (t) => `halo:${R(t)}`, ht = (t) => `focus:${R(t)}`, j = "polygon(0 0, 0 0, 0 0)";
57
60
  function pt(t, {
58
61
  isPressed: n,
59
62
  hovered: e,
60
- disabled: l
63
+ disabled: i
61
64
  }) {
62
- const s = n(t), r = !l && (s || Rt(e, t));
65
+ const s = n(t), r = !i && (s || It(e, t));
63
66
  return { pressed: s, lit: r };
64
67
  }
65
68
  function dt(t, { pressed: n, lit: e }) {
66
- return n ? U(t, 0.25) : e ? U(t, 0.12) : "transparent";
69
+ return n ? q(t, 0.25) : e ? q(t, 0.12) : "transparent";
67
70
  }
68
71
  function ft(t, { onHover: n, handlersFor: e }) {
69
72
  return {
@@ -76,83 +79,83 @@ const J = (t) => ({
76
79
  cursor: t ? "default" : "pointer",
77
80
  touchAction: "none",
78
81
  userSelect: "none"
79
- }), mt = (t) => `2px solid ${t.palette.primary.main}`, j = {
82
+ }), mt = (t) => `2px solid ${t.palette.primary.main}`, D = {
80
83
  x: new A(1, 0, 0),
81
84
  y: new A(0, 1, 0),
82
85
  z: new A(0, 0, 1)
83
86
  };
84
- function $t(t, n, e = new v()) {
87
+ function Lt(t, n, e = new v()) {
85
88
  return e.copy(t).invert().multiply(n);
86
89
  }
87
- const Nt = new v().setFromRotationMatrix(
90
+ const zt = new v().setFromRotationMatrix(
88
91
  new ot().makeBasis(
89
92
  new A(1, 0, 0),
90
93
  new A(0, 0, -1),
91
94
  new A(0, 1, 0)
92
95
  )
93
- ), W = new v(), zt = new v();
94
- function Gt(t) {
95
- return t.up.z > 0.5 ? zt : Nt;
96
+ ), W = new v(), Ct = new v();
97
+ function Ht(t) {
98
+ return t.up.z > 0.5 ? Ct : zt;
96
99
  }
97
- function mn(t, n = new v()) {
98
- return t.getWorldQuaternion(W), $t(W, Gt(t), n);
100
+ function An(t, n = new v()) {
101
+ return t.getWorldQuaternion(W), Lt(W, Ht(t), n);
99
102
  }
100
- function Lt(t, n, e = new v()) {
103
+ function kt(t, n, e = new v()) {
101
104
  return e.copy(t).multiply(n);
102
105
  }
103
- const Ht = 1e-8;
106
+ const jt = 1e-8;
104
107
  function K(t, n) {
105
- return t ? Math.abs(t.dot(n)) < 1 - Ht : !0;
106
- }
107
- function Ct(t) {
108
- const { disabled: n, label: e, overlay: l, size: s } = t, r = rt(), { gripPx: a } = H(s);
109
- return _.flatMap(
110
- (u) => F.map((o) => {
111
- const i = { axis: u, direction: o }, f = pt(i, t), c = ft(i, t);
112
- return /* @__PURE__ */ w(St, { children: [
108
+ return t ? Math.abs(t.dot(n)) < 1 - jt : !0;
109
+ }
110
+ function Bt(t) {
111
+ const { disabled: n, label: e, overlay: i, size: s } = t, r = rt(), { gripPx: a } = H(s);
112
+ return P.flatMap(
113
+ (u) => G.map((o) => {
114
+ const l = { axis: u, direction: o }, d = pt(l, t), c = ft(l, t);
115
+ return /* @__PURE__ */ S(Et, { children: [
113
116
  /* @__PURE__ */ g(
114
- T,
117
+ _,
115
118
  {
116
119
  component: "span",
117
120
  "aria-hidden": !0,
118
- ref: O(l, ut(i)),
121
+ ref: F(i, ut(l)),
119
122
  sx: {
120
123
  // Cut to the band along the arc by RotationScene
121
124
  position: "absolute",
122
125
  inset: 0,
123
- clipPath: B,
126
+ clipPath: j,
124
127
  pointerEvents: "none",
125
- background: dt(G(u), f)
128
+ background: dt(z(u), d)
126
129
  }
127
130
  }
128
131
  ),
129
132
  it.map((h) => /* @__PURE__ */ g(
130
- T,
133
+ _,
131
134
  {
132
135
  component: "span",
133
136
  "aria-hidden": !0,
134
- ref: O(l, lt(i, h)),
137
+ ref: F(i, lt(l, h)),
135
138
  ...c,
136
139
  sx: {
137
140
  // Covers the gizmo, cut to its half of the band by
138
141
  // RotationScene, every frame the gizmo turns
139
142
  position: "absolute",
140
143
  inset: 0,
141
- clipPath: B,
144
+ clipPath: j,
142
145
  ...J(n)
143
146
  }
144
147
  },
145
148
  h
146
149
  )),
147
150
  /* @__PURE__ */ g(
148
- T,
151
+ _,
149
152
  {
150
153
  component: "button",
151
154
  type: "button",
152
- ref: O(l, R(i)),
155
+ ref: F(i, R(l)),
153
156
  disabled: n,
154
- "aria-label": e(i),
155
- "aria-pressed": f.pressed,
157
+ "aria-label": e(l),
158
+ "aria-pressed": d.pressed,
156
159
  ...c,
157
160
  sx: {
158
161
  // Placed on the arrowhead by RotationScene. It shows nothing
@@ -174,7 +177,7 @@ function Ct(t) {
174
177
  }
175
178
  ),
176
179
  /* @__PURE__ */ g(
177
- T,
180
+ _,
178
181
  {
179
182
  component: "svg",
180
183
  "aria-hidden": !0,
@@ -195,7 +198,7 @@ function Ct(t) {
195
198
  children: /* @__PURE__ */ g(
196
199
  "path",
197
200
  {
198
- ref: O(l, ht(i)),
201
+ ref: F(i, ht(l)),
199
202
  fill: "none",
200
203
  stroke: r.palette.primary.main,
201
204
  strokeWidth: 2,
@@ -204,37 +207,37 @@ function Ct(t) {
204
207
  )
205
208
  }
206
209
  )
207
- ] }, R(i));
210
+ ] }, R(l));
208
211
  })
209
212
  );
210
213
  }
211
- const P = 0.8, X = 0.45, yt = 2.25, gt = {
214
+ const N = 0.8, X = 0.45, yt = 2.25, gt = {
212
215
  x: [new A(0, 1, 0), new A(0, 0, 1)],
213
216
  y: [new A(-1, 0, 0), new A(0, 0, 1)],
214
217
  z: [new A(1, 0, 0), new A(0, 1, 0)]
215
218
  };
216
- function q(t) {
219
+ function V(t) {
217
220
  const n = t === "+" ? X : X + Math.PI, e = n + yt;
218
221
  return { start: n, end: e, head: t === "+" ? e : n };
219
222
  }
220
- const kt = new A(), z = new A(), Bt = new A();
221
- function Dt(t, n = 24) {
223
+ const Dt = new A(), L = new A(), Jt = new A();
224
+ function Ut(t, n = 24) {
222
225
  const e = [];
223
- for (const l of _) {
224
- const [s, r] = gt[l], a = (o) => kt.copy(s).multiplyScalar(Math.cos(o) * P).addScaledVector(r, Math.sin(o) * P).applyQuaternion(t), u = Math.abs(
225
- Bt.copy(j[l]).applyQuaternion(t).z
226
+ for (const i of P) {
227
+ const [s, r] = gt[i], a = (o) => Dt.copy(s).multiplyScalar(Math.cos(o) * N).addScaledVector(r, Math.sin(o) * N).applyQuaternion(t), u = Math.abs(
228
+ Jt.copy(D[i]).applyQuaternion(t).z
226
229
  );
227
- for (const o of F) {
228
- const { start: i, end: f, head: c } = q(o), h = [];
230
+ for (const o of G) {
231
+ const { start: l, end: d, head: c } = V(o), h = [];
229
232
  for (let M = 0; M <= n; M++) {
230
- const S = a(i + (f - i) * M / n);
231
- h.push({ x: S.x + 0, y: -S.y + 0, depth: S.z });
233
+ const E = a(l + (d - l) * M / n);
234
+ h.push({ x: E.x + 0, y: -E.y + 0, depth: E.z });
232
235
  }
233
- const y = a(c), p = { x: y.x + 0, y: -y.y + 0, depth: y.z }, d = o === "+" ? 1 : -1;
234
- z.copy(s).multiplyScalar(-Math.sin(c) * d).addScaledVector(r, Math.cos(c) * d).applyQuaternion(t);
235
- const m = Math.hypot(z.x, z.y), x = m > 1e-9 ? z.x / m : 0, b = m > 1e-9 ? -z.y / m : 0;
236
+ const m = a(c), p = { x: m.x + 0, y: -m.y + 0, depth: m.z }, f = o === "+" ? 1 : -1;
237
+ L.copy(s).multiplyScalar(-Math.sin(c) * f).addScaledVector(r, Math.cos(c) * f).applyQuaternion(t);
238
+ const y = Math.hypot(L.x, L.y), x = y > 1e-9 ? L.x / y : 0, b = y > 1e-9 ? -L.y / y : 0;
236
239
  e.push({
237
- axis: l,
240
+ axis: i,
238
241
  direction: o,
239
242
  points: h,
240
243
  head: { ...p, dx: x + 0, dy: b + 0 },
@@ -244,8 +247,8 @@ function Dt(t, n = 24) {
244
247
  }
245
248
  return e;
246
249
  }
247
- function jt(t, n, e) {
248
- let l = { distance: Number.POSITIVE_INFINITY, depth: 0 };
250
+ function Vt(t, n, e) {
251
+ let i = { distance: Number.POSITIVE_INFINITY, depth: 0 };
249
252
  for (let s = 1; s < t.length; s++) {
250
253
  const r = t[s - 1], a = t[s], u = (a.x - r.x) ** 2 + (a.y - r.y) ** 2, o = u === 0 ? 0 : Math.min(
251
254
  1,
@@ -253,37 +256,37 @@ function jt(t, n, e) {
253
256
  0,
254
257
  ((n - r.x) * (a.x - r.x) + (e - r.y) * (a.y - r.y)) / u
255
258
  )
256
- ), i = Math.hypot(
259
+ ), l = Math.hypot(
257
260
  n - (r.x + o * (a.x - r.x)),
258
261
  e - (r.y + o * (a.y - r.y))
259
262
  );
260
- i < l.distance && (l = { distance: i, depth: r.depth + o * (a.depth - r.depth) });
263
+ l < i.distance && (i = { distance: l, depth: r.depth + o * (a.depth - r.depth) });
261
264
  }
262
- return l;
265
+ return i;
263
266
  }
264
- function Jt(t, n) {
265
- const e = t.length, l = t.map(() => new Array(e).fill(!1));
267
+ function qt(t, n) {
268
+ const e = t.length, i = t.map(() => new Array(e).fill(!1));
266
269
  for (let o = 0; o < e; o++)
267
- for (let i = o + 1; i < e; i++) {
268
- if (t[o].arc === t[i].arc) continue;
269
- let f = 0;
270
+ for (let l = o + 1; l < e; l++) {
271
+ if (t[o].arc === t[l].arc) continue;
272
+ let d = 0;
270
273
  for (const c of t[o].line) {
271
- const h = jt(t[i].line, c.x, c.y);
272
- h.distance < n && (f += c.depth - h.depth);
274
+ const h = Vt(t[l].line, c.x, c.y);
275
+ h.distance < n && (d += c.depth - h.depth);
273
276
  }
274
- f > 0 ? l[o][i] = !0 : f < 0 && (l[i][o] = !0);
277
+ d > 0 ? i[o][l] = !0 : d < 0 && (i[l][o] = !0);
275
278
  }
276
279
  const s = t.map(
277
- ({ line: o }) => o.reduce((i, f) => i + f.depth, 0) / o.length
278
- ), r = (o, i) => s[o] - s[i], a = new Array(e).fill(0), u = new Set(t.keys());
280
+ ({ line: o }) => o.reduce((l, d) => l + d.depth, 0) / o.length
281
+ ), r = (o, l) => s[o] - s[l], a = new Array(e).fill(0), u = new Set(t.keys());
279
282
  for (let o = 1; u.size > 0; o++) {
280
- const i = [...u], f = i.filter((h) => !i.some((y) => l[h][y])), c = (f.length > 0 ? f : i).sort(r)[0];
283
+ const l = [...u], d = l.filter((h) => !l.some((m) => i[h][m])), c = (d.length > 0 ? d : l).sort(r)[0];
281
284
  a[c] = o, u.delete(c);
282
285
  }
283
286
  return a;
284
287
  }
285
288
  const Q = 8;
286
- function V(t, n) {
289
+ function U(t, n) {
287
290
  const e = [...t];
288
291
  if (n >= 0) {
289
292
  const s = e[e.length - 1], r = e[e.length - 2], a = Math.hypot(s.x - r.x, s.y - r.y) || 1;
@@ -293,146 +296,146 @@ function V(t, n) {
293
296
  depth: s.depth
294
297
  }), e;
295
298
  }
296
- let l = -n;
299
+ let i = -n;
297
300
  for (; e.length > 2; ) {
298
301
  const s = e[e.length - 1], r = e[e.length - 2], a = Math.hypot(s.x - r.x, s.y - r.y);
299
- if (a > l) {
300
- const u = l / a;
302
+ if (a > i) {
303
+ const u = i / a;
301
304
  return e[e.length - 1] = {
302
305
  x: s.x + (r.x - s.x) * u,
303
306
  y: s.y + (r.y - s.y) * u,
304
307
  depth: s.depth + (r.depth - s.depth) * u
305
308
  }, e;
306
309
  }
307
- l -= a, e.pop();
310
+ i -= a, e.pop();
308
311
  }
309
312
  return e;
310
313
  }
311
- const Y = (t, n) => V([...t].reverse(), n).reverse();
312
- function Vt(t, n) {
313
- const e = n / 2, l = [], s = [], r = [];
314
+ const Y = (t, n) => U([...t].reverse(), n).reverse();
315
+ function Wt(t, n) {
316
+ const e = n / 2, i = [], s = [], r = [];
314
317
  let a = { x: 0, y: 0 };
315
- for (const [o, i] of t.entries()) {
316
- const f = t[Math.max(0, o - 1)], c = t[Math.min(t.length - 1, o + 1)], h = c.x - f.x, y = c.y - f.y, p = Math.hypot(h, y);
317
- p > 1e-9 && (a = { x: -y / p, y: h / p }), r.push(a), l.push({ x: i.x + a.x * e, y: i.y + a.y * e }), s.push({ x: i.x - a.x * e, y: i.y - a.y * e });
318
+ for (const [o, l] of t.entries()) {
319
+ const d = t[Math.max(0, o - 1)], c = t[Math.min(t.length - 1, o + 1)], h = c.x - d.x, m = c.y - d.y, p = Math.hypot(h, m);
320
+ p > 1e-9 && (a = { x: -m / p, y: h / p }), r.push(a), i.push({ x: l.x + a.x * e, y: l.y + a.y * e }), s.push({ x: l.x - a.x * e, y: l.y - a.y * e });
318
321
  }
319
- const u = (o, i) => {
320
- const f = r[o], c = { x: f.y, y: -f.x }, h = i ? 1 : -1;
321
- return Array.from({ length: Q - 1 }, (y, p) => {
322
- const d = Math.PI * (p + 1) / Q, m = Math.cos(d) * h, x = Math.sin(d) * h;
322
+ const u = (o, l) => {
323
+ const d = r[o], c = { x: d.y, y: -d.x }, h = l ? 1 : -1;
324
+ return Array.from({ length: Q - 1 }, (m, p) => {
325
+ const f = Math.PI * (p + 1) / Q, y = Math.cos(f) * h, x = Math.sin(f) * h;
323
326
  return {
324
- x: t[o].x + (f.x * m + c.x * x) * e,
325
- y: t[o].y + (f.y * m + c.y * x) * e
327
+ x: t[o].x + (d.x * y + c.x * x) * e,
328
+ y: t[o].y + (d.y * y + c.y * x) * e
326
329
  };
327
330
  });
328
331
  };
329
- return (o, i) => [
330
- ...l.slice(o, i + 1),
331
- ...i === t.length - 1 ? u(i, !0) : [],
332
- ...s.slice(o, i + 1).reverse(),
332
+ return (o, l) => [
333
+ ...i.slice(o, l + 1),
334
+ ...l === t.length - 1 ? u(l, !0) : [],
335
+ ...s.slice(o, l + 1).reverse(),
333
336
  ...o === 0 ? u(o, !1) : []
334
337
  ];
335
338
  }
336
- function qt(t, n) {
339
+ function Kt(t, n) {
337
340
  return [
338
341
  { from: 0, to: Math.min(t - 1, n + 1) },
339
342
  { from: Math.max(0, n - 1), to: t - 1 }
340
343
  ];
341
344
  }
342
- function Ut(t, { radiusPx: n, gripPx: e, beyondTipPx: l, headLength: s }) {
343
- const r = e / 2, a = s / 2 * n + l - r, u = l - r, o = t.map((p) => {
344
- const d = p.points.map((b) => ({
345
+ function Xt(t, { radiusPx: n, gripPx: e, beyondTipPx: i, headLength: s }) {
346
+ const r = e / 2, a = s / 2 * n + i - r, u = i - r, o = t.map((p) => {
347
+ const f = p.points.map((b) => ({
345
348
  x: b.x * n,
346
349
  y: b.y * n,
347
350
  depth: b.depth
348
- })), m = d[d.length >> 1], x = p.direction === "+" ? Y(V(d, a), u) : V(Y(d, a), u);
349
- return { line: x, middle: x.indexOf(m) };
350
- }), i = o.map(({ line: p }) => p), f = t.map(
351
- (p) => 2 * P * n * p.openness >= e
352
- ), c = i.flatMap(
353
- (p, d) => f[d] ? qt(p.length, o[d].middle).map(({ from: m, to: x }) => ({
354
- arc: d,
355
- from: m,
351
+ })), y = f[f.length >> 1], x = p.direction === "+" ? Y(U(f, a), u) : U(Y(f, a), u);
352
+ return { line: x, middle: x.indexOf(y) };
353
+ }), l = o.map(({ line: p }) => p), d = t.map(
354
+ (p) => 2 * N * n * p.openness >= e
355
+ ), c = l.flatMap(
356
+ (p, f) => d[f] ? Kt(p.length, o[f].middle).map(({ from: y, to: x }) => ({
357
+ arc: f,
358
+ from: y,
356
359
  to: x,
357
- line: p.slice(m, x + 1)
360
+ line: p.slice(y, x + 1)
358
361
  })) : []
359
- ), h = Jt(c, e), y = t.map((p, d) => d).sort((p, d) => t[p].head.depth - t[d].head.depth);
360
- return t.map((p, d) => {
361
- if (!f[d]) return null;
362
- const m = Vt(i[d], e), x = c.flatMap(
363
- (b, M) => b.arc === d ? [{ ...b, layer: h[M] }] : []
362
+ ), h = qt(c, e), m = t.map((p, f) => f).sort((p, f) => t[p].head.depth - t[f].head.depth);
363
+ return t.map((p, f) => {
364
+ if (!d[f]) return null;
365
+ const y = Wt(l[f], e), x = c.flatMap(
366
+ (b, M) => b.arc === f ? [{ ...b, layer: h[M] }] : []
364
367
  );
365
368
  return {
366
- band: m(0, i[d].length - 1),
367
- halves: x.map(({ from: b, to: M, layer: S }) => ({
368
- polygon: m(b, M),
369
- layer: S
369
+ band: y(0, l[f].length - 1),
370
+ halves: x.map(({ from: b, to: M, layer: E }) => ({
371
+ polygon: y(b, M),
372
+ layer: E
370
373
  })),
371
374
  head: { x: p.head.x * n, y: p.head.y * n },
372
- headLayer: c.length + 1 + y.indexOf(d)
375
+ headLayer: c.length + 1 + m.indexOf(f)
373
376
  };
374
377
  });
375
378
  }
376
- function xt(t, n, e, l) {
377
- const s = L(null), r = Mt((a) => a.invalidate);
379
+ function xt(t, n, e, i) {
380
+ const s = C(null), r = At((a) => a.invalidate);
378
381
  k(() => {
379
382
  s.current = null, r();
380
- }, [l, r]), k(() => {
383
+ }, [i, r]), k(() => {
381
384
  let a = requestAnimationFrame(function u() {
382
385
  const o = t.current;
383
386
  o && K(s.current, o) && r(), a = requestAnimationFrame(u);
384
387
  });
385
388
  return () => cancelAnimationFrame(a);
386
- }, [t, r]), At(() => {
389
+ }, [t, r]), wt(() => {
387
390
  const a = t.current;
388
391
  !a || !n.current || K(s.current, a) && (n.current.quaternion.copy(a), e(a) && (s.current = a.clone()));
389
392
  });
390
393
  }
391
394
  const Z = 0.03;
392
- function Wt({
395
+ function Qt({
393
396
  orientation: t,
394
397
  lit: n,
395
398
  disabled: e,
396
- size: l,
399
+ size: i,
397
400
  radius: s,
398
401
  overlay: r
399
402
  }) {
400
- const a = L(null), u = l / 2, o = (c) => `${(u + c).toFixed(2)}px`, i = (c) => `polygon(${c.map((h) => `${o(h.x)} ${o(h.y)}`).join(", ")})`, f = (c) => `M${c.map((h) => `${(u + h.x).toFixed(2)} ${(u + h.y).toFixed(2)}`).join("L")}Z`;
403
+ const a = C(null), u = i / 2, o = (c) => `${(u + c).toFixed(2)}px`, l = (c) => `polygon(${c.map((h) => `${o(h.x)} ${o(h.y)}`).join(", ")})`, d = (c) => `M${c.map((h) => `${(u + h.x).toFixed(2)} ${(u + h.y).toFixed(2)}`).join("L")}Z`;
401
404
  return xt(
402
405
  t,
403
406
  a,
404
407
  (c) => {
405
408
  let h = !0;
406
- const y = Dt(c), p = Ut(y, Ft(l, s));
407
- for (const [d, m] of y.entries()) {
408
- const x = r.current.get(R(m)), b = r.current.get(ut(m)), M = r.current.get(ht(m)), S = it.map(
409
- ($) => r.current.get(lt(m, $))
409
+ const m = Ut(c), p = Xt(m, Gt(i, s));
410
+ for (const [f, y] of m.entries()) {
411
+ const x = r.current.get(R(y)), b = r.current.get(ut(y)), M = r.current.get(ht(y)), E = it.map(
412
+ (I) => r.current.get(lt(y, I))
410
413
  );
411
- if (!x || !b || !M || S.some(($) => !$)) {
414
+ if (!x || !b || !M || E.some((I) => !I)) {
412
415
  h = !1;
413
416
  continue;
414
417
  }
415
- const E = p[d];
416
- x.style.left = o(m.head.x * s), x.style.top = o(m.head.y * s), x.style.zIndex = E ? String(E.headLayer) : "0", x.style.pointerEvents = E ? "" : "none", x.dataset.band = E ? "shown" : "none", b.style.clipPath = E ? i(E.band) : B, M.setAttribute("d", E ? f(E.band) : "");
417
- for (const [$, C] of S.entries()) {
418
- if (!C) continue;
419
- const N = E == null ? void 0 : E.halves[$];
420
- C.style.clipPath = N ? i(N.polygon) : B, C.style.zIndex = N ? String(N.layer) : "0", C.style.pointerEvents = N ? "" : "none";
418
+ const w = p[f];
419
+ x.style.left = o(y.head.x * s), x.style.top = o(y.head.y * s), x.style.zIndex = w ? String(w.headLayer) : "0", x.style.pointerEvents = w ? "" : "none", x.dataset.band = w ? "shown" : "none", b.style.clipPath = w ? l(w.band) : j, M.setAttribute("d", w ? d(w.band) : "");
420
+ for (const [I, O] of E.entries()) {
421
+ if (!O) continue;
422
+ const T = w == null ? void 0 : w.halves[I];
423
+ O.style.clipPath = T ? l(T.polygon) : j, O.style.zIndex = T ? String(T.layer) : "0", O.style.pointerEvents = T ? "" : "none";
421
424
  }
422
425
  }
423
426
  return h;
424
427
  },
425
- `${l}:${s}`
426
- ), /* @__PURE__ */ w("group", { ref: a, children: [
427
- /* @__PURE__ */ w("mesh", { children: [
428
+ `${i}:${s}`
429
+ ), /* @__PURE__ */ S("group", { ref: a, children: [
430
+ /* @__PURE__ */ S("mesh", { children: [
428
431
  /* @__PURE__ */ g("sphereGeometry", { args: [0.07, 16, 16] }),
429
432
  /* @__PURE__ */ g("meshBasicMaterial", { color: "#c4c8d0" })
430
433
  ] }),
431
- _.map((c) => /* @__PURE__ */ g(
432
- Kt,
434
+ P.map((c) => /* @__PURE__ */ g(
435
+ Yt,
433
436
  {
434
437
  axis: c,
435
- color: G(c),
438
+ color: z(c),
436
439
  lit: (n == null ? void 0 : n.axis) === c ? n.direction : null,
437
440
  disabled: e
438
441
  },
@@ -440,27 +443,27 @@ function Wt({
440
443
  ))
441
444
  ] });
442
445
  }
443
- function Kt({
446
+ function Yt({
444
447
  axis: t,
445
448
  color: n,
446
449
  lit: e,
447
- disabled: l
450
+ disabled: i
448
451
  }) {
449
- const s = D(() => {
452
+ const s = B(() => {
450
453
  const [r, a] = gt[t];
451
454
  return new v().setFromRotationMatrix(
452
- new ot().makeBasis(r, a, j[t])
455
+ new ot().makeBasis(r, a, D[t])
453
456
  );
454
457
  }, [t]);
455
- return /* @__PURE__ */ g("group", { quaternion: s, children: F.map((r) => {
456
- const a = e === r, u = a ? 1 : l ? 0.35 : 0.8, o = a ? Z * 1.5 : Z;
457
- return /* @__PURE__ */ w("group", { children: [
458
- /* @__PURE__ */ w("mesh", { rotation: [0, 0, q(r).start], children: [
459
- /* @__PURE__ */ g("torusGeometry", { args: [P, o, 12, 48, yt] }),
458
+ return /* @__PURE__ */ g("group", { quaternion: s, children: G.map((r) => {
459
+ const a = e === r, u = a ? 1 : i ? 0.35 : 0.8, o = a ? Z * 1.5 : Z;
460
+ return /* @__PURE__ */ S("group", { children: [
461
+ /* @__PURE__ */ S("mesh", { rotation: [0, 0, V(r).start], children: [
462
+ /* @__PURE__ */ g("torusGeometry", { args: [N, o, 12, 48, yt] }),
460
463
  /* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: u })
461
464
  ] }),
462
465
  /* @__PURE__ */ g(
463
- Xt,
466
+ Zt,
464
467
  {
465
468
  direction: r,
466
469
  color: n,
@@ -471,18 +474,18 @@ function Kt({
471
474
  ] }, r);
472
475
  }) });
473
476
  }
474
- function Xt({
477
+ function Zt({
475
478
  direction: t,
476
479
  color: n,
477
480
  opacity: e,
478
- lit: l
481
+ lit: i
479
482
  }) {
480
- const { position: s, rotation: r } = D(() => {
481
- const { head: a } = q(t), u = t === "+" ? 1 : -1;
483
+ const { position: s, rotation: r } = B(() => {
484
+ const { head: a } = V(t), u = t === "+" ? 1 : -1;
482
485
  return {
483
486
  position: new A(
484
- Math.cos(a) * P,
485
- Math.sin(a) * P,
487
+ Math.cos(a) * N,
488
+ Math.sin(a) * N,
486
489
  0
487
490
  ),
488
491
  rotation: new v().setFromUnitVectors(
@@ -491,45 +494,45 @@ function Xt({
491
494
  )
492
495
  };
493
496
  }, [t]);
494
- return /* @__PURE__ */ w("mesh", { position: s, quaternion: r, scale: l ? 1.2 : 1, children: [
495
- /* @__PURE__ */ g("coneGeometry", { args: [at, I, 20] }),
497
+ return /* @__PURE__ */ S("mesh", { position: s, quaternion: r, scale: i ? 1.2 : 1, children: [
498
+ /* @__PURE__ */ g("coneGeometry", { args: [at, $, 20] }),
496
499
  /* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: e })
497
500
  ] });
498
501
  }
499
- function Qt(t) {
500
- const { disabled: n, label: e, overlay: l, size: s } = t, r = rt(), { gripPx: a, labelFontPx: u } = H(s);
501
- return /* @__PURE__ */ w(bt, { children: [
502
- _.map((o) => /* @__PURE__ */ g(
503
- T,
502
+ function tn(t) {
503
+ const { disabled: n, label: e, overlay: i, size: s } = t, r = rt(), { gripPx: a, labelFontPx: u } = H(s);
504
+ return /* @__PURE__ */ S(bt, { children: [
505
+ P.map((o) => /* @__PURE__ */ g(
506
+ _,
504
507
  {
505
508
  component: "span",
506
509
  "aria-hidden": !0,
507
- ref: O(l, ct(o)),
510
+ ref: F(i, ct(o)),
508
511
  sx: {
509
512
  position: "absolute",
510
513
  transform: "translate(-50%, -50%)",
511
514
  pointerEvents: "none",
512
515
  fontSize: u,
513
- color: G(o),
516
+ color: z(o),
514
517
  opacity: n ? 0.4 : 1
515
518
  },
516
519
  children: o.toUpperCase()
517
520
  },
518
521
  o
519
522
  )),
520
- _.flatMap(
521
- (o) => F.map((i) => {
522
- const f = { axis: o, direction: i }, c = pt(f, t);
523
+ P.flatMap(
524
+ (o) => G.map((l) => {
525
+ const d = { axis: o, direction: l }, c = pt(d, t);
523
526
  return /* @__PURE__ */ g(
524
- T,
527
+ _,
525
528
  {
526
529
  component: "button",
527
530
  type: "button",
528
- ref: O(l, R(f)),
531
+ ref: F(i, R(d)),
529
532
  disabled: n,
530
- "aria-label": e(f),
533
+ "aria-label": e(d),
531
534
  "aria-pressed": c.pressed,
532
- ...ft(f, t),
535
+ ...ft(d, t),
533
536
  sx: {
534
537
  // Placed, sized and turned along its half of the axis by
535
538
  // TranslationScene, every frame the gizmo turns
@@ -539,25 +542,25 @@ function Qt(t) {
539
542
  padding: 0,
540
543
  borderRadius: `${a / 2}px`,
541
544
  border: "none",
542
- background: dt(G(o), c),
545
+ background: dt(z(o), c),
543
546
  "&:focus-visible": { outline: mt(r) },
544
547
  ...J(n)
545
548
  }
546
549
  },
547
- R(f)
550
+ R(d)
548
551
  );
549
552
  })
550
553
  )
551
554
  ] });
552
555
  }
553
- function Yt(t) {
556
+ function nn(t) {
554
557
  const n = [];
555
- for (const e of _)
556
- for (const l of F) {
557
- const s = j[e].clone().multiplyScalar(l === "+" ? 1 : -1).applyQuaternion(t);
558
+ for (const e of P)
559
+ for (const i of G) {
560
+ const s = D[e].clone().multiplyScalar(i === "+" ? 1 : -1).applyQuaternion(t);
558
561
  n.push({
559
562
  axis: e,
560
- direction: l,
563
+ direction: i,
561
564
  x: s.x + 0,
562
565
  y: -s.y + 0,
563
566
  depth: s.z
@@ -565,8 +568,8 @@ function Yt(t) {
565
568
  }
566
569
  return n;
567
570
  }
568
- function Zt(t, n) {
569
- const { radiusPx: e, gripPx: l, innerPx: s, beyondTipPx: r, minTipPx: a, headLength: u } = n, o = t.map((c) => {
571
+ function en(t, n) {
572
+ const { radiusPx: e, gripPx: i, innerPx: s, beyondTipPx: r, minTipPx: a, headLength: u } = n, o = t.map((c) => {
570
573
  const h = Math.hypot(c.x, c.y) * e;
571
574
  return {
572
575
  tip: h,
@@ -578,65 +581,65 @@ function Zt(t, n) {
578
581
  };
579
582
  });
580
583
  for (const [c, h] of o.entries())
581
- for (const y of o.slice(c + 1)) {
582
- if (!h.grabbed || !y.grabbed) continue;
583
- const [p, d] = h.tip <= y.tip ? [h, y] : [y, h], m = h.angle - y.angle, x = p.tip * Math.abs(Math.sin(m));
584
- if (Math.cos(m) <= 0 || x >= l) continue;
585
- const b = d.tip * (1 - u);
584
+ for (const m of o.slice(c + 1)) {
585
+ if (!h.grabbed || !m.grabbed) continue;
586
+ const [p, f] = h.tip <= m.tip ? [h, m] : [m, h], y = h.angle - m.angle, x = p.tip * Math.abs(Math.sin(y));
587
+ if (Math.cos(y) <= 0 || x >= i) continue;
588
+ const b = f.tip * (1 - u);
586
589
  if (p.tip > b) {
587
- const M = h.depth < y.depth ? h : y;
590
+ const M = h.depth < m.depth ? h : m;
588
591
  M.grabbed = !1;
589
592
  } else {
590
593
  const M = (p.tip + b) / 2;
591
- p.end = Math.min(p.end, M), d.start = Math.max(d.start, M);
594
+ p.end = Math.min(p.end, M), f.start = Math.max(f.start, M);
592
595
  }
593
596
  }
594
- const i = o.map((c, h) => h);
595
- i.sort((c, h) => o[c].depth - o[h].depth);
596
- const f = new Map(i.map((c, h) => [c, h + 1]));
597
+ const l = o.map((c, h) => h);
598
+ l.sort((c, h) => o[c].depth - o[h].depth);
599
+ const d = new Map(l.map((c, h) => [c, h + 1]));
597
600
  return o.map((c, h) => !c.grabbed || c.end <= c.start ? null : {
598
601
  x: Math.cos(c.angle) * c.start,
599
602
  y: Math.sin(c.angle) * c.start,
600
603
  length: c.end - c.start,
601
604
  angle: c.angle,
602
- layer: f.get(h) ?? 0
605
+ layer: d.get(h) ?? 0
603
606
  });
604
607
  }
605
608
  const tt = 0.035, nt = 1.28;
606
- function tn({
609
+ function on({
607
610
  orientation: t,
608
611
  lit: n,
609
612
  disabled: e,
610
- size: l,
613
+ size: i,
611
614
  radius: s,
612
615
  overlay: r
613
616
  }) {
614
- const a = L(null), u = l / 2;
617
+ const a = C(null), u = i / 2;
615
618
  return xt(
616
619
  t,
617
620
  a,
618
621
  (o) => {
619
- let i = !0;
620
- const f = Yt(o), c = Zt(f, Pt(l, s));
621
- for (const [h, y] of f.entries()) {
622
- const p = r.current.get(R(y)), d = c[h];
623
- if (p ? d ? (p.style.left = `${u + d.x}px`, p.style.top = `${u + d.y}px`, p.style.width = `${d.length}px`, p.style.transform = `translateY(-50%) rotate(${d.angle}rad)`, p.style.zIndex = String(d.layer), p.style.pointerEvents = "") : p.style.pointerEvents = "none" : i = !1, y.direction !== "+") continue;
624
- const m = r.current.get(ct(y.axis));
625
- m ? (m.style.left = `${u + y.x * s * nt}px`, m.style.top = `${u + y.y * s * nt}px`) : i = !1;
622
+ let l = !0;
623
+ const d = nn(o), c = en(d, Nt(i, s));
624
+ for (const [h, m] of d.entries()) {
625
+ const p = r.current.get(R(m)), f = c[h];
626
+ if (p ? f ? (p.style.left = `${u + f.x}px`, p.style.top = `${u + f.y}px`, p.style.width = `${f.length}px`, p.style.transform = `translateY(-50%) rotate(${f.angle}rad)`, p.style.zIndex = String(f.layer), p.style.pointerEvents = "") : p.style.pointerEvents = "none" : l = !1, m.direction !== "+") continue;
627
+ const y = r.current.get(ct(m.axis));
628
+ y ? (y.style.left = `${u + m.x * s * nt}px`, y.style.top = `${u + m.y * s * nt}px`) : l = !1;
626
629
  }
627
- return i;
630
+ return l;
628
631
  },
629
- `${l}:${s}`
630
- ), /* @__PURE__ */ w("group", { ref: a, children: [
631
- /* @__PURE__ */ w("mesh", { children: [
632
+ `${i}:${s}`
633
+ ), /* @__PURE__ */ S("group", { ref: a, children: [
634
+ /* @__PURE__ */ S("mesh", { children: [
632
635
  /* @__PURE__ */ g("sphereGeometry", { args: [0.07, 16, 16] }),
633
636
  /* @__PURE__ */ g("meshBasicMaterial", { color: "#c4c8d0" })
634
637
  ] }),
635
- _.map((o) => /* @__PURE__ */ g(
636
- nn,
638
+ P.map((o) => /* @__PURE__ */ g(
639
+ rn,
637
640
  {
638
641
  axis: o,
639
- color: G(o),
642
+ color: z(o),
640
643
  lit: (n == null ? void 0 : n.axis) === o ? n.direction : null,
641
644
  disabled: e
642
645
  },
@@ -644,41 +647,41 @@ function tn({
644
647
  ))
645
648
  ] });
646
649
  }
647
- function nn({
650
+ function rn({
648
651
  axis: t,
649
652
  color: n,
650
653
  lit: e,
651
- disabled: l
654
+ disabled: i
652
655
  }) {
653
- const s = D(
654
- () => new v().setFromUnitVectors(st, j[t]),
656
+ const s = B(
657
+ () => new v().setFromUnitVectors(st, D[t]),
655
658
  [t]
656
- ), r = 1 - I;
657
- return /* @__PURE__ */ g("group", { quaternion: s, children: F.map((a) => {
658
- const u = e === a, o = u ? 1 : l ? 0.35 : 0.8, i = u ? tt * 1.5 : tt;
659
+ ), r = 1 - $;
660
+ return /* @__PURE__ */ g("group", { quaternion: s, children: G.map((a) => {
661
+ const u = e === a, o = u ? 1 : i ? 0.35 : 0.8, l = u ? tt * 1.5 : tt;
659
662
  return (
660
663
  // The minus half is the plus half turned around
661
- /* @__PURE__ */ w(
664
+ /* @__PURE__ */ S(
662
665
  "group",
663
666
  {
664
667
  rotation: [a === "+" ? 0 : Math.PI, 0, 0],
665
668
  children: [
666
- /* @__PURE__ */ w("mesh", { position: [0, r / 2, 0], children: [
669
+ /* @__PURE__ */ S("mesh", { position: [0, r / 2, 0], children: [
667
670
  /* @__PURE__ */ g(
668
671
  "cylinderGeometry",
669
672
  {
670
- args: [i, i, r, 12]
673
+ args: [l, l, r, 12]
671
674
  }
672
675
  ),
673
676
  /* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: o })
674
677
  ] }),
675
- /* @__PURE__ */ w(
678
+ /* @__PURE__ */ S(
676
679
  "mesh",
677
680
  {
678
- position: [0, 1 - I / 2, 0],
681
+ position: [0, 1 - $ / 2, 0],
679
682
  scale: u ? 1.2 : 1,
680
683
  children: [
681
- /* @__PURE__ */ g("coneGeometry", { args: [at, I, 20] }),
684
+ /* @__PURE__ */ g("coneGeometry", { args: [at, $, 20] }),
682
685
  /* @__PURE__ */ g("meshBasicMaterial", { color: n, transparent: !0, opacity: o })
683
686
  ]
684
687
  }
@@ -690,61 +693,79 @@ function nn({
690
693
  );
691
694
  }) });
692
695
  }
693
- const en = new v();
694
- function on(t, n = en) {
695
- const e = L(n);
696
- return e.current = n, D(() => {
697
- const l = new v();
696
+ const sn = new v();
697
+ function an(t, n = sn) {
698
+ const e = C(n);
699
+ return e.current = n, B(() => {
700
+ const i = new v();
698
701
  return {
699
702
  get current() {
700
703
  const s = t.current;
701
704
  if (!s) return null;
702
705
  const r = e.current;
703
- return Lt(s, typeof r == "function" ? r() : r, l);
706
+ return kt(s, typeof r == "function" ? r() : r, i);
704
707
  }
705
708
  };
706
709
  }, [t]);
707
710
  }
708
- const rn = 3e3;
709
- function sn(t) {
711
+ const cn = 3e3;
712
+ function ln(t) {
710
713
  const [n, e] = et(() => t.current !== null);
711
714
  return k(() => {
712
715
  if (n) return;
713
- let l = requestAnimationFrame(function r() {
714
- t.current !== null ? e(!0) : l = requestAnimationFrame(r);
716
+ let i = requestAnimationFrame(function r() {
717
+ t.current !== null ? e(!0) : i = requestAnimationFrame(r);
715
718
  });
716
719
  const s = setTimeout(() => {
717
720
  t.current === null && console.warn(
718
721
  "JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene."
719
722
  );
720
- }, rn);
723
+ }, cn);
721
724
  return () => {
722
- cancelAnimationFrame(l), clearTimeout(s);
725
+ cancelAnimationFrame(i), clearTimeout(s);
723
726
  };
724
727
  }, [n, t]), n;
725
728
  }
726
- const yn = Et(
729
+ const wn = Rt(
727
730
  ({
728
731
  orientation: t,
729
732
  frameQuaternion: n,
730
733
  motion: e = "translate",
731
- onJogStart: l,
734
+ onJogStart: i,
732
735
  onJogStop: s,
733
736
  activeHandle: r,
734
737
  disabled: a = !1,
735
- size: u = 200
738
+ size: u = 200,
739
+ onWebGLUnavailable: o
736
740
  }) => {
737
- const o = sn(t), i = a || !o, f = on(t, n), { held: c, handlersFor: h, label: y, isPressed: p } = Tt({
741
+ const { t: l } = vt(), { unavailable: d, makeRenderer: c } = Tt({
742
+ onWebGLUnavailable: o
743
+ }), h = ln(t), m = a || !h, p = an(t, n), { held: f, handlersFor: y, label: x, isPressed: b } = Ot({
738
744
  motion: e,
739
- onJogStart: l,
745
+ onJogStart: i,
740
746
  onJogStop: s,
741
747
  activeHandle: r,
742
- disabled: i
743
- }), [d, m] = et(null);
744
- k(() => m(null), [e]);
745
- const x = e === "rotate" ? Wt : tn, b = e === "rotate" ? Ct : Qt, M = L(/* @__PURE__ */ new Map()), S = It(u, u, H(u).marginPx);
746
- return /* @__PURE__ */ w(
747
- T,
748
+ disabled: m
749
+ }), [M, E] = et(null);
750
+ k(() => E(null), [e]);
751
+ const w = e === "rotate" ? Qt : on, I = e === "rotate" ? Bt : tn, O = C(/* @__PURE__ */ new Map()), T = $t(u, u, H(u).marginPx);
752
+ return d ? /* @__PURE__ */ g(
753
+ _,
754
+ {
755
+ "data-testid": "jogging-gizmo-unavailable",
756
+ sx: {
757
+ width: u,
758
+ height: u,
759
+ flexShrink: 0,
760
+ display: "flex",
761
+ alignItems: "center",
762
+ justifyContent: "center",
763
+ textAlign: "center"
764
+ },
765
+ children: /* @__PURE__ */ g(Mt, { variant: "body2", color: "text.secondary", children: l("JoggingGizmo.WebGLUnavailable.lb") })
766
+ }
767
+ ) : /* @__PURE__ */ S(
768
+ _,
748
769
  {
749
770
  "data-testid": "jogging-gizmo",
750
771
  sx: {
@@ -759,7 +780,7 @@ const yn = Et(
759
780
  },
760
781
  children: [
761
782
  /* @__PURE__ */ g(
762
- wt,
783
+ St,
763
784
  {
764
785
  orthographic: !0,
765
786
  flat: !0,
@@ -767,36 +788,36 @@ const yn = Et(
767
788
  camera: {
768
789
  position: [0, 0, 10],
769
790
  up: [0, 1, 0],
770
- zoom: S,
791
+ zoom: T,
771
792
  near: 0.1,
772
793
  far: 100
773
794
  },
774
- gl: { alpha: !0, antialias: !0 },
795
+ gl: c,
775
796
  style: { position: "absolute", inset: 0, pointerEvents: "none" },
776
797
  children: /* @__PURE__ */ g(
777
- x,
798
+ w,
778
799
  {
779
- orientation: f,
780
- lit: c ?? r ?? d,
781
- disabled: i,
800
+ orientation: p,
801
+ lit: f ?? r ?? M,
802
+ disabled: m,
782
803
  size: u,
783
- radius: S,
784
- overlay: M
804
+ radius: T,
805
+ overlay: O
785
806
  }
786
807
  )
787
808
  }
788
809
  ),
789
810
  /* @__PURE__ */ g(
790
- b,
811
+ I,
791
812
  {
792
- isPressed: p,
793
- hovered: d,
794
- disabled: i,
813
+ isPressed: b,
814
+ hovered: M,
815
+ disabled: m,
795
816
  size: u,
796
- onHover: m,
797
- handlersFor: h,
798
- label: y,
799
- overlay: M
817
+ onHover: E,
818
+ handlersFor: y,
819
+ label: x,
820
+ overlay: O
800
821
  }
801
822
  )
802
823
  ]
@@ -805,6 +826,6 @@ const yn = Et(
805
826
  }
806
827
  );
807
828
  export {
808
- yn as J,
809
- mn as n
829
+ wn as J,
830
+ An as n
810
831
  };